Skip to content

feat: support default values for command tool arguments - #28

Merged
Minitour merged 5 commits into
mainfrom
develop
Mar 14, 2026
Merged

Minitour merged 5 commits into
mainfrom
develop

Conversation

@Minitour

Copy link
Copy Markdown
Member

Summary

  • Adds a default field to ArgumentDefinition so command tool arguments can specify fallback values.
  • When a caller omits an argument that has a default, the executor uses the default for placeholder substitution instead of failing with a missing-argument error.
  • Arguments with defaults are excluded from the MCP
    equired array and annotated with default in the JSON Schema, so agents see them as optional.
  • The capa sh CLI merges defaults into resolved args before the required-check, keeping the shell experience consistent.

Test plan

  • Define a command tool with default on one or more args in capabilities.yaml and verify:
    • Calling the tool without the argument succeeds using the default.
    • Calling the tool with the argument overrides the default.
  • Run capa sh --help and confirm the default value is displayed.
  • Verify that args with defaults are not listed as required in the MCP schema ( ools/list).
  • Ensure existing tools without defaults are unaffected.

Made with Cursor

Allow command tool argument definitions to include a `default` field.
When the caller omits an argument that has a default, the default is
used for placeholder substitution instead of raising a missing-argument
error. Arguments with defaults are excluded from the MCP `required`
array and annotated with `default` in the JSON Schema so agents treat
them as optional.
Cover tool-executor (subprocess with defaults), mcp-handler schema
helpers (applyDefaultsToSchema, mergeDefaults), and CLI arg parsing
and default merging in capa sh.
@Minitour
Minitour merged commit 8f8d9b3 into main Mar 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant