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 primary handler for the 'cp' MCP tool. Resolves paths using WorkspaceManager and delegates the copy operation to the underlying VFS implementation.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)MCP server registration of the 'cp' tool using the @server.tool decorator, which forwards calls to VFSTools.cp.@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) and output schema (CopyResponse) 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