Skip to content

fix(server): avoid error log for unknown tool protocol response - #2032

Open
FOWEPJF255 wants to merge 1 commit into
modelcontextprotocol:mainfrom
FOWEPJF255:daily24-20261122-unknown-tool-log
Open

FOWEPJF255 wants to merge 1 commit into
modelcontextprotocol:mainfrom
FOWEPJF255:daily24-20261122-unknown-tool-log

Conversation

@FOWEPJF255

Copy link
Copy Markdown

Summary

  • Distinguish the SDK's own unknown-tool protocol error from exceptions thrown by a tool or custom handler.
  • Suppress the misleading server-side ToolCallError log for that one protocol error while preserving the client-facing InvalidParams response.
  • Add an in-memory client/server regression test for the response and log behavior. The existing test for a tool that throws McpProtocolException still passes and retains its Error log.

Fixes #2030.

Reproduction and validation

  • Before the change, the new regression test failed because the server logged "no_such_tool" threw an unhandled exception.
  • After the change, the new test and the existing tool-exception test pass.
  • dotnet build: 0 warnings, 0 errors.
  • npm ci followed by dotnet test --no-build: 16,635 passed, 455 skipped, 0 failed across all solution test targets. Used .NET SDK 10.0.114 and Node.js 22.22.3.

Note

I used Codex for code and test preparation. I reviewed the diff and ran the reproduction, build, and tests locally.

Signed-off-by: FOWEPJF255 <lhi25wy@163.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling an unknown tool logs a server-side Error "threw an unhandled exception"

1 participant