Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions mcp/protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ func TestParamsMeta(t *testing.T) {
t.Errorf("got %v, want `t`", g)
}

// The GetProgressToken and SetProgressToken methods work on a params struct that doesn't have a Meta field.
if g := p2.GetProgressToken(); g != nil {
t.Errorf("got %v, want nil", g)
}

p2.SetProgressToken("t")
if g := p2.GetProgressToken(); g != "t" {
t.Errorf("got %v, want `t`", g)
}

// You can set a progress token to an int, int32 or int64.
p.SetProgressToken(int(1))
p.SetProgressToken(int32(1))
Expand Down
1 change: 1 addition & 0 deletions mcp/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down