Skip to main content
Glama

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

Implementation Reference

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

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