update tools.go

This commit is contained in:
duwenxin
2026-02-09 18:37:13 -05:00
parent cfbd82b952
commit 8b73ad690c
2 changed files with 6 additions and 6 deletions

View File

@@ -320,7 +320,7 @@ func TestMcpEndpointWithoutInitialized(t *testing.T) {
Params: map[string]any{
"name": "prompt2",
"arguments": map[string]any{
"arg1": 42, // prompt2 expects a string, we send a number
"arg1": 42,
},
},
},
@@ -329,7 +329,7 @@ func TestMcpEndpointWithoutInitialized(t *testing.T) {
"id": "prompts-get-invalid-args",
"error": map[string]any{
"code": -32602.0,
"message": `invalid arguments for prompt "prompt2": unable to parse value for "arg1": %!q(float64=42) not type "string"`,
"message": `invalid arguments for prompt "prompt2": unable to parse value for %q): %!q(float64=42) not type "string"`,
},
},
},

View File

@@ -311,8 +311,8 @@ func RunToolInvokeTest(t *testing.T, select1Want string, options ...InvokeTestOp
enabled: true,
requestHeader: map[string]string{},
requestBody: bytes.NewBuffer([]byte(`{}`)),
wantBody: "",
wantStatusCode: http.StatusBadRequest,
wantBody: `{"error":"parameter \"name\" is required"}`,
wantStatusCode: http.StatusOK,
},
{
name: "Invoke my-tool with insufficient parameters",
@@ -320,8 +320,8 @@ func RunToolInvokeTest(t *testing.T, select1Want string, options ...InvokeTestOp
enabled: true,
requestHeader: map[string]string{},
requestBody: bytes.NewBuffer([]byte(`{"id": 1}`)),
wantBody: "",
wantStatusCode: http.StatusBadRequest,
wantBody: `{"error":"parameter \"name\" is required"}`,
wantStatusCode: http.StatusOK,
},
{
name: "invoke my-array-tool",