CLI: coerce --tool-arg values using the tool's inputSchema (zip=10001 is sent as a number to a string field)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- cli
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 11.3k
- Fork
- 1.6k
- Merge trung bình
- 2 giờ 28 phút
- Pull request đã merge (30 ngày)
- 111
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/inspector
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
modelcontextprotocol/inspector#3073 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
modelcontextprotocol/inspector#3072 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CLI/mcpdo: a timeout above 2147483647 ms fires after 1 ms, and the error says to raise it furtherĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/inspector#3071 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/inspector#3069 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CLI --tool-args-json silently sends 1e400 as null (round-trip guard missing; mcpdo rejects it)Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/inspector#3067 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/inspector
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
danielmiessler/LifeOS#3028 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
iOS: last line of a long UITextView text is sometimes not drawn (frame a fraction of a point short)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Koenkk/zigbee2mqtt#33855 ·
Maintainer thường phản hồi trong vòng 1 ngày