[FEATURE] Tool call to manage VS Code workspace folders (add/remove/list) from a running Claude Code session
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
There is no tool available to a Claude Code session that can ask the connected IDE (VS Code / code-server, via the extension's own MCP/IDE channel) to perform workspace-level actions — e.g. "add this folder to the current workspace", "remove this folder", "list open workspace folders". The only IDE-adjacent tool currently exposed is LSP (code intelligence: goToDefinition, findReferences, hover, etc.) — nothing for workspace/window state.
This came up in a session where I'd split a subfolder of an existing repo into its own standalone repo, and needed to add the new location as a folder in an existing multi-root .code-workspace file. I asked "can't you just ask VS Code directly?", and the answer was no — the only available path was to locate the right .code-workspace JSON file on disk and edit its folders array directly with a text-editing tool.
That workaround has real downsides:
- It requires knowing/finding the right
.code-workspacefile — not always obvious when multiple workspace files exist across synced/local paths (e.g. a repo-local copy vs. a OneDrive-synced copy). - It bypasses the running VS Code window entirely: if the window has unsaved/in-memory workspace state, or the change needs to take effect without a manual reload, a direct file edit doesn't trigger VS Code's own
onDidChangeWorkspaceFoldershandling. - It's the kind of action a user would naturally expect their IDE assistant to just "do", the same way the extension's own "Add Folder to Workspace..." command does it live.
Proposed Solution
Expose an IDE-integration tool (via the same channel the extension already uses for the ide MCP server / lock-file protocol) that lets Claude:
addWorkspaceFolder(path)/removeWorkspaceFolder(path)— mirrors VS Code's ownvscode.workspace.updateWorkspaceFoldersAPI.listWorkspaceFolders()— so Claude can check current state before acting instead of guessing from disk.
This would let Claude Code perform the same "add folder to workspace" action a user would do via the Command Palette, without needing to find and hand-edit the .code-workspace file — and it would take effect immediately in the running window.
Alternative Solutions
Keep editing the .code-workspace file directly on disk (current behavior). Works, but has the downsides described above.
Priority
Nice to have
Feature Category
IDE Integration
Use Case Example
- User splits a subfolder into its own repo and asks Claude to add it to the current multi-root workspace.
- Claude calls
listWorkspaceFolders()to see current state, thenaddWorkspaceFolder(newPath). - VS Code updates the workspace live, no manual file edit or reload needed.
Additional Context
_No response_