Skip to main content

Module parser

Module parser 

Source
Expand description

CLI argument parser: argv → tool_input.

Parses a list of CLI arguments (everything after the subcommand) into a serde_json::Value dict that can be passed directly as tool_input to the backend MCP server.

§Argument conventions (mirrors Python parse_argv_to_tool_input)

SyntaxProduces
--flag value{"flag": "value"} (string)
--flag{"flag": true} (boolean)
--no-flag{"flag": false} (boolean)
--flag true / --flag falseexplicit bool
--flag 5 (integer prop){"flag": 5}
--flag 0.5 (number prop){"flag": 0.5}
--tag a --tag b (array prop){"tag": ["a","b"]}
--json '{"k":"v"}'{"k": "v"} (raw JSON escape-hatch)
--page-id 123 (kebab flag){"page_id": "123"} (snake prop)

Unknown flags and positional arguments are errors. Missing required arguments are errors.

Functions§

parse_argv
Parse CLI argv (everything after the subcommand itself) into a JSON object suitable for use as tool_input.