Skip to main content
Glama
ai-yliu

Filesystem MCP Server

by ai-yliu

move_file

Transfer files or directories from one location to another, or rename them by specifying source and destination paths within allowed filesystem limits.

Instructions

Move or rename files and directories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationYesDestination path
sourceYesSource path

Implementation Reference

  • The handler function for the 'move_file' tool. Validates source and destination paths, checks if destination exists (throws if it does), ensures the parent directory of destination exists, moves the file using fs.move, and returns a success message.
    case 'move_file': { const { source, destination } = request.params.arguments as { source: string; destination: string }; validatePath(source); validatePath(destination); // Check if destination exists const destinationExists = await fs.pathExists(destination); if (destinationExists) { throw new McpError( ErrorCode.InvalidRequest, `Destination already exists: ${destination}` ); } // Ensure parent directory of destination exists await fs.ensureDir(path.dirname(destination)); await fs.move(source, destination); return { content: [ { type: 'text', text: `Successfully moved ${source} to ${destination}`, }, ], }; }
  • src/index.ts:172-189 (registration)
    Registration of the 'move_file' tool in the listTools response, including its name, description, and input schema.
    { name: 'move_file', description: 'Move or rename files and directories', inputSchema: { type: 'object', properties: { source: { type: 'string', description: 'Source path', }, destination: { type: 'string', description: 'Destination path', }, }, required: ['source', 'destination'], }, },
  • Input schema definition for the 'move_file' tool, specifying source and destination paths as required string properties.
    inputSchema: { type: 'object', properties: { source: { type: 'string', description: 'Source path', }, destination: { type: 'string', description: 'Destination path', }, }, required: ['source', 'destination'], },

Other Tools

Related 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/ai-yliu/filesystem-mcp-server'

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