mcp: fix setProgressToken when Meta is nil (#846)
When `SetProgressToken` is called on a `Params` struct with a nil `Meta` field, the newly created map is never assigned back to the struct via `SetMeta`, causing the progress token to be silently lost. Call `p.SetMeta(m)` after creating the new map so the struct retains the reference. Fixes #845 Co-authored-by: Maciej Kisiel <mkisiel@google.com>
This commit is contained in:
parent
6af642cc79
commit
48879f01c9
1 changed files with 11 additions and 0 deletions
|
|
@ -447,6 +447,7 @@ func setProgressToken(p Params, pt any) {
|
|||
m := p.GetMeta()
|
||||
if m == nil {
|
||||
m = map[string]any{}
|
||||
p.SetMeta(m)
|
||||
}
|
||||
m[progressTokenKey] = pt
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue