Skip to main content
Glama

cd

Change the current working directory in a virtual filesystem workspace to navigate and organize files efficiently.

Instructions

Change current working directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The main handler function for the 'cd' tool that changes the current working directory in the virtual filesystem.
    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)
  • Registration of the 'cd' tool in the MCP server using @server.tool decorator, which delegates to VFSTools.cd.
    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 cwd: str

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