fs_move_file
Move or rename files and directories by specifying source and destination paths to organize your development workspace.
Instructions
Move or rename a file or directory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Source path | |
| destination | Yes | Destination path |
Implementation Reference
- src/tools/filesystem.ts:386-417 (handler)The main handler function for the fs_move_file tool. It performs the file/directory move operation using Node.js fs.rename and returns a standardized ToolResponse.export async function moveFile(args: z.infer<typeof moveFileSchema>): Promise<ToolResponse> { try { await fs.rename(args.source, args.destination); return { content: [ { type: "text" as const, text: JSON.stringify({ success: true, source: args.source, destination: args.destination, message: 'File/directory moved successfully' }, null, 2) } ] }; } catch (error) { return { content: [ { type: "text" as const, text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : String(error) }, null, 2) } ], isError: true }; } }
- src/tools/filesystem.ts:55-58 (schema)Zod schema used for input validation in the fs_move_file handler.export const moveFileSchema = z.object({ source: z.string().describe('Source path'), destination: z.string().describe('Destination path') });
- src/tools/filesystem.ts:618-635 (schema)MCP tool metadata definition for fs_move_file, including the input schema exposed to the model.{ name: 'fs_move_file', description: 'Move or rename a file or directory', inputSchema: { type: 'object', properties: { source: { type: 'string', description: 'Source path' }, destination: { type: 'string', description: 'Destination path' } }, required: ['source', 'destination'] } },
- src/index.ts:337-339 (registration)Registration and dispatch logic in the main MCP server handler that routes 'fs_move_file' calls to the appropriate schema validation and handler execution.if (name === 'fs_move_file') { const validated = moveFileSchema.parse(args); return await moveFile(validated);