You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unknown tool error always says "Unknown tool: invalid_tool_name" instead of the name that was called #1346
The text looks like it was taken from the error example in the MCP specification, where invalid_tool_name is a placeholder. Clients and logs usually show only message, so the name of the tool is lost, and it looks as if the tool were called invalid_tool_name.
Expected: the message names the tool that was called, such as Unknown tool: delete_order, in both McpAsyncServer and McpStatelessAsyncServer. data can stay as it is.
Seen with mcp-core 2.2.0, and still in main (779893c).
Confirmed on main (779893c). Root cause: the tools/call handlers in McpAsyncServer (toolsCallRequestHandler) and McpStatelessAsyncServer both build the unknown-tool error with the literal .message("Unknown tool: invalid_tool_name"), while .data(...) already uses callToolRequest.name().
Change shape: two one-line edits, .message("Unknown tool: " + callToolRequest.name()) in both classes. data is unchanged. Nothing else is touched.
Tests: one new regression test per server (McpAsyncServerUnknownToolTests, McpStatelessAsyncServerUnknownToolTests, in mcp-test because mcp-core has no JSON implementation on its test classpath). Each calls an unknown tool delete_order and asserts code -32602, message Unknown tool: delete_order and data Tool not found: delete_order.
Before the fix: 2 run, 2 failures (expected: "Unknown tool: delete_order" but was: "Unknown tool: invalid_tool_name").
After the fix: 2 run, 0 failures, 0 errors. Command: ./mvnw -o -pl mcp-core,mcp-test -am -Dtest='McpAsyncServerUnknownToolTests,McpStatelessAsyncServerUnknownToolTests' -Dsurefire.failIfNoSpecifiedTests=false test (JDK 17, spring-javaformat validate passes). I did not run the full suite, which needs Docker and npx.
Activity
Shanmukh-l33t commentedon Nov 23, 2026
Confirmed on main (779893c). Root cause: the
tools/callhandlers inMcpAsyncServer(toolsCallRequestHandler) andMcpStatelessAsyncServerboth build the unknown-tool error with the literal.message("Unknown tool: invalid_tool_name"), while.data(...)already usescallToolRequest.name().Change shape: two one-line edits,
.message("Unknown tool: " + callToolRequest.name())in both classes.datais unchanged. Nothing else is touched.Tests: one new regression test per server (
McpAsyncServerUnknownToolTests,McpStatelessAsyncServerUnknownToolTests, in mcp-test because mcp-core has no JSON implementation on its test classpath). Each calls an unknown tooldelete_orderand asserts code -32602, messageUnknown tool: delete_orderand dataTool not found: delete_order.expected: "Unknown tool: delete_order" but was: "Unknown tool: invalid_tool_name")../mvnw -o -pl mcp-core,mcp-test -am -Dtest='McpAsyncServerUnknownToolTests,McpStatelessAsyncServerUnknownToolTests' -Dsurefire.failIfNoSpecifiedTests=false test(JDK 17, spring-javaformat validate passes). I did not run the full suite, which needs Docker and npx.Branch (no PR opened, since this issue is not assigned or marked help wanted): Shanmukh-l33t/java-sdk@modelcontextprotocol:main...fix/1346-unknown-tool-name
Happy for a maintainer to take the diff as is or let me know if I should open a PR.
AI assistance was used to prepare this change and comment; I reviewed the result.