-
Notifications
You must be signed in to change notification settings - Fork 39k
Support for extensions to control tool invocation collapse behavior in Chat #292142
Copy link
Copy link
Open
Description
Description
Currently, extensions contributing Chat Tools do not have direct control over whether their tool invocations are pinned (expanded) or collapsed into the "thinking" section of the Chat response. VS Code currently uses hardcoded logic in shouldPinPart() to decide this based on the tool ID or source type (e.g., MCP tools, Mermaid, copilot_askQuestions).
This is particularly problematic for extensions that contribute rich content, such as webviews, using the chat renderer interface. If a webview is rendered inside a collapsed section, it may not initialize or render correctly, which appears to be a bug in how collapsed tool outputs are handled.
Proposed Solution
We propose a hybrid approach to give extensions control:
- Declarative Control: Add a
displayStyleproperty to thelanguageModelToolscontribution point inpackage.json."languageModelTools": [ { "name": "myTool", "displayStyle": "expanded" } ]
- Runtime Control: Extend the
presentationproperty in theToolInvocationPresentationAPI (viaprepareToolInvocation) to include anexpandedoption.
Technical Details
- The logic in
src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts(specificallyshouldPinPart) should be updated to respect these new metadata/runtime preferences. - A runtime
presentation: 'expanded'should take precedence over the staticdisplayStyledeclared inpackage.json.
Reactions are currently unavailable