claude-code
claude-code copied to clipboard
Feature Request: DisplayStructuredOutput Tool (Inverse of AskUserQuestion)
Feature Request: DisplayStructuredOutput Tool (Inverse of AskUserQuestion)
Summary
Add a tool that allows Claude to send hierarchical, expandable structured data to the terminal — enabling users to drill down into details without additional LLM round-trips.
The Problem
Currently, when Claude needs to present information with varying levels of detail:
- Wall of text — Everything shown at once, eyes glaze over
- Summary only — User asks follow-up, burns tokens + latency
- No middle ground — Can't show summary with accessible drill-downs
Terminal constraints (no columns, no hover, limited width) make this worse. Users either get overwhelmed or have to keep asking "show me more about X."
Proposed Solution
A DisplayStructuredOutput tool — the inverse of AskUserQuestion:
| AskUserQuestion | DisplayStructuredOutput |
|---|---|
| Structured input collection | Structured output presentation |
| Options, multi-select, headers | Tables, columns, collapsibles |
| Terminal renders nicely | Terminal renders adaptively |
Example usage:
type: hierarchical
title: "Sprint Status"
sections:
- header: "Epics"
summary: "1 in-progress, 2 backlog"
expandable: true
content:
- "epic-1: in-progress (4 stories)"
- "epic-2: backlog (3 stories)"
- header: "Stories"
summary: "2 active, 4 pending"
expandable: true
content:
type: table
headers: [Story, Status, Epic]
rows:
- [1-2-login, in-progress, epic-1]
- [1-3-settings, review, epic-1]
- header: "Next Action"
emphasis: high
content: "Run `dev-story` for 1-2-login"
Rendered in terminal:
📊 Sprint Status
├─ Epics: 1 in-progress, 2 backlog [+]
├─ Stories: 2 active, 4 pending [+]
└─ Next Action: Run `dev-story` for 1-2-login
User clicks [+] → instant local expansion, no LLM call.
Key Benefits
- Zero tokens for exploration — Data pre-fetched, expansion is client-side
- Instant response — No round-trip latency for drill-downs
- User controls depth — Scan summary, expand what's interesting
- Better terminal UX — Avoids wall-of-text, uses horizontal space intelligently
- Graceful degradation — Falls back to plain text in dumb terminals
Primitives Needed
-
table— Headers + rows, auto-column-width based on terminal -
columns— Side-by-side layout when width permits, stacked when narrow -
collapsible— Summary visible, content on click/keypress -
cards— Titled blocks with emphasis levels -
list— Grouped items with optional nesting
Prior Art
- AskUserQuestion already proves structured terminal I/O works
- TodoWrite sends structured data (per #8723) — display side could be richer
- ctrl+o expansion for bash output (#10636) — same concept, limited scope
Use Cases
- Sprint/project status dashboards
- Code review summaries with expandable file details
- Search results with preview + full content
- Error reports with stack traces collapsed by default
- Any "summary + details on demand" pattern