From df1946e5b03bee466261df52edbba3090acbc73a Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 18 Nov 2025 03:43:32 +0000 Subject: [PATCH] fix: improve JSON readability in MCP tool responses - Changed JSON indentation from 2 to 4 spaces for better readability - This improves the display of JSON requests/responses with nested structures - Addresses issue #9330 where JSON with escaped newlines was hard to read --- webview-ui/src/components/chat/McpExecution.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/components/chat/McpExecution.tsx b/webview-ui/src/components/chat/McpExecution.tsx index a96f368a17..116ffe761e 100644 --- a/webview-ui/src/components/chat/McpExecution.tsx +++ b/webview-ui/src/components/chat/McpExecution.tsx @@ -58,11 +58,17 @@ export const McpExecution = ({ try { const parsed = JSON.parse(text) + + // Format JSON with proper indentation - use 4 spaces for better readability + const formatted = JSON.stringify(parsed, null, 4) + return { isJson: true, - formatted: JSON.stringify(parsed, null, 2), + formatted: formatted, } } catch { + // If it's not valid JSON, return as-is + // The Markdown component will handle plain text with actual newlines return { isJson: false, formatted: text,