-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(mcp): pretty-print tool responses in UI #11115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Re-review complete. No new issues flagged.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| if (parsed === undefined && (trimmed.includes('\\"') || trimmed.includes("\\\\"))) { | ||
| const unescaped = trimmed.replaceAll("\\\\", "\\").replaceAll('\\"', '"') | ||
| parsed = tryParseJsonValue(unescaped) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unescape fallback (replaceAll(\\\\, \\).replaceAll('\\"', '"')) is fairly aggressive and can change the meaning of responses that contain backslashes but are not actually escaped JSON blobs; consider gating this branch on a stricter pattern (eg starting with {\" or [{\") so we do not pretty-print mutated content.
Fix it with Roo Code or mention @roomote and request a fix.
Summary
Prevents UI hangups caused by large outputs being rendered as 1 line.
Improve MCP tool output readability in the chat UI by pretty-printing JSON responses when expanded while preserving raw output for copy.
Changes
Important
Enhance JSON response readability in
McpExecution.tsxby pretty-printing and preserving raw data for copying, with tests added for verification.McpExecution.tsxwhen expanded, including handling of escaped and double-encoded JSON.looksLikeJson,looksLikeEscapedJsonBlob,tryParseJsonValue, andtryUnescapeJsonBlobinMcpExecution.tsxto handle JSON parsing and formatting.McpExecution.spec.tsxto verify pretty-printing of minified, escaped, and double-encoded JSON, and handling of non-JSON responses.This description was created by
for ae18182. You can customize this summary. It will automatically update as commits are pushed.