xonecas.io
64875
Mc

mini-coder / commit bd0263e

fix: respect verbose mode for MCP tool blocks

xonecas2026-04-19 bd0263e252e73e3c77131957b10381c782934deb parent 1a739f2

4 files changed

README.md+15−15
@@ -62,21 +62,21 @@ Six built-in tools, plus a conditional read-only image tool and any configured M
6262
6363 ## Commands
6464
65-| Command | Description |
66-| ------------ | ------------------------------------------------------------------------------------------------------ |
67-| `/model` | Switch models and save the choice as the global default. |
68-| `/session` | Open the session picker for the current working directory. |
69-| `/new` | Start a fresh session and reset the running token and cost totals. |
70-| `/fork` | Fork the current chat into a new session, keep the original, and add a UI-only `Forked session.` note. |
71-| `/undo` | Remove the last conversational turn without touching filesystem changes. |
72-| `/reasoning` | Show or hide model thinking. The setting is saved and restored on launch. |
73-| `/verbose` | Expand shell output plus edit previews and edit errors in the conversation log. |
74-| `/mcp` | Open the MCP server picker and toggle configured servers on or off for future turns. |
75-| `/todo` | Show the current session todo list in the conversation log as a UI-only checklist block. |
76-| `/login` | Sign in with a supported OAuth provider. |
77-| `/logout` | Remove saved OAuth credentials for a logged-in provider. |
78-| `/effort` | Choose low, medium, high, or xhigh reasoning effort. |
79-| `/help` | Show commands, current toggles, loaded AGENTS.md files, skills, and MCP servers with on/off state. |
65+| Command | Description |
66+| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
67+| `/model` | Switch models and save the choice as the global default. |
68+| `/session` | Open the session picker for the current working directory. |
69+| `/new` | Start a fresh session and reset the running token and cost totals. |
70+| `/fork` | Fork the current chat into a new session, keep the original, and add a UI-only `Forked session.` note. |
71+| `/undo` | Remove the last conversational turn without touching filesystem changes. |
72+| `/reasoning` | Show or hide model thinking. The setting is saved and restored on launch. |
73+| `/verbose` | Toggle compact vs full rendering for verbose-aware tool previews/results, including shell, read, grep, edit previews/errors, and MCP tool blocks. |
74+| `/mcp` | Open the MCP server picker and toggle configured servers on or off for future turns. |
75+| `/todo` | Show the current session todo list in the conversation log as a UI-only checklist block. |
76+| `/login` | Sign in with a supported OAuth provider. |
77+| `/logout` | Remove saved OAuth credentials for a logged-in provider. |
78+| `/effort` | Choose low, medium, high, or xhigh reasoning effort. |
79+| `/help` | Show commands, current toggles, loaded AGENTS.md files, skills, and MCP servers with on/off state. |
8080
8181 ## Key bindings
8282
spec.md+2−1
@@ -549,6 +549,7 @@ Tool blocks share a common frame: a left border (`│`) plus a compact header pi
549549 - **Tool calls — edit**: rendered in the shared tool frame. The in-progress tool-call preview shows the target path followed by the streamed `oldText` and `newText` bodies. Old text is styled as removed and new text as added, but the preview does not render literal `-`/`+` diff prefixes. The preview body uses [verbose tool rendering](#verbose-tool-rendering). Successful results render a compact confirmation block (`edit <-` plus the file path); errors render the returned error text.
550550 - **Tool calls — todoWrite / todoRead**: rendered in the shared tool frame. Successful results render the full current todo list as a structured themed checklist with status markers (`[ ]`, `[~]`, `[x]`). This checklist is always shown in full and never truncated, regardless of `/verbose`. Errors render the returned error text.
551551 - **Tool calls — readImage**: rendered in the shared tool frame. The assistant tool call streams the path as it arrives. Successful results render a compact result block (`read image <-` plus the file path) rather than rendering the image itself.
552+- **Tool calls — configured MCP tools**: rendered in the shared tool frame using the imported prefixed tool name (for example `docs__search`). Tool-call previews render the streamed JSON arguments, and text-heavy result bodies use [verbose tool rendering](#verbose-tool-rendering) so `/verbose` toggles between compact tail previews and full output. Image output is rendered directly from the tool-result content when present.
552553 - **UI messages**: internal app messages such as `/help` output, OAuth progress, `/fork` notices, and other session-local notices. They are rendered in the conversation log, persisted with the session, excluded from model context, and do not participate in conversational turn numbering. `/help` output renders as syntax-highlighted raw markdown so headings, lists, and inline code stay scannable while preserving the literal markdown markers. `/todo` output is also UI-only, but it renders using the …
553554 - **Errors**: one-line summary, styled distinctly.
554555
@@ -556,7 +557,7 @@ Tool blocks share a common frame: a left border (`│`) plus a compact header pi
556557
557558 `/verbose` controls a single persisted UI preference for how tool-call previews and selected tool-result bodies are displayed in the conversation log.
558559
559-- Scope: shell tool-call bodies and tool-result bodies; read tool-call bodies and tool-result bodies; grep tool-call bodies and tool-result bodies; edit tool-call preview bodies and edit error results. Successful edit results stay compact in both modes. Todo tool results ignore `/verbose` and always show the full current list.
560+- Scope: shell tool-call bodies and tool-result bodies; read tool-call bodies and tool-result bodies; grep tool-call bodies and tool-result bodies; edit tool-call preview bodies and edit error results; configured MCP tool-call bodies and text result bodies. Successful edit results stay compact in both modes. Todo tool results ignore `/verbose` and always show the full current list.
560561 - Default: off when no saved setting exists.
561562 - Off: show as many trailing logical lines as fit within a fixed rendered-height preview, followed by `And X lines more` when earlier lines are hidden. The preview height stays stable for a given block, so wrapped long lines do not make the log jump while content streams.
562563 - On: show the full stored tool result or preview body.
src/ui/conversation.test.ts+99−0
@@ -164,6 +164,72 @@ describe("ui/conversation", () => {
164164 expect(lines.join("\n")).not.toContain('"command"');
165165 });
166166
167+ test("MCP tool-call previews honor verbose mode", () => {
168+ const args = {
169+ query: "routing",
170+ section: "guides",
171+ limit: 10,
172+ offset: 0,
173+ filter1: "alpha",
174+ filter2: "beta",
175+ filter3: "gamma",
176+ filter4: "delta",
177+ filter5: "epsilon",
178+ filter6: "zeta",
179+ filter7: "eta",
180+ filter8: "theta",
181+ };
182+
183+ const compactLines = collectRenderedLines(
184+ renderAssistantMessage(
185+ {
186+ content: [
187+ {
188+ type: "toolCall",
189+ id: "call-mcp",
190+ name: "docs__search",
191+ arguments: args,
192+ },
193+ ],
194+ },
195+ {
196+ showReasoning: true,
197+ verbose: false,
198+ theme: DEFAULT_THEME,
199+ cwd: "/tmp/project",
200+ previewWidth: 80,
201+ },
202+ ),
203+ );
204+ const verboseLines = collectRenderedLines(
205+ renderAssistantMessage(
206+ {
207+ content: [
208+ {
209+ type: "toolCall",
210+ id: "call-mcp",
211+ name: "docs__search",
212+ arguments: args,
213+ },
214+ ],
215+ },
216+ {
217+ showReasoning: true,
218+ verbose: true,
219+ theme: DEFAULT_THEME,
220+ cwd: "/tmp/project",
221+ previewWidth: 80,
222+ },
223+ ),
224+ );
225+
226+ expect(compactLines).toContain("│ docs__search ->");
227+ expect(compactLines.some((line) => line.includes("And "))).toBe(true);
228+ expect(compactLines.join("\n")).not.toContain('"query": "routing"');
229+ expect(verboseLines.join("\n")).toContain('"query": "routing"');
230+ expect(compactLines.length).toBeLessThan(verboseLines.length);
231+ });
232+
167233 test("shell tool results render structured stdout/stderr details without stderr labels or error styling", () => {
168234 const stdout = Array.from(
169235 { length: 12 },
@@ -426,4 +492,37 @@ describe("ui/conversation", () => {
426492 expect(lines.join("\n")).not.toContain('"files"');
427493 expect(lines.join("\n")).not.toContain('"kind"');
428494 });
495+
496+ test("MCP tool results honor verbose mode", () => {
497+ const output = Array.from(
498+ { length: 14 },
499+ (_, index) => `result ${index + 1}`,
500+ ).join("\n");
501+
502+ const compactLines = collectRenderedLines(
503+ renderToolResult("docs__search", { query: "routing" }, output, false, {
504+ showReasoning: true,
505+ verbose: false,
506+ theme: DEFAULT_THEME,
507+ cwd: "/tmp/project",
508+ previewWidth: 80,
509+ }),
510+ );
511+ const verboseLines = collectRenderedLines(
512+ renderToolResult("docs__search", { query: "routing" }, output, false, {
513+ showReasoning: true,
514+ verbose: true,
515+ theme: DEFAULT_THEME,
516+ cwd: "/tmp/project",
517+ previewWidth: 80,
518+ }),
519+ );
520+
521+ expect(compactLines).toContain("│ docs__search <-");
522+ expect(compactLines).toContain("│ result 14");
523+ expect(compactLines).toContain("│ And 6 lines more");
524+ expect(compactLines).not.toContain("│ result 1");
525+ expect(verboseLines).toContain("│ result 1");
526+ expect(compactLines.length).toBeLessThan(verboseLines.length);
527+ });
429528 });
src/ui/conversation.ts+6−2
@@ -1063,6 +1063,10 @@ function buildReadImageToolCallSpec(
10631063 };
10641064 }
10651065
1066+function isMcpToolName(toolName: string): boolean {
1067+ return toolName.includes("__");
1068+}
1069+
10661070 function buildGenericToolCallSpec(
10671071 toolName: string,
10681072 args: Record<string, unknown>,
@@ -1072,7 +1076,7 @@ function buildGenericToolCallSpec(
10721076 toolName,
10731077 direction: "->",
10741078 bodyLines: text && text !== "{}" ? splitToolTextLines(text, "text") : [],
1075- previewBody: false,
1079+ previewBody: isMcpToolName(toolName),
10761080 };
10771081 }
10781082
@@ -1310,7 +1314,7 @@ function buildGenericToolResultSpec(
13101314 toolName,
13111315 direction: "<-",
13121316 bodyLines: splitToolTextLines(output, isError ? "error" : "text"),
1313- previewBody: false,
1317+ previewBody: isMcpToolName(toolName),
13141318 };
13151319 }