Rhino 9 MCP: `get_viewport_image` returns JSON instead of an image

I have been playing with Claude Code and it ran into an issue with capturing viewport images. Its bug report is below! :slightly_smiling_face:

Summary

The get_viewport_image tool served by rhino-mcp-router.exe returns its whole result (metadata and the JPEG) serialised as one JSON string inside a text content block. The MCP client therefore receives base64 text, not an image content block, so:

  1. The client never shows the image to the model, at any size.
  2. At normal sizes the base64 text exceeds the client’s tool-output token limit and the call fails. With Claude Code the default 480×270 capture fails with “result exceeds maximum allowed tokens”.

Environment

  • Rhino 9 WIP 9.0.26300.9401 (Windows 11 Pro 10.0.26100)
  • rhino-mcp-router.exe 9.0.26300.09401, from %APPDATA%\McNeel\Rhinoceros\ai\bin\
  • MCP client: Claude Code 2.1.318 (stdio transport)
  • MCP config:
    "rhino": {
      "command": "C:\\Users\\<user>\\AppData\\Roaming\\McNeel\\Rhinoceros\\ai\\bin\\rhino-mcp-router.exe",
      "env": { "RHINO_MCP_DEFAULT_VERSION": "9" }
    }
    

Steps to reproduce

  1. Open Rhino 9 WIP with any model and connect an MCP client to the router.
  2. Call get_viewport_image with no arguments (480×270 default).
    • Result: the call fails in the client because the result is about 50,000 characters of text, over the token limit.
  3. Call get_viewport_image with width: 160, height: 100.
    • Result: the call succeeds, but the client receives only text. No image is shown.

Actual result

The tool result reaches the client as a single text payload like this (abridged):

{"content":[
  {"type":"text","text":"{\"metadata\":{\"viewport\":{\"name\":\"Perspective\",...}}}"},
  {"type":"image","data":"/9j/4AAQSkZJRgABAQEAYABgAAD...","mimeType":"image/jpeg"}
]}

That is, a complete CallToolResult (content array with a text item and an image item) serialised to a string and then returned as the text of the tool result. The "type":"image" item is inside that string, not a real content block.

Approximate sizes of the text payload:

width × height payload size outcome in Claude Code
480 × 270 (default) ~50,700 characters rejected: exceeds token limit
800 × 500 ~125,000 characters rejected: exceeds token limit
360 × 220 fits returned as text, no image
160 × 100 fits returned as text, no image

Expected result

The tool result’s content array should contain a real MCP image content block, with the metadata as a separate text block:

{
  "content": [
    { "type": "text", "text": "{\"metadata\": {...}}" },
    { "type": "image", "data": "<base64>", "mimeType": "image/jpeg" }
  ]
}

Clients then display the image natively, and image blocks aren’t counted as text tokens.

Likely cause

It looks like the router, when relaying the result from the Rhino-side listener, serialises the inner CallToolResult and wraps it as text, rather than passing its content items through. Text-only tools such as run_python and get_context work fine in practice, so this may only be visible on tools that return images.

Workaround

From run_python, save the view to disk with view.CaptureToBitmap(System.Drawing.Size(w, h)).Save(path) and have the client read the file.

i was able to repeat this here in 9.2 with the bundled router, the listener itself returns a proper image block but the router hands it back as one text block with the whole result serialised inside. Thanks for reporting, https://mcneel.myjetbrains.com/youtrack/issue/RH-100023