Skip to content

feat(assistant): refine tool display and streaming behavior - #1390

Merged
larbish merged 3 commits into
mainfrom
feat/assistant-tool-display
Jun 16, 2026
Merged

feat(assistant): refine tool display and streaming behavior#1390
larbish merged 3 commits into
mainfrom
feat/assistant-tool-display

Conversation

@benjamincanac

Copy link
Copy Markdown
Collaborator

Summary

Ports the relevant improvements from nuxt/nuxt.com#2265 to the Docus assistant, adapted to the generic/configurable setup (any MCP server, configurable model).

Tool display (layer/app/utils/assistantTools.ts)

  • New shared, generic tool labeler used by both AssistantPanel and AssistantDemo:
    • getToolText derives a stable label from the tool name's verb prefix (list/search → Searched, get/read → Read, etc.)
    • getToolSuffix pulls the dynamic detail from common input keys (search, query, path, slug, templateName, componentName, …) and renders it as a UChatTool suffix
    • getToolIcon maps tool names to icons by keyword (component, template, composable, blog, changelog, deploy, page/doc, …)
  • This means tools from any MCP server render nicely instead of falling back to raw names like Searched search-documentation.

Output rendering (AssistantPanel.vue)

  • getToolOutput now parses the standard MCP { content: [{ text }] } envelope generically (not just list-pages/get-page).
  • Removed the 500-char truncation; the output pre block is now scrollable (max-h-64 overflow-y-auto).
  • chevron="leading" on reasoning + restyled output block.

Styling

  • AssistantIndicator.vue: text-xstext-sm, dropped font-mono tracking-tight.
  • User message container gets pb-3.

Backend (search.ts)

  • Replaced the custom stopWhenResponseComplete with stepCountIs(MAX_STEPS).
  • Added prepareStep to force a final text answer on the last step (toolChoice: 'none'), fixing cases where the model exhausted all steps on tool calls and never replied.
  • Bumped maxOutputTokens to 8000, enabled gateway caching: 'auto', added smoothStream().

Test plan

  • Point the assistant at an MCP server and confirm tool labels, suffixes and icons render correctly.
  • Expand a tool call and confirm the full output scrolls instead of being truncated.
  • Ask a question that triggers many tool calls and confirm it still ends with a text answer.

Add a generic tool labeler (`getToolText`/`getToolSuffix`/`getToolIcon`)
so any MCP server's tools render with clean labels, suffixes and icons
instead of falling back to raw tool names. Split the stable verb from
the dynamic detail and render it as a suffix.

Make tool output fully scrollable instead of truncating it, and parse
the standard MCP `{ content: [{ text }] }` envelope generically.

On the backend, replace the custom stop condition with `stepCountIs`,
force a final text answer on the last step via `prepareStep`, bump
`maxOutputTokens` to 8000, enable gateway caching and `smoothStream`.
@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docus Ready Ready Preview Jun 16, 2026 5:08pm

@benjamincanac
benjamincanac requested review from HugoRCD and larbish June 8, 2026 10:55
@pkg-pr-new

pkg-pr-new Bot commented Jun 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/create-docus@1390
npm i https://pkg.pr.new/docus@1390

commit: 064d02a

@larbish
larbish merged commit a2ac34c into main Jun 16, 2026
4 checks passed
@larbish
larbish deleted the feat/assistant-tool-display branch June 16, 2026 17:10
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.

3 participants