Skip to content

Fix SetProgressToken when Meta is nil#838

Open
eddiearc wants to merge 1 commit intomodelcontextprotocol:mainfrom
eddiearc:codex/fix-progress-token-meta
Open

Fix SetProgressToken when Meta is nil#838
eddiearc wants to merge 1 commit intomodelcontextprotocol:mainfrom
eddiearc:codex/fix-progress-token-meta

Conversation

@eddiearc
Copy link

Summary

  • initialize the params meta map before writing progressToken
  • add a regression test covering SetProgressToken on params with nil Meta
  • assert the progress token is present in marshaled JSON

Testing

  • go test ./mcp

if got := p.GetMeta()["progressToken"]; got != "t" {
t.Errorf("got %v, want `t`", got)
}
if g, w := toJSON(p), `{"_meta":{"progressToken":"t","x":2},"name":"name"}`; g != w && g != `{"_meta":{"x":2,"progressToken":"t"},"name":"name"}` {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need these additional marshaling tests. Marshaling is tested in line 37. I would remove them (line 69 and 79).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants