Skip to content

fix(tools-call-error): fail as untestable when test_error_handling is not advertised - #607

Open
seedfunded wants to merge 1 commit into
modelcontextprotocol:mainfrom
seedfunded:fix/tools-call-error-missing-fixture
Open

seedfunded wants to merge 1 commit into
modelcontextprotocol:mainfrom
seedfunded:fix/tools-call-error-missing-fixture

Conversation

@seedfunded

Copy link
Copy Markdown

Summary

Fixes #604.

Previously, ToolsCallErrorScenario called tools/call for test_error_handling directly and accepted any CallToolResult with isError: true and text content. Against a server that does not implement test_error_handling, SDKs returning a "tool not found" CallToolResult with isError: true caused tools-call-error to report SUCCESS.

Root-Cause Fix

  • Query tools/list (following nextCursor pagination with a page/cycle guard) before calling tools/call.
  • If test_error_handling is not advertised, report untestableCheck(..., 'FAILURE') per Standardize how scenarios report setup/execution failures #248 instead of calling tools/call — avoiding brittle substring matching against specific error prose so compliant SDKs returning custom error text continue to pass.
  • Require non-empty text content on the error result and ensure conn.close() runs in finally.

Testing

  • Added 5 unit tests in src/scenarios/server/tools.test.ts covering missing fixture (with simulated SDK "tool not found" isError: true response), paginated tools/list, isError: false, whitespace-only error text, and conn.close() on error.
  • Verified npm run check, npm run build, and npm test (48 test files, 646 tests passing, including live everything-server on 2025-11-25 and 2026-07-28).

… not advertised

Previously, tools-call-error called tools/call directly and accepted any
CallToolResult with isError: true and text content. Against a server that
does not implement test_error_handling, SDKs returning a "tool not found"
CallToolResult with isError: true caused a false positive.

Check paginated tools/list first and report untestableCheck (FAILURE) per
issue modelcontextprotocol#248 when test_error_handling is missing, while preserving
compatibility with servers whose test_error_handling fixture returns any
non-empty error text.

Fixes modelcontextprotocol#604

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.

tools-call-error passes when the server has no test_error_handling tool

1 participant