Skip to content

feat(tui): Ctrl+o to expand/collapse tool call JSON#55

Merged
lostmygithubaccount merged 1 commit intomainfrom
cody/tui-tool-expand
Mar 25, 2026
Merged

feat(tui): Ctrl+o to expand/collapse tool call JSON#55
lostmygithubaccount merged 1 commit intomainfrom
cody/tui-tool-expand

Conversation

@lostmygithubaccount
Copy link
Copy Markdown
Contributor

Problem

Tool calls in the Otto TUI show only a truncated 80-char summary. Tool call arguments are discarded entirely. Users have no way to inspect full tool call details.

Summary

Adds a global Ctrl+o toggle that expands/collapses tool call arguments and output inline, with pretty-printed JSON.

Collapsed (default)

  ⚙ create_artifact
  → {"artifact_id": "tooluse_ZeyXcpTdx4bR6c7TvQdIRd", "artifact_type": "react…  Ctrl+o to expand

Expanded (Ctrl+o)

  you
  build a simple demo application showing a counter

  otto
  I'll create a simple counter application for you.

  ⚙ create_artifact
  ╭─ output ─
  │ {
  │   "artifact_id": "tooluse_ZeyXcpTdx4bR6c7TvQdIRd",
  │   "artifact_type": "react",
  │   "artifact_url": "/otto/artifact/tooluse_ZeyXcpTdx4bR6c7TvQdIRd",
  │   "name": "Counter Demo",
  │   "runtime_uuid": "01991585-cdcd-7490-a5ae-c3107b3685d6",
  │   "status": "created"
  │ }
  ╰──
  Ctrl+o to collapse

  otto
  Created a simple counter application with three buttons:
  - Decrease: Subtracts 1 from the counter
  - Reset: Sets the counter back to 0
  - Increase: Adds 1 to the counter

Changes

  • Add ToolCallData struct storing tool name, arguments JSON, and full output on Message
  • Plumb arguments through StreamMsgKind::ToolCallStart (previously discarded)
  • Change active_tool_call from Option<String> to Option<(String, String)> to hold name + args
  • Add expand_tool_calls bool toggle on App, bound to Ctrl+o globally
  • Add render_tool_call() with collapsed/expanded rendering using existing code-block style
  • Update /help and docs with new keybinding

🤖 Generated with Claude Code

Tool calls show truncated output by default with a "Ctrl+o to expand"
hint. Pressing Ctrl+o toggles all tool call blocks between collapsed
(one-line summary) and expanded (pretty-printed arguments + output in
code-block style). Arguments are now plumbed through from the stream
instead of being discarded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lostmygithubaccount lostmygithubaccount merged commit 30c6e54 into main Mar 25, 2026
1 check passed
@lostmygithubaccount lostmygithubaccount deleted the cody/tui-tool-expand branch March 25, 2026 22:36
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.

1 participant