internal/mcp: rename Make* to New*
Change-Id: I8d3d2ca125b7c24dd265937c4fe910ea823ab811 Reviewed-on: https://go-review.googlesource.com/c/tools/+/670537 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
9031106300
commit
e0e304e51e
1 changed files with 32 additions and 32 deletions
|
|
@ -14,18 +14,18 @@ import (
|
|||
"github.com/modelcontextprotocol/go-sdk/jsonschema"
|
||||
)
|
||||
|
||||
// testToolHandler is used for type inference in TestMakeTool.
|
||||
// testToolHandler is used for type inference in TestNewTool.
|
||||
func testToolHandler[T any](context.Context, *mcp.ClientConnection, T) ([]mcp.Content, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func TestMakeTool(t *testing.T) {
|
||||
func TestNewTool(t *testing.T) {
|
||||
tests := []struct {
|
||||
tool *mcp.Tool
|
||||
want *jsonschema.Schema
|
||||
}{
|
||||
{
|
||||
mcp.MakeTool("basic", "", testToolHandler[struct {
|
||||
mcp.NewTool("basic", "", testToolHandler[struct {
|
||||
Name string `json:"name"`
|
||||
}]),
|
||||
&jsonschema.Schema{
|
||||
|
|
@ -38,7 +38,7 @@ func TestMakeTool(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
mcp.MakeTool("enum", "", testToolHandler[struct{ Name string }], mcp.Input(
|
||||
mcp.NewTool("enum", "", testToolHandler[struct{ Name string }], mcp.Input(
|
||||
mcp.Property("Name", mcp.Enum("x", "y", "z")),
|
||||
)),
|
||||
&jsonschema.Schema{
|
||||
|
|
@ -51,7 +51,7 @@ func TestMakeTool(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
mcp.MakeTool("required", "", testToolHandler[struct {
|
||||
mcp.NewTool("required", "", testToolHandler[struct {
|
||||
Name string `json:"name"`
|
||||
Language string `json:"language"`
|
||||
X int `json:"x,omitempty"`
|
||||
|
|
@ -71,7 +71,7 @@ func TestMakeTool(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
mcp.MakeTool("set_schema", "", testToolHandler[struct {
|
||||
mcp.NewTool("set_schema", "", testToolHandler[struct {
|
||||
X int `json:"x,omitempty"`
|
||||
Y int `json:"y,omitempty"`
|
||||
}], mcp.Input(
|
||||
|
|
@ -84,7 +84,7 @@ func TestMakeTool(t *testing.T) {
|
|||
}
|
||||
for _, test := range tests {
|
||||
if diff := cmp.Diff(test.want, test.tool.Definition.InputSchema, cmpopts.IgnoreUnexported(jsonschema.Schema{})); diff != "" {
|
||||
t.Errorf("MakeTool(%v) mismatch (-want +got):\n%s", test.tool.Definition.Name, diff)
|
||||
t.Errorf("NewTool(%v) mismatch (-want +got):\n%s", test.tool.Definition.Name, diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue