CLI --prompt-args rewrites string values ("1.50" sent as "1.5")
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
- 领域
- cli
调研方向
从 clients/cli/src/cli.ts 中的 parseKeyValuePair(约第 839 行)开始,追踪 --prompt-args 如何传递到 core/json/jsonUtils.ts(约第 423 行)中的 convertPromptArguments。保留 prompt 参数值的类型,包括看起来像数字的字符串;使用报告中的值(如 1.50 和 1e3)进行验证。CLI 按输入原样发送每个 prompt 值时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Which version line? v2 — current (@modelcontextprotocol/inspector@latest)
Which client? CLI
Inspector version: 2.13.0
Node version: 24.18
Operating system: Windows 11
Transport: stdio
What happened
mcp-inspector --cli node server.mjs --method prompts/get --prompt-name p --prompt-args price=1.50 sends {"price":"1.5"}. Likewise 1e3 is sent as "1000", 0.10 as "0.1", and 9007199254740993 as "9007199254740992".
Expected
Prompt arguments are strings per the spec, so the value should be sent exactly as typed: "1.50".
Cause
--prompt-args shares parseKeyValuePair (clients/cli/src/cli.ts:839), which JSON.parses the value, and convertPromptArguments (core/json/jsonUtils.ts:423) then re-stringifies it, so anything that parses as JSON gets normalised. mcpdo's --prompt-args (clients/mcpdo/src/connection/mcp.ts:1493) looks like it follows the same path (not run). Suggested fix: a string-only parser for --prompt-args that splits on the first = and keeps the raw value.
Related
--tool-args-json '{"v":1e400}' silently sends {"v":null}, while --tool-arg v=1e400 is rejected under #1910's rule: the JSON path (cli.ts:1700-1725) never calls isSerializableJson.
Repro server: an McpServer with registerPrompt("p", { argsSchema: { price: z.string() } }) that echoes price.
- 主要语言
- TypeScript
- 星标
- 11.2k
- 派生
- 1.6k
- 平均合并
- 5 小时 11 分钟
- 30 天内合并 PR
- 141
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/inspector 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 65/100
modelcontextprotocol/inspector#2860 ·
维护者通常 1 天内回复
-
enhancement v2
难度 4/5 3-5 天 新手友好度 45/100
modelcontextprotocol/inspector#2846 · 2 条评论 ·
维护者通常 1 天内回复
-
enhancement v2
难度 4/5 3-5 天 新手友好度 48/100
modelcontextprotocol/inspector#2845 · 2 条评论 ·
维护者通常 1 天内回复
-
enhancement v2
难度 4/5 3-5 天 新手友好度 48/100
modelcontextprotocol/inspector#2844 · 2 条评论 ·
维护者通常 1 天内回复
-
CLI: OAuth denials and other non-usage failures exit 1 with code "error", the same as a usage error未关闭bug v2
难度 3/5 1-2 天 新手友好度 68/100
modelcontextprotocol/inspector#2842 · 2 条评论 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/inspector 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
mihaip/infinite-mac#475 ·
-
Let TypeScript accept an initial object in ReactiveDict可能已有人在做 @yograj-vijay-yadav 今天认领。 未关闭bug good first issue help wanted workshop
难度 2/5 1-3 小时 新手友好度 92/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
marmelab/atomic-crm#401 ·
维护者通常 1 天内回复
-
account: profile
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 5 天内回复