[BUG] Backend changes break MCP image analysis with GLM API - All Claude Code versions affected

Resolved 💬 8 comments Opened Oct 5, 2025 by changlehu Closed Jan 11, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code backend changes have broken MCP image analysis integration with GLM API. This issue affects ALL Claude Code versions (tested both 2.0.0 and 2.0.8), indicating this is a backend API change, not a client version issue.

What Should Happen?

When providing an image file path for analysis:

  • User provides image file path (e.g., C:\path\to\image.png)
  • Claude Code backend automatically reads the image file
  • Backend converts image to base64
  • Backend sends base64 array format to MCP server:
{
  "content": [
    {"type": "text", "text": "..."},
    {"type": "image", "source": {"type": "base64", "data": "..."}}
  ]
}

GLM API rejects with 422 error:

{
  "detail": [{
    "type": "string_type",
    "loc": ["body", "messages", 1, "content", "str"],
    "msg": "Input should be a valid string",
    "input": [{"type": "image", "source": {"type": "base64", "data": "..."}}]
  }]
}

Expected Behavior

MCP server should receive the file path as-is, allowing it to handle file reading and format conversion according to the target API's requirements.

Previous flow (worked until Oct 3):

User provides path → Claude Code passes path to MCP → MCP reads file → MCP calls GLM API → Success

Current flow (broken since Oct 4):

User provides path → Claude Code reads file → Converts to base64 → Sends to MCP → GLM API error → Failure

Error Messages/Logs

Steps to Reproduce

  1. Configure GLM MCP server in .mcp.json:
{
  "mcpServers": {
    "zai-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@z_ai/mcp-server"],
      "env": {
        "Z_AI_API_KEY": "your_glm_api_key",
        "Z_AI_MODE": "ZHIPU"
      }
    }
  }
}
  1. Start Claude Code:

claude

  1. Attempt image analysis:

Please analyze this image: C:\path\to\image.png

  1. Observe error:

API Error: 422 {"detail":[{"type":"string_type","loc":["body","messages",1,"content","str"],"msg":"Input should be a valid string"

Claude Model

Other

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.0.0

Claude Code Version

2.0.8

Platform

Other

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗