Skip to content

Expand single tool calls in chat messages#2369

Open
gary149 wants to merge 1 commit into
mainfrom
claude/zealous-tesla-rhn9ri
Open

Expand single tool calls in chat messages#2369
gary149 wants to merge 1 commit into
mainfrom
claude/zealous-tesla-rhn9ri

Conversation

@gary149

@gary149 gary149 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Modified the chat message rendering logic to expand single tool calls alongside thinking blocks, rather than collapsing them into a summary. This improves visibility of tool execution results without requiring an extra click.

Key Changes

  • Updated the condition for collapsing message blocks: now only collapses when there are multiple blocks AND it's not a single tool call (unit.blocks.length > 1 && unit.toolCount !== 1)
  • Changed the else branch from rendering only the first block to iterating through all blocks with {#each}, allowing multiple blocks (e.g., thinking + tool call) to display expanded
  • Added proper key generation for each block to maintain Svelte's reactivity (tool-${block.uuid}-${blockIndex} for tools, think-${blockIndex} for thinking blocks)
  • Updated comments to clarify the new behavior: single tool calls stay expanded for visibility, while multi-tool or pure-thinking runs are collapsed into a summary

Implementation Details

The change preserves the existing ToolCallsSummary component for complex scenarios (multiple tools or thinking-only blocks) while expanding the simple case of a single tool call, optionally with thinking blocks. This provides better UX by showing tool results immediately without hiding them behind a collapsible summary.

https://claude.ai/code/session_01S8ttPBmjJF1iYMQjYxsVE8

A run of consecutive thinking/tool blocks containing exactly one tool
call previously collapsed into an uninformative "Called 1 tool" summary,
hiding which tool ran behind an extra click. Keep collapsing only for
multi-tool runs ("Called N tools") and pure-thinking runs ("Thought"),
and render single-tool runs expanded so the tool name is visible inline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S8ttPBmjJF1iYMQjYxsVE8
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