auto_select_workspace
Automatically determines and activates the most suitable VS Code workspace based on current context, eliminating manual selection.
Instructions
Automatically select the most appropriate VS Code workspace
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function that executes the auto_select_workspace logic. It detects VS Code workspaces, selects the most appropriate one (priority: currently open workspace > most recent workspace), and returns the result.
async autoSelectWorkspace(): Promise<ToolResult> { try { const detection = await this._performDetection(); // Priority: Currently open workspace > Most recent workspace let selectedWorkspace: VSCodeWorkspace | null = null; if (detection.instances.length > 0 && detection.instances[0].workspaces.length > 0) { selectedWorkspace = detection.instances[0].workspaces[0]; } else if (detection.recentWorkspaces.length > 0) { selectedWorkspace = detection.recentWorkspaces[0]; } if (!selectedWorkspace) { return { content: [{ type: 'text', text: 'No VS Code workspaces found. Please open VS Code with a workspace or manually set a workspace path.', }], }; } return { content: [{ type: 'text', text: `šÆ **Auto-selected workspace:** ${selectedWorkspace.name}\nš **Path:** ${selectedWorkspace.path}\nš¢ **Status:** ${selectedWorkspace.isOpen ? 'Currently Open' : 'Recent'}\n\nI'll use this workspace for our session. You can change it anytime by asking me to switch workspaces.`, }], }; } catch (error) { return { isError: true, content: [{ type: 'text', text: `Failed to auto-select workspace: ${error instanceof Error ? error.message : 'Unknown error'}`, }], }; } } - src/toolDefinitions.ts:55-62 (schema)Schema definition for auto_select_workspace tool - it expects no input properties.
{ name: 'auto_select_workspace', description: 'Automatically select the most appropriate VS Code workspace', inputSchema: { type: 'object', properties: {}, }, }, - src/index.ts:150-152 (registration)Registration of auto_select_workspace in the main tool dispatcher (switch-case), routing to vsCodeDetectionService.autoSelectWorkspace()
return await this.vsCodeDetectionService.presentWorkspaceChoice(); case 'auto_select_workspace': return await this.vsCodeDetectionService.autoSelectWorkspace();