|
| 1 | +# MCP Tools vs LM Tools |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +VS Code DevTools exposes two distinct toolsets, each serving a different role and running in a different VS Code context. |
| 6 | + |
| 7 | +## LM Tools (Language Model Tools) |
| 8 | + |
| 9 | +**Context:** Host workspace (production VS Code instance) |
| 10 | +**Purpose:** Stable, production-ready tools registered via `vscode.lm.registerTool()` |
| 11 | +**Target audience:** Copilot and other language model agents working in the main VS Code session |
| 12 | + |
| 13 | +### Available LM Tools |
| 14 | + |
| 15 | +| Tool | Description | |
| 16 | +|------|-------------| |
| 17 | +| `output_read` | Read VS Code output channel logs from Host and Client sessions | |
| 18 | +| `terminal_read` | Read terminal output, state, and detect prompts | |
| 19 | +| `terminal_execute` | Execute commands in the terminal or send input to waiting terminals | |
| 20 | +| `wait` | Wait for a specified duration (0–30000ms) before continuing | |
| 21 | + |
| 22 | +### Characteristics |
| 23 | + |
| 24 | +- Run **inside the Host VS Code process** with full VS Code API access |
| 25 | +- Registered unconditionally at extension activation |
| 26 | +- Can be individually enabled/disabled via VS Code's native **Configure Tools...** button in Copilot Chat |
| 27 | +- Declared in `package.json` → `contributes.languageModelTools` |
| 28 | +- Implemented in `extension/services/` |
| 29 | + |
| 30 | +## MCP Tools (Model Context Protocol) |
| 31 | + |
| 32 | +**Context:** Client workspace (Extension Development Host) |
| 33 | +**Purpose:** Experimental and browser-automation tools served via the MCP server |
| 34 | +**Target audience:** MCP clients (Inspector, Claude Desktop, etc.) connected to the stdio MCP server |
| 35 | + |
| 36 | +### Standard MCP Tools |
| 37 | + |
| 38 | +These tools interact with the Client's browser/webview and are considered stable: |
| 39 | + |
| 40 | +| Tool | Description | |
| 41 | +|------|-------------| |
| 42 | +| `keyboard_hotkey` | Press key combinations | |
| 43 | +| `keyboard_type` | Type text into inputs | |
| 44 | +| `mouse_click` | Click elements | |
| 45 | +| `mouse_drag` | Drag elements | |
| 46 | +| `mouse_hover` | Hover over elements | |
| 47 | +| `mouse_scroll` | Scroll elements | |
| 48 | +| `take_snapshot` | Take an accessibility tree snapshot | |
| 49 | +| `take_screenshot` | Take a screenshot | |
| 50 | +| `read_console` | Read browser console messages | |
| 51 | + |
| 52 | +### Experimental MCP Tools (exp_ prefix) |
| 53 | + |
| 54 | +These tools are under active development and may change significantly: |
| 55 | + |
| 56 | +| Tool | Description | |
| 57 | +|------|-------------| |
| 58 | +| `exp_codebase_map` | Get a structural map of the codebase | |
| 59 | +| `exp_codebase_trace` | Trace a symbol through the codebase | |
| 60 | +| `exp_codebase_lint` | Find dead code and quality issues | |
| 61 | +| `exp_file_read` | Read files with flexible targeting | |
| 62 | +| `exp_file_edit` | Edit files in the workspace | |
| 63 | +| `exp_elicitation_demo` | Demonstrate MCP elicitation (SDK preview) | |
| 64 | + |
| 65 | +### Characteristics |
| 66 | + |
| 67 | +- Run in the **MCP server process** (Node.js, outside VS Code) |
| 68 | +- Communicate with the Client VS Code via named pipes |
| 69 | +- Served over MCP stdio transport (JSON-RPC) |
| 70 | +- All tools available when the MCP server is connected |
| 71 | +- Experimental tools prefixed with `exp_` to signal instability |
| 72 | + |
| 73 | +## Key Differences |
| 74 | + |
| 75 | +| Aspect | LM Tools | MCP Tools | |
| 76 | +|--------|----------|-----------| |
| 77 | +| Runtime | VS Code extension (Host) | MCP server process | |
| 78 | +| Protocol | VS Code Language Model API | MCP (JSON-RPC over stdio) | |
| 79 | +| Context | Host workspace | Client workspace | |
| 80 | +| Toggle | Native VS Code tool config | Always available when connected | |
| 81 | +| Stability | Production-ready | Standard + experimental | |
| 82 | +| Naming | Plain names | Standard or `exp_` prefixed | |
| 83 | + |
| 84 | +## Configuration |
| 85 | + |
| 86 | +### Workspace Selection |
| 87 | + |
| 88 | +The active workspace for MCP tools is configured via: |
| 89 | + |
| 90 | +1. CLI: `--test-workspace /path/to/workspace` |
| 91 | +2. Config: `.devtools/devtools.jsonc` → `"testWorkspace": "relative/or/absolute/path"` |
| 92 | + |
| 93 | +The sidebar **Workspace Root** panel shows all Git repositories discovered by VS Code's Git extension. Selecting a repository writes its relative path to `.devtools/devtools.jsonc`. |
| 94 | + |
| 95 | +### LM Tool Toggles |
| 96 | + |
| 97 | +LM tools are registered unconditionally at extension startup. Users can enable/disable individual tools using VS Code's native **Configure Tools...** button in Copilot Chat. |
0 commit comments