scope the unknown-argument valid-argument list to the called action #756

Closed
opened 2026-10-13 21:18:20 +00:00 by hexajon · 0 comments
Owner

When a call to an action-dispatched tool carries an unknown argument, the rejection lists every argument the tool accepts across all its actions. For madt_repos that is about seventy names, most irrelevant to the action that was called.

Example: madt_repos action=search query=madtea rejects query and then lists the full madt_repos argument set (create, merge, mirror, and the rest), not the handful that search uses (q, limit, page, sort, order).

What

formatUnknownArgs in internal/mcp/arg_suggest.go renders the valid-argument list from the tool's whole recorded field set. For a consolidated, action-dispatched tool (ADR 0015) the useful set is the arguments valid for the action in the call.

Fix

Scope the valid-argument list to the called action's arguments when the call names an action on an action-dispatched tool. Fall back to the full set when there is no action. Keep the did-you-mean suggestion logic and its bounds unchanged (ADR 0005): this narrows only the fallback list, it does not loosen the matcher.

Acceptance

  • An unknown argument on action=search lists only the arguments valid for search.
  • A tool with no action still lists its full set.
  • The did-you-mean bounds (Levenshtein, token containment, synonym classes) are unchanged.
When a call to an action-dispatched tool carries an unknown argument, the rejection lists every argument the tool accepts across all its actions. For madt_repos that is about seventy names, most irrelevant to the action that was called. Example: `madt_repos action=search query=madtea` rejects `query` and then lists the full madt_repos argument set (create, merge, mirror, and the rest), not the handful that `search` uses (`q`, `limit`, `page`, `sort`, `order`). ## What formatUnknownArgs in internal/mcp/arg_suggest.go renders the valid-argument list from the tool's whole recorded field set. For a consolidated, action-dispatched tool (ADR 0015) the useful set is the arguments valid for the action in the call. ## Fix Scope the valid-argument list to the called action's arguments when the call names an action on an action-dispatched tool. Fall back to the full set when there is no action. Keep the did-you-mean suggestion logic and its bounds unchanged (ADR 0005): this narrows only the fallback list, it does not loosen the matcher. ## Acceptance - An unknown argument on `action=search` lists only the arguments valid for `search`. - A tool with no action still lists its full set. - The did-you-mean bounds (Levenshtein, token containment, synonym classes) are unchanged.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#756
No description provided.