Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

move_file

Move or rename files and directories within allowed paths. Specify source and destination to transfer files between locations or rename them in one operation.

Instructions

Move or rename files and directories. Can move files between directories and rename them in a single operation. Both source and destination must be within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
destinationYes

Implementation Reference

  • The core handler function for the move_file tool. Validates both source and destination paths using the validatePath utility and performs the move operation using Node.js fs.rename.
    export async function moveFile(sourcePath: string, destinationPath: string): Promise<void> { const validSourcePath = await validatePath(sourcePath); const validDestPath = await validatePath(destinationPath); await fs.rename(validSourcePath, validDestPath); }
  • Zod schema defining the input arguments for the move_file tool: source (string) and destination (string) paths.
    export const MoveFileArgsSchema = z.object({ source: z.string(), destination: z.string(), });
  • src/server.ts:164-171 (registration)
    Registers the move_file tool in the MCP server's listTools response, providing name, description, and JSON schema derived from MoveFileArgsSchema.
    { name: "move_file", description: "Move or rename files and directories. Can move files between directories " + "and rename them in a single operation. Both source and destination must be " + "within allowed directories.", inputSchema: zodToJsonSchema(MoveFileArgsSchema), },
  • Server-side dispatch handler for the move_file tool call. Parses input args using the schema and delegates to the moveFile function, returning a success message.
    case "move_file": { const parsed = MoveFileArgsSchema.parse(args); await moveFile(parsed.source, parsed.destination); return { content: [{ type: "text", text: `Successfully moved ${parsed.source} to ${parsed.destination}` }], }; }

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/StrawHatAI/claude-dev-tools'

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