Repository navigation
MCP: a guessed tool name gets the server's real names back; a sign-in page says to sign in again - #506
Merged
Conversation
…a web page in reply says to sign in again A guessed tool name (gws_docs_get) now gets the server's tool names back, those sharing the guess's prefix first and most shared words first, at most 30, with the match that lists the rest, after relisting in case the server's tools changed. An error that is a web page, or a parse error of one (Unexpected token '<'), says the gateway returned a page and to sign in again instead of the parse error.
HazAT
added a commit
that referenced
this pull request
Dec 3, 2026
Daniel approved #506 without its sign-in-page detection: remove returnedPage/pageHint, its two test tools and the README sentence. Ultimate-Conversation: 1377036
HazAT
added a commit
that referenced
this pull request
Dec 3, 2026
… abort Review of the #496/#506 merge: when the tools list refreshed after the call found the tool, the error came back with no hint. toolHint now returns the schema whenever the tool is known, before or after the refresh, and passes the call's abort signal to listTools. Ultimate-Conversation: 1377036
Owner
|
Thanks! The unknown-tool hint merged: a guessed name relists the server's tools and returns the real names. We left out the sign-in-page hint because it guesses from the error text and replaces the server's own error, and we would rather pass that error through unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Agents often guess MCP tool names. In my logs, 23 of 34 MCP failures were a guessed name, and one conversation made seven guesses in a row. Each guess got back the server's bare refusal ("Tool … is not exposed by this gateway"), so the agent guessed again or listed every tool. A gateway backend whose sign-in had lapsed answered with a parse error of an HTML page (
Unexpected token '<'), and that didn't tell the agent what to do.extensions/mcp/server.ts:unknownToolHint,toolNames): when a call fails and the server doesn't list that tool, the mcp tool lists the server's tools again (they may have changed since connecting) and adds their names to the error. That covers an error result and anMcpError. The names that share the guess's prefix come first (gws_forgws_docs_get), sorted by most shared words. It adds at most 30, then thematchthat lists the rest, e.g.and 13 more: mcp {server: "gateway", match: "^gws_"} lists them all.A known tool's bad-arguments error still carries its schema, as before.returnedPage,pageHint): an error that is a web page, or a parse error of one, now says the gateway returned a web page, usually a sign-in page, and to sign in again (for a gateway backend, reconnect it in the gateway's dashboard), instead of the parse error.The README's Tool section describes both.
How it was tested
extensions/mcp/test/mcp.test.ts: "answers a guessed tool name with the server's real names, and a sign-in page with sign in again". The test server refuses unlisted tools the way Tool Gateway does, answers one tool with a parse error of a page, and another with a realtext/htmlpage. The test checks the prefix filtering, the 30-name cap with itsmatch, the fallback to all tools when no prefix matches, and the sign-in hint for both kinds of page.main'sserver.tsand passes with the change.pnpm test extensions/mcp/: 2 files, 5 tests passed.vp lint(type-aware, with type check) andvp fmt --checkon the changed files: clean.pnpm checkorpnpm test:affected, or try it against a live gateway.