From 8b73ad690c819acd24b666f7dca5d1f0022292c8 Mon Sep 17 00:00:00 2001 From: duwenxin Date: Mon, 9 Feb 2026 18:37:13 -0500 Subject: [PATCH] update tools.go --- internal/server/mcp_test.go | 4 ++-- tests/tool.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/server/mcp_test.go b/internal/server/mcp_test.go index 7fec2a669c..289029a8e9 100644 --- a/internal/server/mcp_test.go +++ b/internal/server/mcp_test.go @@ -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"`, }, }, }, diff --git a/tests/tool.go b/tests/tool.go index 6d839d0bf4..df00bd4efc 100644 --- a/tests/tool.go +++ b/tests/tool.go @@ -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",