zai-org / zai-org/feedback

[Bug] MCP tool argument mismatch: analyze_image rejects snake_case param "image_source" with "imageSource must be provided" when called through ZCode

Open
#115 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
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 via npx -y @z_ai/mcp-server@latest
  • Provider: Z.AI Coding Plan (GLM-5.2)
  • Server registered in ~/.zcode/cli/config.json as:
"4_5v_mcp": {
  "command": "npx",
  "args": ["-y", "@z_ai/mcp-server@latest"],
  "env": {
    "Z_AI_API_KEY": "***",
    "Z_AI_MODE": "ZAI"
  }
}

Steps to reproduce

  1. Register @z_ai/mcp-server under name 4_5v_mcp in cli/config.json (config above).
  2. Restart ZCode so the MCP server is indexed.
  3. In a session, call the tool with arguments matching the server's JSON schema:
    • image_source: a valid local file path or URL
    • prompt: any non-empty string
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.