Skip to content

feat: improve MCP tool input/output rendering#33

Merged
matt1398 merged 1 commit intomatt1398:mainfrom
cesarafonseca:fix/mcp-tool-output-pretty-json
Feb 20, 2026
Merged

feat: improve MCP tool input/output rendering#33
matt1398 merged 1 commit intomatt1398:mainfrom
cesarafonseca:fix/mcp-tool-output-pretty-json

Conversation

@cesarafonseca
Copy link
Contributor

@cesarafonseca cesarafonseca commented Feb 19, 2026

Summary

  • Tool output (MCP): Extract text from API content blocks ([{"type":"text","text":"..."}]) instead of stringifying the raw wrapper array
  • Tool input (MCP): Render inputs as key-value pairs instead of raw JSON.stringify — string values display directly (preserving real newlines)
  • Pretty-print extracted text when it's valid JSON
  • Preserves existing behavior for plain string outputs and specialized tool viewers (Edit, Bash, Read, etc.)

Closes #32

Testing

  • npm run typecheck passes
  • npm test passes
  • npm run lint passes
  • Added tests in test/renderer/utils/renderHelpers.test.ts covering:
    • extractOutputText: plain strings, JSON pretty-printing, content block arrays,
      serialized content block arrays, multiple blocks joined with newlines
    • formatInputValue: strings returned directly (preserving newlines), numbers/booleans
      converted with String(), objects/arrays pretty-printed with JSON.stringify

@cesarafonseca cesarafonseca force-pushed the fix/mcp-tool-output-pretty-json branch 2 times, most recently from 2c03acd to 93f501d Compare February 19, 2026 20:40
@cesarafonseca cesarafonseca marked this pull request as draft February 19, 2026 21:35
@cesarafonseca cesarafonseca force-pushed the fix/mcp-tool-output-pretty-json branch 2 times, most recently from 89d404d to d61557c Compare February 19, 2026 21:49
@cesarafonseca cesarafonseca changed the title fix: pretty-print MCP tool output JSON feature: pretty-print MCP tool output JSON Feb 19, 2026
@cesarafonseca cesarafonseca changed the title feature: pretty-print MCP tool output JSON feat: pretty-print MCP tool output JSON Feb 19, 2026
@cesarafonseca cesarafonseca changed the title feat: pretty-print MCP tool output JSON feat: improve MCP tool input/output rendering Feb 19, 2026
@cesarafonseca cesarafonseca force-pushed the fix/mcp-tool-output-pretty-json branch from d61557c to a00c7a4 Compare February 19, 2026 22:12
@cesarafonseca cesarafonseca marked this pull request as ready for review February 19, 2026 22:12
@matt1398
Copy link
Owner

This is great! Making MCP outputs more readable is a huge plus. Appreciate the thorough tests as well. Merging now, thanks for the contribution! Will be implemented in next release
Closes #33

@matt1398 matt1398 merged commit 51e053a into matt1398:main Feb 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: MCP tool invocation JSON viewer

2 participants