Skip to content

feat: improve output for mcp query and result#12

Open
titouanmathis wants to merge 3 commits intonicobailon:mainfrom
titouanmathis:feat/render-call-result-display
Open

feat: improve output for mcp query and result#12
titouanmathis wants to merge 3 commits intonicobailon:mainfrom
titouanmathis:feat/render-call-result-display

Conversation

@titouanmathis
Copy link
Copy Markdown

MCP tool calls have no visual feedback for the query being run and output result is displaid in full.

This PR adds support both renderCall and renderResult to both direct tools and the mcp proxy tool to match behavior from other pi tools (read, write, etc.). The tool name and args are displayed inline on invocation, and results are collapsed to 10 lines with a native expand hint with ctrl+o.

Both direct tools and the mcp proxy tool now display their name and
arguments inline on invocation, matching the style of native pi tools
like read and edit (toolTitle bold + accent args).

- Import Text from @mariozechner/pi-tui
- Add renderCall to direct tool registrations
- Add renderCall to the mcp proxy tool
- Add formatArgsCompact() helper (key=value pairs, truncated to 80 chars)
MCP tool results are now shown collapsed to 10 lines by default, with
a native expand hint consistent with built-in pi tools (bash, read, etc).

- Import keyHint from @mariozechner/pi-coding-agent
- Add renderResult to direct tool registrations
- Add renderResult to the mcp proxy tool
- Add renderMcpResult() shared helper with isPartial/expanded handling
@titouanmathis
Copy link
Copy Markdown
Author

Duplicate of #8, might not be needed if #8 is merged.

@danchamorro
Copy link
Copy Markdown

danchamorro commented Mar 18, 2026

I've been running a similar implementation locally and it makes a huge difference -- MCP tools that return large responses (indexing tools, repo outlines, etc.) no longer flood the terminal.

Here's what it looks like in practice with a 157K+ char response collapsed to 3 lines:

auto-collapse-preview

Would love to see this merged and part of the core repo. The current behavior of dumping full MCP responses makes it hard to follow the conversation flow. I also think this version of the implementation is quite clean over the #8 version.

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.

2 participants