workspace_switch
Switch between virtual filesystem workspaces to manage files across different storage providers and scopes.
Instructions
Switch to a different workspace.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/chuk_mcp_vfs/server.py:63-66 (registration)Registers the workspace_switch tool using @server.tool decorator, delegating to workspace_tools.workspace_switch@server.tool async def workspace_switch(name: str): """Switch to a different workspace.""" return await workspace_tools.workspace_switch(name)
- Main handler logic for the workspace_switch tool: calls workspace_manager.switch_workspace and constructs WorkspaceSwitchResponseasync def workspace_switch(self, name: str) -> WorkspaceSwitchResponse: """ Switch to a different workspace. Args: name: Workspace name to switch to Returns: WorkspaceSwitchResponse with new current workspace info """ info = await self.workspace_manager.switch_workspace(name) return WorkspaceSwitchResponse( name=info.name, provider=info.provider_type, current_path=info.current_path, is_mounted=info.is_mounted, )
- src/chuk_mcp_vfs/models.py:81-88 (schema)Pydantic model defining the response schema for workspace_switch toolclass WorkspaceSwitchResponse(BaseModel): """Response from workspace switch""" name: str provider: ProviderType current_path: str is_mounted: bool
- Core helper method in WorkspaceManager that performs the actual workspace switch by updating current_namespace_idasync def switch_workspace(self, name: str) -> WorkspaceInfo: """ Switch to a different workspace. Args: name: Workspace name Returns: WorkspaceInfo for the switched workspace Raises: ValueError: If workspace doesn't exist """ # Find namespace by name for nid, info in self._namespace_to_info.items(): if info.name == name: self._current_namespace_id = nid return info raise ValueError(f"Workspace '{name}' does not exist")