Skip to main content
Glama

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
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • 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)
  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chrishayuk/chuk-mcp-vfs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server