[Bug] MCP tool argument mismatch: analyze_image rejects snake_case param "image_source" with "imageSource must be provided" when called through ZCode
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Summary
When calling the analyze_image tool of the @z_ai/mcp-server MCP server through ZCode (as mcp__4_5v_mcp__analyze_image), the call fails with:
MCP error -400: imageSource must be provided
The same tool, called directly over stdio with the exact same arguments, works correctly.
Environment
- ZCode client (Windows 10 x64), session date 2026-07-12
- MCP server:
@z_ai/mcp-server@0.1.4(also reproduced with 0.1.2), launched vianpx -y @z_ai/mcp-server@latest - Provider: Z.AI Coding Plan (GLM-5.2)
- Server registered in
~/.zcode/cli/config.jsonas:
"4_5v_mcp": {
"command": "npx",
"args": ["-y", "@z_ai/mcp-server@latest"],
"env": {
"Z_AI_API_KEY": "***",
"Z_AI_MODE": "ZAI"
}
}
Steps to reproduce
- Register
@z_ai/mcp-serverunder name4_5v_mcpincli/config.json(config above). - Restart ZCode so the MCP server is indexed.
- In a session, call the tool with arguments matching the server's JSON schema:
image_source: a valid local file path or URLprompt: any non-empty string
- Observe the error.
Expected behavior
The tool accepts image_source (snake_case) — this is the parameter name declared in the server's inputSchema (confirmed by tools/list below) — and returns a text analysis of the image.
Actual behavior
The call returns MCP error -400: imageSource must be provided.
Evidence that the MCP server itself is fine
(A) tools/list schema declares snake_case:
{
"name": "analyze_image",
"inputSchema": {
"type": "object",
"properties": {
"image_source": { "type": "string", "description": "Local file path or remote URL to the image" },
"prompt": { "type": "string", "description": "..." }
},
"required": ["image_source", "prompt"]
}
}
All 8 tools of @z_ai/mcp-server use snake_case in their schema (image_source, video_source, expected_image_source, actual_image_source, output_type, programming_language, diagram_type, analysis_focus).
(B) Direct stdio call with snake_case works:
Sending this over stdio to npx -y @z_ai/mcp-server@latest returns a correct analysis:
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{
"name":"analyze_image",
"arguments":{"image_source":"<path>","prompt":"What website is this? One sentence."}
}}
Server log:
INFO: Starting general image analysis [{"imageSource":"<path>","prompt":"..."}]
INFO: Request ZAI chat completions API for vision analysis [{"model":"glm-4.6v","messageCount":2}]
INFO: analyze-image analysis completed successfully
Response: {"content":[{"type":"text","text":"This is the Hacker News website."}]}
(C) Direct stdio call with camelCase (imageSource) fails with -32602:
{"jsonrpc":"2.0","id":4,...,"arguments":{"imageSource":"<path>","prompt":"..."}}
→ {"error":{"code":-32602,"message":"Invalid arguments: image_source is required"}}
Hypothesis (please verify on your side)
The MCP client layer in ZCode appears to convert snake_case argument names to camelCase before forwarding to the server (or the server's internal validator expects camelCase from the ZCode path but snake_case from raw stdio). The error message wording (imageSource must be provided) does not originate from @z_ai/mcp-server's zod schema (which would say image_source is required, as shown in evidence C) — it looks like an intermediate layer's validation message.
A second possibility is a name collision with a built-in vision tool, but I have no way to confirm this without ZCode debug logs.
Impact
All 8 tools of @z_ai/mcp-server are unusable through ZCode even though the server and the underlying GLM-4.6V API are fully functional. Users have to fall back to manual stdio calls, which defeats the purpose of registering it as an MCP server.
What would help me help you
- Confirmation of whether ZCode's MCP client rewrites argument names.
- If there's a debug-logging flag for MCP traffic in ZCode, I'm happy to capture and attach the actual wire payload.
Thank you.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MCP registration in cli/config.json and reproduce the analyze_image call through ZCode, then compare its forwarded arguments with the direct stdio request and the tools/list schema shown here. Inspect the MCP client-layer payload or debug output; done means the argument path is identified and all declared snake_case tool arguments work through ZCode.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100