fix(mcp): scope the not-found hint away from the LLM provider list tool#431
Merged
Conversation
_provider_tool_error_from_exception appended the get_llm_providers discovery hint to every classified not_found error, including failures inside get_llm_providers itself — telling the caller to retry the tool that just failed. A keyword-only not_found_hint (default True) now gates the hint; the list tool passes False while per-id tools keep it. Mirrors the same fix on the knowledge-base tools. Closes #429
adriannoes
approved these changes
Jul 18, 2026
adriannoes
left a comment
Collaborator
There was a problem hiding this comment.
Summary
Surgical fix for the self-referential not_found discovery hint on get_llm_providers. It mirrors the knowledge-base pattern from #427, meets #429 acceptance, and keeps the classified problem envelope (kind/code/correlation_id). Reviewed with checkout+tests (13 provider tool tests green) and CI lint/test green on tip.
What worked well
Keyword-only not_found_hint with list-tool opt-out, a complementary regression pair (list without hint / dependencies with hint), and a minimal surface area.
Review path
- Checked out
ff89f460, ran ruff andpackages/mcp/tests/tools/test_llm_provider_tools.py(13 passed); CI green on tip. - Call-site matrix and KB parity: only the inventory list needed
False; defaultTrueremains correct forget_llm_provider_dependencies. - Residual wrong-hint UX on non-per-id tools is pre-existing and out of #429 scope; left as a follow-up, not blocking.
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.
Motivation
_provider_tool_error_from_exceptionappended "Use 'get_llm_providers' to list provider IDs for the organization." to every classifiednot_founderror — including failures insideget_llm_providersitself (e.g. a bad organization UUID). The error then told the agent to retry the exact tool that just failed: self-referential guidance instead of useful discovery.Outcome
A
not_foundfailure fromget_llm_providersnow carries the classified problem (kind/code/correlation_id) without the self-referential hint. The per-id provider tools (get_llm_provider_dependencies, etc.) keep the discovery hint. Mirrors the fix already applied to the knowledge-base tools.Closes #429