Skip to main content
Glama

move_file

Destructive

Move or rename files and directories by specifying source and destination paths. Use absolute paths for reliable file system operations.

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.
                    
                    IMPORTANT: Always use absolute paths for reliability. Paths are automatically normalized regardless of slash direction. Relative paths may fail as they depend on the current working directory. Tilde paths (~/...) might not work in all contexts. Unless the user explicitly asks for relative paths, use absolute paths.
                    This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
destinationYes

Implementation Reference

  • Handler function that parses arguments using MoveFileArgsSchema, calls the moveFile helper with source and destination paths, and returns a success or error message.
    export async function handleMoveFile(args: unknown): Promise<ServerResult> {
        try {
            const parsed = MoveFileArgsSchema.parse(args);
            await moveFile(parsed.source, parsed.destination);
            return {
                content: [{ type: "text", text: `Successfully moved ${parsed.source} to ${parsed.destination}` }],
            };
        } catch (error) {
            const errorMessage = error instanceof Error ? error.message : String(error);
            return createErrorResponse(errorMessage);
        }
    }
  • Zod schema defining input parameters: source and destination as strings.
    export const MoveFileArgsSchema = z.object({
      source: z.string(),
      destination: z.string(),
    });
  • src/server.ts:476-492 (registration)
    MCP tool registration in list_tools handler: defines name 'move_file', description, input schema from MoveFileArgsSchema, and annotations.
        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.
                
                ${PATH_GUIDANCE}
                ${CMD_PREFIX_DESCRIPTION}`,
        inputSchema: zodToJsonSchema(MoveFileArgsSchema),
        annotations: {
            title: "Move/Rename File",
            readOnlyHint: false,
            destructiveHint: true,
            openWorldHint: false,
        },
    },
  • Core filesystem move implementation: validates both paths and performs 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);
    }
  • Dispatcher in call_tool handler that routes 'move_file' calls to handleMoveFile.
    case "move_file":
        result = await handlers.handleMoveFile(args);
        break;
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate destructiveHint=true and readOnlyHint=false, which the description aligns with by implying mutation ('move or rename'). The description adds valuable context beyond annotations: it specifies path requirements (absolute vs. relative, tilde limitations), normalization behavior, and constraints like 'within allowed directories'. No contradictions with annotations are present.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose. Each sentence adds value: the first states the action, the second clarifies scope, the third sets constraints, and the fourth provides usage tips. Minor verbosity in the path instructions slightly reduces efficiency, but overall it's well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the destructive nature (annotations: destructiveHint=true), no output schema, and 2 parameters with 0% schema coverage, the description is largely complete. It covers purpose, usage, constraints, and behavioral details. It could improve by mentioning error cases or return values, but annotations provide safety context, making it sufficient for agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for the 2 parameters, the description compensates by explaining that 'source' and 'destination' must be absolute paths within allowed directories, and that they can be used for both moving between directories and renaming. It adds practical meaning beyond the bare schema, though it could detail path formats or examples more.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Move or rename files and directories') and distinguishes it from siblings like 'create_directory', 'read_file', and 'write_file' by specifying it handles both relocation and renaming in one operation. It explicitly mentions the resource ('files and directories') and the dual functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool (for moving/renaming files/directories) and when not to use it (e.g., for creating directories, reading/writing files, or other operations handled by siblings). It also specifies prerequisites like using absolute paths and staying within allowed directories, and mentions alternative phrasing ('DC: ...' or 'Desktop Commander') for user instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/wonderwhy-er/ClaudeComputerCommander'

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