Skip to main content
Glama

fast_write_file

Write or modify files with automatic directory creation, append support, encoding options, and emoji removal.

Instructions

Writes or modifies a file (provides emoji guidelines)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path
contentYesFile content
encodingNoText encodingutf-8
create_dirsNoAutomatically create directories
appendNoAppend mode
force_remove_emojisNoForce remove emojis (default: false)

Implementation Reference

  • The handler function that executes the fast_write_file tool logic. It validates the path, optionally creates directories, writes or appends content to the file, and returns file metadata.
    async function handleWriteFile(args: any) {
      const { path: filePath, content, encoding = 'utf-8', create_dirs = true, append = false } = args;
      
      let targetPath: string;
      if (path.isAbsolute(filePath)) {
        targetPath = filePath;
      } else {
        targetPath = path.join(process.cwd(), filePath);
      }
      
      if (!isPathAllowed(targetPath)) {
        throw new Error(`Access denied to path: ${targetPath}`);
      }
      
      const resolvedPath = path.resolve(targetPath);
      
      if (create_dirs) {
        const dir = path.dirname(resolvedPath);
        await fs.mkdir(dir, { recursive: true });
      }
      
      if (append) {
        await fs.appendFile(resolvedPath, content, encoding as BufferEncoding);
      } else {
        await fs.writeFile(resolvedPath, content, encoding as BufferEncoding);
      }
      
      const stats = await fs.stat(resolvedPath);
      
      return {
        message: `File ${append ? 'appended' : 'written'} successfully`,
        path: resolvedPath,
        size: stats.size,
        size_readable: formatSize(stats.size),
        encoding: encoding,
        mode: append ? 'append' : 'write',
        timestamp: new Date().toISOString()
      };
    }
  • The input schema definition for the fast_write_file tool within the MCP_TOOLS array. Defines parameters: path (required), content (required), encoding, create_dirs, append.
    {
      name: 'fast_write_file',
      description: '파일을 쓰거나 수정합니다',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '파일 경로' },
          content: { type: 'string', description: '파일 내용' },
          encoding: { type: 'string', description: '텍스트 인코딩', default: 'utf-8' },
          create_dirs: { type: 'boolean', description: '디렉토리 자동 생성', default: true },
          append: { type: 'boolean', description: '추가 모드', default: false }
        },
        required: ['path', 'content']
      }
    },
  • api/server.ts:326-328 (registration)
    The registration/call dispatch entry for fast_write_file in the tools/call switch statement, mapping the tool name to the handleWriteFile handler function.
    case 'fast_write_file':
      result = await handleWriteFile(args);
      break;
Behavior2/5

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

With no annotations, the description must cover behavioral traits, but it only hints at emoji handling. It does not disclose that the tool can force-remove emojis, append, or create directories—all key behaviors evident only from the schema. No mention of side effects, permissions, or error states.

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 a single, brief sentence with no filler. It could be restructured to front-load the primary action more effectively, but it remains concise and direct.

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

Completeness2/5

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

Without an output schema, the description should at least explain return values or success indications, but it does not. It also ignores most of the six parameters and their implications, making it incomplete for a tool of this complexity.

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

Parameters3/5

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

Schema coverage is 100% with descriptions for each parameter, so the baseline is 3. The description adds no extra meaning to the parameters, but mentioning 'emoji guidelines' provides a small hint beyond the schema, keeping it at baseline.

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

Purpose4/5

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

The description clearly states the tool writes or modifies a file, which is the primary purpose. However, it does not differentiate from sibling tools like fast_large_write_file or fast_safe_edit, leaving ambiguity about when to use this specific tool over others.

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

Usage Guidelines2/5

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

No usage guidelines are provided. The description does not indicate when to use this tool, when not to, or how it compares to alternatives. This omission leaves the agent without context for proper selection.

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/efforthye/fast-filesystem-mcp'

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