Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

fs_append_file

Add content to the end of a file or create a new file if it doesn't exist, supporting various encoding formats for development workflows.

Instructions

Append content to an existing file. Creates the file if it doesn't exist.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute or relative path to the file
contentYesContent to append to the file
encodingNoFile encodingutf8

Implementation Reference

  • Core handler function that appends content to a file using Node.js fs.appendFile, handles errors, and returns JSON response.
    export async function appendFile(args: z.infer<typeof appendFileSchema>): Promise<ToolResponse> { try { await fs.appendFile(args.path, args.content, args.encoding as BufferEncoding); return { content: [ { type: "text" as const, text: JSON.stringify({ success: true, path: args.path, bytesAppended: args.content.length }, 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 }; } }
  • Zod input schema for validating tool arguments: path, content, encoding.
    export const appendFileSchema = z.object({ path: z.string().describe('Absolute or relative path to the file'), content: z.string().describe('Content to append to the file'), encoding: z.enum(['utf8', 'binary', 'base64']).default('utf8').describe('File encoding') });
  • MCP tool registration in filesystemTools array, defining name, description, and inputSchema for the MCP protocol.
    { name: 'fs_append_file', description: 'Append content to an existing file. Creates the file if it doesn\'t exist.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Absolute or relative path to the file' }, content: { type: 'string', description: 'Content to append to the file' }, encoding: { type: 'string', enum: ['utf8', 'binary', 'base64'], default: 'utf8', description: 'File encoding' } }, required: ['path', 'content'] } },
  • src/index.ts:313-315 (registration)
    Dispatch logic in main server CallToolRequestHandler that parses arguments and invokes the appendFile handler.
    if (name === 'fs_append_file') { const validated = appendFileSchema.parse(args); return await appendFile(validated);

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/ConnorBoetig-dev/mcp2'

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