Skip to content

fix: error on unknown flags in call command#35

Open
beverm2391 wants to merge 1 commit intosteipete:mainfrom
beverm2391:fix/unknown-flags-in-call
Open

fix: error on unknown flags in call command#35
beverm2391 wants to merge 1 commit intosteipete:mainfrom
beverm2391:fix/unknown-flags-in-call

Conversation

@beverm2391
Copy link

Problem

Unknown flags passed to the call command were silently treated as positional arguments and mapped to tool parameters via hydratePositionalArguments. This caused confusing behavior where:

mcporter call server.tool --source import

Would result in {"includeStarted": "import"} being sent to the tool (mapping import to the first tool parameter), causing validation errors that were hard to debug.

Solution

Added a check in parseCallArguments to detect unknown -- prefixed flags before they get pushed to the positional array. Now it throws a helpful CliUsageError with suggestions:

[mcporter] Unknown flag '--source' passed to call command.
If you intended to pass a tool argument, use 'source=<value>' or --args '{"source": ...}'.
Run 'mcporter call --help' to see available flags.

Testing

  • All 377 existing tests pass
  • Manually verified that:
    • Unknown flags now error with helpful message
    • Valid calls still work
    • key=value style arguments work
    • --args '{...}' style arguments work

Previously, unknown flags like `--source` passed to the call command were
silently treated as positional arguments and mapped to tool parameters via
hydratePositionalArguments. This caused confusing behavior where:

  mcporter call server.tool --source import

Would result in `{"includeStarted": "import"}` being sent to the tool,
causing validation errors that were hard to debug.

Now unknown `--` prefixed flags in the call command throw a helpful error
with suggestions for how to pass tool arguments correctly.
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