Problem
A JSON Schema property with a numeric enum but no type key is legal and common. schema_type_to_python() returns str whenever type is missing, so argparse parses the flag value as a string and then rejects it against the numeric choices:
$ mcp2cli --mcp-stdio "python server.py" set-level --level 2
usage: mcp2cli set-level [-h] [--stdin] [--level {1,2,3}]
mcp2cli set-level: error: argument --level: invalid choice: '2' (choose from '1', '2', '3')
The tool is uncallable from the CLI — no flag value can ever match.
Reproduction
Minimal stdio MCP server exposing one tool:
{"name": "set_level", "inputSchema": {"type": "object", "properties": {"level": {"enum": [1, 2, 3]}}}}
Verified against v3.5.0 (commit 6b8ae5f).
Expected
--level 2 works and the tool receives the integer 2. The argparse type can be inferred from the enum values when type is absent.
Problem
A JSON Schema property with a numeric
enumbut notypekey is legal and common.schema_type_to_python()returnsstrwhenevertypeis missing, so argparse parses the flag value as a string and then rejects it against the numeric choices:The tool is uncallable from the CLI — no flag value can ever match.
Reproduction
Minimal stdio MCP server exposing one tool:
{"name": "set_level", "inputSchema": {"type": "object", "properties": {"level": {"enum": [1, 2, 3]}}}}Verified against v3.5.0 (commit 6b8ae5f).
Expected
--level 2works and the tool receives the integer2. The argparse type can be inferred from the enum values whentypeis absent.