cd
Navigate between directories in virtual filesystem workspaces to access and manage files across multiple storage providers.
Instructions
Change current working directory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- src/chuk_mcp_vfs/server.py:131-134 (handler)MCP tool handler for the 'cd' tool. Decorated with @server.tool for registration and execution, delegates core logic to VFSTools.cd.@server.tool async def cd(path: str): """Change current working directory.""" return await vfs_tools.cd(path)
- src/chuk_mcp_vfs/models.py:219-222 (schema)Pydantic model defining the response schema for the cd tool.class ChangeDirectoryResponse(BaseModel): """Response from cd operation""" success: bool
- Core implementation of cd functionality in VFSTools class: resolves path, validates it's a directory, updates workspace current path, returns response.async def cd(self, path: str) -> ChangeDirectoryResponse: """ Change current working directory. Args: path: Directory path Returns: ChangeDirectoryResponse with new cwd """ vfs = self.workspace_manager.get_current_vfs() resolved_path = self.workspace_manager.resolve_path(path) # Verify path exists and is a directory node = await vfs.get_node_info(resolved_path) if not node or not node.is_dir: raise ValueError(f"Not a directory: {resolved_path}") self.workspace_manager.set_current_path(resolved_path) return ChangeDirectoryResponse(success=True, cwd=resolved_path)