Skip to main content
Glama
ai-yliu

Filesystem MCP Server

by ai-yliu

write_file

Create or update files by writing content to specified paths in the filesystem.

Instructions

Create new file or overwrite existing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the file to write
contentYesContent to write to the file

Implementation Reference

  • Handler for the 'write_file' tool. Extracts path and content from arguments, validates the path, ensures the parent directory exists, writes the file using fs.writeFile, and returns a success message.
    case 'write_file': { const { path: filePath, content } = request.params.arguments as { path: string; content: string }; validatePath(filePath); // Ensure parent directory exists await fs.ensureDir(path.dirname(filePath)); await fs.writeFile(filePath, content, 'utf8'); return { content: [ { type: 'text', text: `File written successfully: ${filePath}`, }, ], }; }
  • src/index.ts:127-143 (registration)
    Registers the 'write_file' tool in the ListTools response, including name, description, and input schema definition.
    name: 'write_file', description: 'Create new file or overwrite existing', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the file to write', }, content: { type: 'string', description: 'Content to write to the file', }, }, required: ['path', 'content'], }, },

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