fix(search_assets_tool): trap wrong params (search_query, attributes, filters, dsl, convex_context)#218
Open
mothership-ai[bot] wants to merge 1 commit intomainfrom
Open
Conversation
… filters, dsl, convex_context) LLMs send these invalid parameter names ~36 times/30d, causing opaque FastMCP validation errors. Add them as decoy params with None defaults that return descriptive redirect errors pointing to the correct tool or parameter name. Also adds a COMMON MISTAKES section to the docstring. Follows the same pattern as agent-toolkit-internal PR #162 which trapped `query` and `asset_types`. Fixes: AICHAT-830 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Session owner: @abhinavmathur-atlan
Summary
search_assets_tool(~36 errors/30d):search_query,attributes,filters,dsl,convex_contextHow it works
Instead of letting FastMCP reject these with a generic "unexpected parameter" error, we accept them but immediately return a structured error dict that tells the LLM exactly what to do:
search_query→ "Wrong tool: callsemantic_search_tool(query=...)instead"attributes→ "Wrong parameter: useinclude_attributes"filters→ "Wrong parameter: useconditions/negative_conditions/some_conditions"dsl→ "Wrong tool: callget_assets_by_dsl_tool(dsl_query=...)instead"convex_context→ "Invalid parameter: does not exist on any tool"Follows the same pattern as agent-toolkit-internal PR #162 (which trapped
queryandasset_types).Test plan
search_assets_tool(search_query="test")returns the redirect errorsearch_assets_tool(attributes=["name"])returns the redirect errorsearch_assets_tool(filters={"type": "Table"})returns the redirect errorsearch_assets_tool(dsl={"query": {}})returns the redirect errorsearch_assets_tool(convex_context="test")returns the redirect errorsearch_assets_tool(conditions=...)calls still work unchangedFixes: AICHAT-830
🤖 Generated with Claude Code