Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

CLI --prompt-args rewrites string values ("1.50" sent as "1.5")

未关闭 适合新手
#2,859 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/inspector 的其他 Issue

查看 modelcontextprotocol/inspector 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。