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

オープン 初心者向け
#2,859 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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
平均マージ
4時間 49分
マージ済み PR(30日)
139

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/inspector のほかの issue

modelcontextprotocol/inspector の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。