CLI: coerce --tool-arg values using the tool's inputSchema (zip=10001 is sent as a number to a string field)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- cli
调研方向
Start in the CLI's --tool-arg parsing and the tool lookup that already produces tool_not_found and reads inputSchema, since the coercion has to use that schema. The --prompt-args handling after #2859 is the reference for keeping string values verbatim. Done when zip=10001 reaches a string field unchanged, a non-parsing value for a number field gives a usage error naming the key, and --tool-args-json behaves as before.
由索引模型根据 Issue 内容生成。
描述
Which client?
CLI
The problem
--tool-arg JSON-parses every value, so zip=10001 is sent as the number 10001. A tool whose inputSchema declares zip as string rejects the call:
mcp-inspector --cli node server.mjs --method tools/call --tool-name echo_typed --tool-arg zip=10001
→ Input validation error: ... zip: Invalid input: expected string, received number (exit 5)
The behaviour is documented (count=1 becomes a number), but it makes --tool-arg unreliable for ZIP codes, IDs, phone numbers, versions (1.10 → 1.1) and other numeric-looking strings. Users have to know to switch to --tool-args-json and quote everything. Verified on 2.17.0 (main @ 2069a1a).
Solution you have in mind (optional)
The CLI already looks the tool up (tool_not_found, --strict), so it has the inputSchema. Coerce each key=value by the declared type of that property:
type: "string"→ keep the raw text verbatim (as--prompt-argsnow does after #2859)number/integer/boolean/object/array→ JSON-parse as today, and fail with a usage error naming the key if it doesn't parse to that type- no schema for the key, or a union type → current behaviour
The same applies to mcpdo's --tool-arg and key:=value positionals. --tool-args-json stays verbatim. That matches #2171, which kept raw JSON in the web client from being retyped by the schema; this request only covers key=value text.
Alternatives or workarounds you have tried
--tool-args-json '{"zip":"10001"}', or --tool-arg zip='"10001"'. Both work but need shell quoting, which is especially awkward in PowerShell and cmd.
Already built it locally?
No response
Before you submit
- I searched existing issues and this is not a duplicate.
- This is a request for the Inspector itself, not for the MCP specification or an SDK.
- 主要语言
- TypeScript
- 星标
- 11.3k
- 派生
- 1.6k
- 平均合并
- 2 小时 28 分钟
- 30 天内合并 PR
- 111
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/inspector 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
modelcontextprotocol/inspector#3073 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/inspector#3072 ·
维护者通常 1 天内回复
-
CLI/mcpdo: a timeout above 2147483647 ms fires after 1 ms, and the error says to raise it further未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/inspector#3071 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/inspector#3069 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/inspector#3067 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/inspector 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
yavorsky/unbuilt.app#65 ·
-
CVE security
难度 2/5 1-3 小时 新手友好度 68/100
mckinsey/agents-at-scale-ark#4091 · 1 条评论 ·
维护者通常 1 天内回复
-
factory:subtask
难度 1/5 1 小时以内 新手友好度 94/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
NUS-Project-SaBai/project-sabai#386 ·
维护者通常 3 天内回复
-
android needs clarification
难度 2/5 1-3 小时 新手友好度 72/100
super-productivity/super-productivity#12105 · 3 条评论 ·
维护者通常 1 天内回复