[FEATURE] Render code-bearing MCP tool parameters with syntax highlighting and without truncation.
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
MCP tools that accept code as input (e.g., execute_code, execute_script, etc) currently display their parameters with escaped newlines (\n), no syntax highlighting, and truncation. This makes it difficult to review code before approving a tool call — which is the entire point of the approval prompt.
As Anthropic's own https://www.anthropic.com/engineering/code-execution-with-mcp blog post advocates, code-execution MCP tools are becoming a key pattern for efficient agents. But the approval UX doesn't support reviewing the code they generate.
Related issues
- #31639
- #14684
- #26270
- #34234
Proposed Solution
- Add a new MCP tool annotation, e.g.,
receivesCodeAsInputHintwith optional language hint, that tool authors can set to indicate their tool accepts code as its primary input. - When this annotation is present, Claude Code should: (a) render the code parameter with actual newlines (not escaped \n); (b) apply syntax highlighting (Claude Code already has a syntax highlighting engine for diffs and code blocks); and (c) show the full code without truncation.
This proposal is opt-in, i.e., tools without the annotation keep current behavior. The MCP spec's tool annotations are extensible (i.e., additionalProperties is allowed), so our proposal requires no spec change. Claude Code just needs to recognize and act on the hint.
Alternative Solutions
Currently you can ask Claude Code to output a nicely formatted, nicely highlighted, non-truncated string showing the code it wants to submit before it does each tool call. This workflow approximates my desired user experience, in the sense that it provides output that is much easier to audit and review than what is shown during an actual tool call. But doing it this way is a security risk because there is no formal guarantee that the code being displayed is ultimately being submitted as-is to the tool. And of course this workaround is wasteful because it burns 2x more context than necessary for each tool call. It would be better if there were more flexible rendering options when displaying parameters to tool calls.
Priority
Critical - Blocking my work
Feature Category
MCP server integration
Use Case Example
Anthropic's own blog argues in favor of MCP tool calls being able to execute code. This feature would just make it easier to review the code that Claude Code wants to run.
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗