internal/mcp: meta and progress token
Meta is a struct that contains a map[string]any, and a ProgressToken field. Each Params and Result type has a Meta as a value field. Meta marshals and unmarshals specially, so the ProgressToken field becomes part of the map. The marshalling code is generalized in anticipation of every Params and Result growing a map of additional properties. Change-Id: I6d2f34270d33501c96437f24f91ef3e51d20d955 Reviewed-on: https://go-review.googlesource.com/c/tools/+/674956 Reviewed-by: Sam Thanawalla <samthanawalla@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Jonathan Amsterdam <jba@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
dbbdf5a181
commit
7130f0f081
1 changed files with 548 additions and 115 deletions
|
|
@ -620,7 +620,7 @@ func TestMiddleware(t *testing.T) {
|
|||
// with the given prefix.
|
||||
func traceCalls[S ClientSession | ServerSession](w io.Writer, prefix string) Middleware[S] {
|
||||
return func(h MethodHandler[S]) MethodHandler[S] {
|
||||
return func(ctx context.Context, sess *S, method string, params any) (any, error) {
|
||||
return func(ctx context.Context, sess *S, method string, params Params) (Result, error) {
|
||||
fmt.Fprintf(w, "%s >%s\n", prefix, method)
|
||||
defer fmt.Fprintf(w, "%s <%s\n", prefix, method)
|
||||
return h(ctx, sess, method, params)
|
||||
|
|
|
|||
Loading…
Reference in a new issue