microsoft / microsoft/vscode

API: Allow extensions to specify initial selection state for MCP server tools

Open
#328,339 0 comments 0 reactions 1 assignee Claimed by @connor4312 View on GitHub
agent-host-mitigated
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

# MCP Tools Default Selection State

## Issue Description

Extensions that register MCP servers need fine-grained control over how the MCP tools appear in VS Code's Configure Tools UI. Currently, when a tool is discovered via `tools/list`, VS Code defaults it to **enabled** (checked) in the picker. There is no API for extensions to specify that a tool should initially appear **disabled** (unchecked).

## Use Case

Consider an extension that registers the NuGet MCP server with multiple tools, including `get-nuget-solver`. This tool should:

- Not be passed automatically to Copilot in chat sessions by default (unchecked in Configure Tools)
- Remain available for explicit programmatic invocation (for example, via `vscode.lm.invokeTool()`)
- Allow users to opt-in by checking it in Configure Tools

Currently, the only way to hide the tool from Copilot is to remove it from `tools/list` entirely, which breaks programmatic invocation. The inverse, allowing unchecked-by-default registration, is unsupported.

## Proposed solution

Extend the `McpServerDefinitionProvider` API to let extension authors control the default selection state of individual MCP server tools. There may be other approaches, but here are two that would satisfy this use case:

**Option A** -- Declare default tool state at registration time by extending `McpStdioServerDefinition` (or the provider interface) to accept per-tool defaults:

```typescript
vscode.lm?.registerMcpServerDefinitionProvider('my-extension.my-mcp', {
provideMcpServerDefinitions() {
return [new vscode.McpStdioServerDefinition('My Server', command, args, {
defaultToolSelection: { 'my-tool': false }
})]
},
})
```

**Option B** -- Provide a programmatic API to set tool selection state independently, after registration:

```typescript
// Called any time after the server is registered
await vscode.lm.setMcpToolEnabled('my-extension.my-mcp', 'my-tool', false)
```

In both cases, a tool set to disabled by default would remain registered in VS Code's tool registry so it is invocable via `vscode.lm.invokeTool()`, while appearing unchecked in the Configure Tools UI until the user opts in. Omitting the field should default to `true` to preserve backward compatibility with existing servers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.