fix: list only the called action's arguments on an unknown argument #859
No reviewers
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea!859
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-756-scoped-valid-args"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
What was wrong
When a call to an action-dispatched tool carried an unknown argument, the rejection listed every argument the tool accepts across all its actions. For
madt_reposthat is about seventy names. For example,madt_repos action=search query=madtearejectedqueryand then listed the arguments of create, merge, mirror, and the other actions. Most of those names do not apply tosearch.What changed
internal/mcp/registry.go: new methodRegistry.actionScopedFieldsFor. It readsaction(andop) from the raw call arguments. It returns the sorted arguments that this action accepts, plus those of the selected op. It usesopspec.AcceptedParamSetand keeps only names that the tool's input struct records. It listsoponly when the action is op-dispatched. It looks in both the consolidated tool slot and theaddToolslot, so tools such asmadt_worktreesare covered. It reportsok=falsewhen the call has no action, the tool has no action manifest, or the action is not one the tool has.internal/mcp/register.go:installValidationEnrichmentnow passes the scoped list toformatUnknownArgs. WhenactionScopedFieldsForreportsok=false, it falls back toreg.knownFieldsFor, the full field set.Tests
All tests are in
internal/mcp/arg_scope_test.goand send real calls over an in-memory MCP transport.TestUnknownArgValidList_ScopedToCalledAction:madt_repos action=searchwithquerylists exactly the 18 arguments thatsearchaccepts.TestUnknownArgValidList_ScopedToSelectedOp:madt_issues action=body op=appendlistsopandcontent, and omitsreplacements,title, andlabels.TestUnknownArgValidList_ScopedOnAddToolManifest:madt_worktrees action=rebaselists exactlyaction,dir,onto,path,raw_json.TestUnknownArgValidList_FullSetWithoutKnownAction: a call with no action, and a call with an unknown action, both list the full set.TestUnknownArgValidList_ToolWithoutActionsKeepsFullSet:madt_commitstill lists its full set.TestUnknownArgValidList_SuggestionUnchanged: a typo of an argument that another action takes (default_brnch) still suggestsdefault_branch, while thesearchlist does not carry it.Refs #756
./scripts/gate.shpasses on this commit.Closes #756