Skip to content

Support for extensions to control tool invocation collapse behavior in Chat #292142

@OrenMe

Description

@OrenMe

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:

  1. Declarative Control: Add a displayStyle property to the languageModelTools contribution point in package.json.
    "languageModelTools": [
      {
        "name": "myTool",
        "displayStyle": "expanded"
      }
    ]
  2. Runtime Control: Extend the presentation property in the ToolInvocationPresentation API (via prepareToolInvocation) to include an expanded option.

Technical Details

  • The logic in src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts (specifically shouldPinPart) should be updated to respect these new metadata/runtime preferences.
  • A runtime presentation: 'expanded' should take precedence over the static displayStyle declared in package.json.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions