Skip to content

Fix registerToolDefinition tools from default chat agent being filtered out#300529

Merged
bhavyaus merged 1 commit intomainfrom
dev/bhavyau/fix-registerToolDefinition-source-type
Mar 10, 2026
Merged

Fix registerToolDefinition tools from default chat agent being filtered out#300529
bhavyaus merged 1 commit intomainfrom
dev/bhavyau/fix-registerToolDefinition-source-type

Conversation

@bhavyaus
Copy link
Collaborator

Tools registered via registerToolDefinition by the default chat agent (copilot-chat) were incorrectly getting source type extension instead of ToolDataSource.Internal. This caused them to be filtered out by the chat.extensionTools.enabled setting check in getAllToolsIncludingDisabled().

Package.json-contributed tools from the same extension correctly got ToolDataSource.Internal via the isBuiltinTool check in languageModelToolsContribution.ts. This applies the same logic in $registerToolWithDefinition on the main thread.

Copilot AI review requested due to automatic review settings March 10, 2026 19:30
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 10, 2026
…ed out

Tools registered via registerToolDefinition by the default chat agent
(copilot-chat) were incorrectly getting source type 'extension' instead
of ToolDataSource.Internal. This caused them to be filtered out by the
chat.extensionTools.enabled setting check in getAllToolsIncludingDisabled().

Package.json-contributed tools from the same extension correctly got
ToolDataSource.Internal via the isBuiltinTool check in
languageModelToolsContribution.ts. Apply the same logic in
$registerToolWithDefinition on the main thread.
@bhavyaus bhavyaus force-pushed the dev/bhavyau/fix-registerToolDefinition-source-type branch from 5281cf5 to 7c5b0f7 Compare March 10, 2026 19:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes tool source classification for tools registered via registerToolDefinition by the default chat agent so they are treated as built-in/internal tools (and therefore not filtered by the chat.extensionTools.enabled gate).

Changes:

  • Inject IProductService into MainThreadLanguageModelTools.
  • Detect when the registering extension matches productService.defaultChatAgent.chatExtensionId and force ToolDataSource.Internal instead of using the DTO-provided source.

@bhavyaus bhavyaus enabled auto-merge (squash) March 10, 2026 19:36
@bhavyaus bhavyaus merged commit 9a1fe57 into main Mar 10, 2026
29 of 30 checks passed
@bhavyaus bhavyaus deleted the dev/bhavyau/fix-registerToolDefinition-source-type branch March 10, 2026 20:21
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