Repository navigation
Description
Context
mecatui already surfaces tool calls and their arguments/results inline, which is valuable: the operator can see Read, Edit, Write, MCP calls, and their parameters without opening a raw trace.
But the current UX is too verbose and hard to scan, especially for MCP tools. Example: an mcp__github__issue_write card renders the full JSON arguments inline, including a huge issue body, so the tool card dominates the scrollback. Read results already collapse output, and Edit/Write have custom diff rendering; MCP calls and generic JSON args need a similarly polished compact presentation.
Goal
Make tool-call cards in mecatui easier to scan while preserving inspectability via ctrl+t expansion.
Current behavior
- Generic tool args render as pretty JSON in
cmd/mecatui/ui/render.go(renderToolfalls back toprettyJSON(b.toolArgs)). - Edit/Write already get custom rendering via
renderToolDiff. - Result bodies are line-capped by
maxToolResultLines. - MCP tool names are namespaced (
mcp__<server>__<tool>) and currently render as raw catalog names. - MCP SDK tools can expose a human title/metadata, but mecatl currently appears to rely mostly on catalog name + description.
Desired UX
Generic tool parameter presentation
Instead of dumping full JSON by default, render a compact parameter summary:
- Show key parameters as
key: valuechips/rows. - Keep short scalar values inline.
- Collapse long strings with byte/line counts and a short preview, e.g.
body: 4.2 KB / 72 lines · "## Context…". - Collapse arrays/objects with counts, e.g.
labels: [enhancement],inputs: 8 keys. - On
ctrl+t, expand to the full pretty JSON for inspection. - Continue sanitizing terminal escape sequences.
MCP-specific presentation
For mcp__<server>__<tool> calls:
- Parse the namespaced name into server/tool parts and render a friendlier header:
GitHub · Create or update issueinstead of onlymcp__github__issue_write, when a title is known.- Keep the raw tool name available in expanded mode or muted metadata.
- Prefer the MCP tool
titleif provided; otherwise derive a title from the tool name/description. - Show a compact summary of the call intent from args, not the full payload.
- For GitHub issue/PR tools: method, owner/repo, issue/PR number/title, labels, state, etc.
- For fetch/search/list tools: query, path, limit/page, filters.
- For arbitrary MCP tools: generic parameter summarizer above.
- Show result summaries compactly when possible:
- URLs / IDs / status lines prominently.
- Large JSON results collapsed to summary + expandable full content.
Scope / implementation notes
Possible paths:
-
UI-only first pass:
- Add a generic JSON argument summarizer in
cmd/mecatui/ui/render.go. - Add MCP name parsing/title derivation from
mcp__server__tool. - Add tests for compact vs expanded rendering.
- Add a generic JSON argument summarizer in
-
Metadata plumbing follow-up:
- Extend the tool/capabilities surface to carry display metadata such as title, server, remote tool name, and maybe provider/source.
- For MCP wrappers, preserve MCP SDK tool
Title(if available) in that metadata. - mecatui can then render true MCP titles instead of heuristics.
-
MCP result summarization:
- Add a bounded JSON result summarizer for tool result bodies, especially MCP JSON outputs.
- Keep raw result accessible through
ctrl+t.
Acceptance criteria
- A long MCP issue/create/update call no longer dumps the whole JSON body in collapsed view.
- Collapsed cards fit in a small number of lines and expose the important intent.
- Expanded view still shows complete sanitized JSON args/results.
- MCP names render with a human-friendly server/tool title where available or derivable.
- Existing Edit/Write diff rendering remains unchanged.
- Existing
Readresult line-capping remains unchanged. - Tests cover:
- long string arg collapsed with length/line count
- arrays/objects summarized
- expanded mode shows full JSON
- MCP name parsing/title fallback
- terminal escape sanitization
References
cmd/mecatui/ui/render.gorenderTool,prettyJSON,resultBody.cmd/mecatui/ui/diff_test.gofor existing custom tool rendering tests.- MCP tool wrapping in
internal/adapter/mcp/mcp.go. internal/tool.ToolSpeccurrently has name/description/schema only; title/display metadata may need a small extension or a client-facing metadata map.
Activity