cp
Copy files or directories within virtual filesystem workspaces to duplicate content across storage providers and scopes.
Instructions
Copy file or directory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |
Implementation Reference
- src/chuk_mcp_vfs/vfs_tools.py:264-282 (handler)The VFSTools.cp method implements the core logic of the 'cp' tool by resolving source and destination paths relative to the current workspace and delegating the copy operation to the underlying virtual filesystem (vfs.cp).async def cp(self, request: CopyRequest) -> CopyResponse: """ Copy file or directory. Args: request: CopyRequest with source, dest, and recursive flag Returns: CopyResponse with success status """ vfs = self.workspace_manager.get_current_vfs() resolved_source = self.workspace_manager.resolve_path(request.source) resolved_dest = self.workspace_manager.resolve_path(request.dest) # Note: cp method doesn't have recursive parameter in AsyncVirtualFileSystem # It handles directories automatically await vfs.cp(resolved_source, resolved_dest) return CopyResponse(success=True, source=resolved_source, dest=resolved_dest)
- src/chuk_mcp_vfs/server.py:122-125 (registration)Registers the 'cp' tool with the MCP server, delegating execution to the VFSTools.cp method.@server.tool async def cp(request: CopyRequest): """Copy file or directory.""" return await vfs_tools.cp(request)
- src/chuk_mcp_vfs/models.py:198-212 (schema)Pydantic models defining the input schema (CopyRequest with source, dest, recursive) and output schema (CopyResponse with success, source, dest) for the 'cp' tool.class CopyRequest(BaseModel): """Request to copy file/directory""" source: str dest: str recursive: bool = False class CopyResponse(BaseModel): """Response from cp operation""" success: bool source: str dest: str