mcp: allow any value for schemas (#517)

As discussed at length in
https://github.com/modelcontextprotocol/go-sdk/issues/518, coupling our
schema fields to
jsonschema.Schema limits our user's ability to use a different schema
package, and makes it impossible for our client to talk to some
backends.

This CL relaxes the type of `*jsonschema.Schema` fields to be of type
`any`, which is a breaking change but is unlikely to affect most server
code. (It *is* a nontrivial change for clients).

Fixes https://github.com/modelcontextprotocol/go-sdk/issues/518
This commit is contained in:
Robert Findley 2025-09-26 11:55:54 -04:00 • committed by GitHub
commit 964574b818
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@ package mcp_test
import (
"context"
"encoding/json"
"iter"
"log"
"testing"
@ -41,7 +42,13 @@ func TestList(t *testing.T) {
if err != nil {
t.Fatal(err)
}
tt.InputSchema = is
data, err := json.Marshal(is)
if err != nil {
t.Fatal(err)
}
if err := json.Unmarshal(data, &tt.InputSchema); err != nil {
t.Fatal(err)
}
wantTools = append(wantTools, tt)
}
t.Run("list", func(t *testing.T) {