A chart can name a workspace-relative CSV, x column, optional repository,
and one to four numeric series columns without inlining row values.
Handler rejects unsafe, binary, oversized, malformed, empty, or invalid CSV
input with actionable errors and no completed rich presentation.
Successful calls persist bounded normalized chart values in their MCP result.
Reload renders that snapshot without reading the workspace again.
Tool description, schema descriptions, task/Office prompts, and public docs
make explicit chart, graph, plot, preview, bar comparison, and time-series
use cases discoverable while retaining Markdown-table restraint.
Desktop and phone E2E cover CSV-backed line and bar charts plus replay after
source mutation or deletion.
TDD order
Backend schema, resolver, snapshot, and prompt tests fail for behavior gaps.
Implement bounded CSV resolution in internal/mcp/server.
Frontend input/snapshot parser tests fail for replay gaps.
Implement strict result overlay and structured-content extraction.
Update real MCP E2E and public docs, then run focused and subtree checks.
Verification
(set -e
cd apps/backend
go test ./internal/mcp/server/...
cd ../web
pnpm test -- components/task/chat/messages/kandev/rich-output components/task/chat/messages/kandev/parse.test.ts
pnpm run typecheck
pnpm run lint
pnpm run i18n:check
pnpm run i18n:ratchet
pnpm e2e:run --project chromium tests/chat/rich-output.spec.ts -- --retries=0
pnpm e2e:run --project mobile-chrome tests/chat/mobile-rich-output.spec.ts -- --retries=0)
Existing workspace reads are capped at 10 MiB, so reject response size before
parsing and retain a tighter rich-output CSV cap of 256 KiB.
Require exact one-to-one snapshot entries by chart block index. Reject stale,
duplicate, missing, or inline-targeting entries at the frontend boundary.
Return structured content and equivalent JSON text because ACP clients differ
in how they retain MCP structured results.
Results
Added the mutually exclusive csv chart source, bounded workspace read,
strict CSV parser, and versioned normalized result snapshot. Inline charts
remain unchanged.
Added fail-closed frontend snapshot overlay and ACP/standard MCP structured
result extraction. Replay uses only persisted normalized values.
Added explicit tool/schema examples, task and Office authoring guidance, and
public line/time-series and bar/comparison examples.
go test ./internal/mcp/server/... -count=1: passed.
golangci-lint run ./internal/mcp/server/... --timeout=5m: zero issues.
Focused rich-output Vitest: 3 files and 73 tests passed.
pnpm run typecheck, full pnpm run lint, pnpm run i18n:check, and
pnpm run i18n:ratchet: passed. The i18n check retained only known advisory
real-locale parity notices.
Desktop Chromium and mobile Chrome rich-output E2E: one test each passed.
Desktop deleted the CSV before reload; both charts remained. Mobile showed
both charts without page overflow and retained native file-viewer behavior.
Public docs: 61 validator tests and all 41 published pages passed.