diff --git a/examples/server/elicitation/main.go b/examples/server/elicitation/main.go index 59bc25cf..92832399 100644 --- a/examples/server/elicitation/main.go +++ b/examples/server/elicitation/main.go @@ -9,7 +9,7 @@ import ( "fmt" "log" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/examples/server/everything/main.go b/examples/server/everything/main.go index 0b81919f..61355714 100644 --- a/examples/server/everything/main.go +++ b/examples/server/everything/main.go @@ -17,7 +17,7 @@ import ( "runtime" "strings" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/examples/server/middleware/main.go b/examples/server/middleware/main.go index 4e37471e..7e1498a1 100644 --- a/examples/server/middleware/main.go +++ b/examples/server/middleware/main.go @@ -11,7 +11,7 @@ import ( "os" "time" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/examples/server/toolschemas/main.go b/examples/server/toolschemas/main.go index a53acd47..a153cbb3 100644 --- a/examples/server/toolschemas/main.go +++ b/examples/server/toolschemas/main.go @@ -13,7 +13,7 @@ import ( "fmt" "log" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/jsonschema/jsonschema.go b/jsonschema/jsonschema.go new file mode 100644 index 00000000..b990b178 --- /dev/null +++ b/jsonschema/jsonschema.go @@ -0,0 +1,31 @@ +// Copyright 2025 The Go MCP SDK Authors. All rights reserved. +// Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +package jsonschema + +import ( + "reflect" + + "github.com/google/jsonschema-go/jsonschema" +) + +func Ptr[T any](x T) *T { + return jsonschema.Ptr(x) +} + +type ForOptions = jsonschema.ForOptions + +type Resolved = jsonschema.Resolved + +type ResolveOptions = jsonschema.ResolveOptions + +type Schema = jsonschema.Schema + +func For[T any](opts *ForOptions) (*Schema, error) { + return jsonschema.For[T](opts) +} + +func ForType(t reflect.Type, opts *ForOptions) (*Schema, error) { + return jsonschema.ForType(t, opts) +} diff --git a/mcp/client.go b/mcp/client.go index dea3e854..8a048617 100644 --- a/mcp/client.go +++ b/mcp/client.go @@ -13,9 +13,9 @@ import ( "sync" "time" - "github.com/google/jsonschema-go/jsonschema" "github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2" "github.com/modelcontextprotocol/go-sdk/jsonrpc" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) // A Client is an MCP client, which may be connected to an MCP server diff --git a/mcp/client_example_test.go b/mcp/client_example_test.go index bba3da44..3578338d 100644 --- a/mcp/client_example_test.go +++ b/mcp/client_example_test.go @@ -9,7 +9,7 @@ import ( "fmt" "log" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/mcp/client_list_test.go b/mcp/client_list_test.go index 0183a733..23b076aa 100644 --- a/mcp/client_list_test.go +++ b/mcp/client_list_test.go @@ -12,7 +12,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/mcp/client_test.go b/mcp/client_test.go index eaeedc81..f27461fa 100644 --- a/mcp/client_test.go +++ b/mcp/client_test.go @@ -11,7 +11,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) type Item struct { diff --git a/mcp/conformance_test.go b/mcp/conformance_test.go index 3393efcb..9dd0f645 100644 --- a/mcp/conformance_test.go +++ b/mcp/conformance_test.go @@ -24,9 +24,9 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/google/jsonschema-go/jsonschema" "github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2" "github.com/modelcontextprotocol/go-sdk/jsonrpc" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "golang.org/x/tools/txtar" ) diff --git a/mcp/features_test.go b/mcp/features_test.go index 6df9b16e..8facbf08 100644 --- a/mcp/features_test.go +++ b/mcp/features_test.go @@ -10,7 +10,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) type SayHiParams struct { diff --git a/mcp/mcp_test.go b/mcp/mcp_test.go index 9cc105cd..4ff7fe19 100644 --- a/mcp/mcp_test.go +++ b/mcp/mcp_test.go @@ -23,8 +23,8 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/google/jsonschema-go/jsonschema" "github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) type hiParams struct { diff --git a/mcp/protocol.go b/mcp/protocol.go index f3f23f58..76096141 100644 --- a/mcp/protocol.go +++ b/mcp/protocol.go @@ -14,7 +14,7 @@ import ( "encoding/json" "fmt" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) // Optional annotations for the client. The client can use annotations to inform diff --git a/mcp/server.go b/mcp/server.go index 27de09a3..f5a6f428 100644 --- a/mcp/server.go +++ b/mcp/server.go @@ -20,10 +20,10 @@ import ( "sync" "time" - "github.com/google/jsonschema-go/jsonschema" "github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2" "github.com/modelcontextprotocol/go-sdk/internal/util" "github.com/modelcontextprotocol/go-sdk/jsonrpc" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/yosida95/uritemplate/v3" ) diff --git a/mcp/server_test.go b/mcp/server_test.go index 249ef90b..eb2d7b38 100644 --- a/mcp/server_test.go +++ b/mcp/server_test.go @@ -14,7 +14,7 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) type testItem struct { diff --git a/mcp/streamable_bench_test.go b/mcp/streamable_bench_test.go index bf82ee51..1aeac3d9 100644 --- a/mcp/streamable_bench_test.go +++ b/mcp/streamable_bench_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/mcp/streamable_test.go b/mcp/streamable_test.go index 3b967f8f..aba33d59 100644 --- a/mcp/streamable_test.go +++ b/mcp/streamable_test.go @@ -27,10 +27,10 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/google/jsonschema-go/jsonschema" "github.com/modelcontextprotocol/go-sdk/auth" "github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2" "github.com/modelcontextprotocol/go-sdk/jsonrpc" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) func TestStreamableTransports(t *testing.T) { diff --git a/mcp/tool.go b/mcp/tool.go index 12b02b7b..61fafd96 100644 --- a/mcp/tool.go +++ b/mcp/tool.go @@ -9,7 +9,7 @@ import ( "encoding/json" "fmt" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) // A ToolHandler handles a call to tools/call. diff --git a/mcp/tool_example_test.go b/mcp/tool_example_test.go index e41250d4..4652fdcb 100644 --- a/mcp/tool_example_test.go +++ b/mcp/tool_example_test.go @@ -12,7 +12,7 @@ import ( "reflect" "time" - "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/mcp/tool_test.go b/mcp/tool_test.go index ef26e9dc..b1953196 100644 --- a/mcp/tool_test.go +++ b/mcp/tool_test.go @@ -13,8 +13,8 @@ import ( "strings" "testing" - "github.com/google/jsonschema-go/jsonschema" "github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) func TestApplySchema(t *testing.T) {