[BUG] MCP tool output displays escaped \n instead of rendering newlines in CLI

Resolved 💬 4 comments Opened Jan 27, 2026 by OlivierPelerin Closed Feb 28, 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?

When an MCP tool returns multiline text output, Claude Code CLI displays the result as raw JSON with escaped \n characters instead of rendering actual line breaks. The same MCP server output renders correctly in Claude Desktop.
Expected Behavior
Tool output like:
Service: service
Total devices: 20

  - vmanage (Type: VMANAGE)
  - hub-east (Type: CEDGE)

Should display with actual line breaks, as it does in Claude Desktop.

Screenshots

<img width="889" height="343" alt="Image" src="https://github.com/user-attachments/assets/ce249c15-d216-48a9-9d43-8938698709b0" />

<img width="1405" height="703" alt="Image" src="https://github.com/user-attachments/assets/638bfa30-cfaf-47f4-a761-6b99e78d76b6" />

Workaround
None currently. Claude's summarization of the tool output renders correctly, but the tool result display panel does not.
Related Issues

#9962 - structuredContent vs TextContent handling changes
#15718 - MCP tool display/context separation feature request
#11888 - Line breaks not rendering correctly in CLI output

What Should Happen?

Actual Behavior
Tool output displays as escaped JSON:

{
  "result": "Service: service\nTotal devices: 20\n\n  - vmanage (Type: VMANAGE)\n  - hub-east (Type: CEDGE)\n..."
}

The \n characters are shown literally instead of being rendered as newlines.

Error Messages/Logs

Steps to Reproduce

Configure an MCP server that returns multiline text (e.g., with print() statements or \n in the result)
Call the MCP tool from Claude Code CLI
Observe that the tool result panel shows escaped \n instead of rendered line breaks

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.20

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

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