Skip to content

Commit 644b749

Browse files
committed
jsonschema: experiment with a proxy package
Use a proxy package to limit the visibility of the jsonschema package and guard against incompatible API changes. DO NOT REVIEW: experiment DO NOT SUBMIT
1 parent 33ff851 commit 644b749

File tree

20 files changed

+50
-19
lines changed

20 files changed

+50
-19
lines changed

examples/server/elicitation/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"fmt"
1010
"log"
1111

12-
"github.com/google/jsonschema-go/jsonschema"
12+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
1313
"github.com/modelcontextprotocol/go-sdk/mcp"
1414
)
1515

examples/server/everything/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"runtime"
1818
"strings"
1919

20-
"github.com/google/jsonschema-go/jsonschema"
20+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
2121
"github.com/modelcontextprotocol/go-sdk/mcp"
2222
)
2323

examples/server/middleware/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"os"
1212
"time"
1313

14-
"github.com/google/jsonschema-go/jsonschema"
14+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
1515
"github.com/modelcontextprotocol/go-sdk/mcp"
1616
)
1717

examples/server/toolschemas/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"fmt"
1414
"log"
1515

16-
"github.com/google/jsonschema-go/jsonschema"
16+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
1717
"github.com/modelcontextprotocol/go-sdk/mcp"
1818
)
1919

jsonschema/jsonschema.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2025 The Go MCP SDK Authors. All rights reserved.
2+
// Use of this source code is governed by an MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package jsonschema
6+
7+
import (
8+
"reflect"
9+
10+
"github.com/google/jsonschema-go/jsonschema"
11+
)
12+
13+
func Ptr[T any](x T) *T {
14+
return jsonschema.Ptr(x)
15+
}
16+
17+
type ForOptions = jsonschema.ForOptions
18+
19+
type Resolved = jsonschema.Resolved
20+
21+
type ResolveOptions = jsonschema.ResolveOptions
22+
23+
type Schema = jsonschema.Schema
24+
25+
func For[T any](opts *ForOptions) (*Schema, error) {
26+
return jsonschema.For[T](opts)
27+
}
28+
29+
func ForType(t reflect.Type, opts *ForOptions) (*Schema, error) {
30+
return jsonschema.ForType(t, opts)
31+
}

mcp/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
"sync"
1414
"time"
1515

16-
"github.com/google/jsonschema-go/jsonschema"
1716
"github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2"
1817
"github.com/modelcontextprotocol/go-sdk/jsonrpc"
18+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
1919
)
2020

2121
// A Client is an MCP client, which may be connected to an MCP server

mcp/client_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"fmt"
1010
"log"
1111

12-
"github.com/google/jsonschema-go/jsonschema"
12+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
1313
"github.com/modelcontextprotocol/go-sdk/mcp"
1414
)
1515

mcp/client_list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"github.com/google/go-cmp/cmp"
1414
"github.com/google/go-cmp/cmp/cmpopts"
15-
"github.com/google/jsonschema-go/jsonschema"
15+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
1616
"github.com/modelcontextprotocol/go-sdk/mcp"
1717
)
1818

mcp/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/google/go-cmp/cmp"
1313
"github.com/google/go-cmp/cmp/cmpopts"
14-
"github.com/google/jsonschema-go/jsonschema"
14+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
1515
)
1616

1717
type Item struct {

mcp/conformance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424

2525
"github.com/google/go-cmp/cmp"
2626
"github.com/google/go-cmp/cmp/cmpopts"
27-
"github.com/google/jsonschema-go/jsonschema"
2827
"github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2"
2928
"github.com/modelcontextprotocol/go-sdk/jsonrpc"
29+
"github.com/modelcontextprotocol/go-sdk/jsonschema"
3030
"golang.org/x/tools/txtar"
3131
)
3232

0 commit comments

Comments
 (0)