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
This commit is contained in:
Roo Code 2025-11-18 03:43:32 +00:00
parent e742511d90
commit df1946e5b0

View file

@ -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,