Skip to main content
Glama

fast_write_file

Write or modify files with automatic directory creation, append mode, and emoji handling options for reliable file system operations.

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

  • Implements the core logic for the fast_write_file tool: resolves and validates the path, optionally creates parent directories, writes or appends the content to the file, and returns success information with file stats.
    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()
      };
    }
  • Defines the input schema for the fast_write_file tool, specifying parameters like path, content, encoding, create_dirs, and append with their types and descriptions.
    {
      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)
    Registers the fast_write_file tool handler in the main tools/call switch statement, dispatching calls to the handleWriteFile 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 provided, the description carries the full burden of behavioral disclosure. It mentions 'provides emoji guidelines' which hints at some behavior, but doesn't explain what this means operationally. It doesn't disclose whether this is a synchronous/async operation, error handling, permissions required, or what happens when files already exist. The description is too vague about the actual behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 6 words, but this comes at the cost of being under-specified. 'Provides emoji guidelines' is vague and doesn't clearly connect to the tool's functionality. While brief, it fails to provide essential context that would help an agent understand when and how to use this tool.

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?

For a file write/modify tool with 6 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain the tool's behavior, when to use it versus siblings, what 'emoji guidelines' means, or what the tool returns. The agent would struggle to use this tool correctly without additional context.

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 description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema. It mentions 'emoji guidelines' which might relate to the force_remove_emojis parameter, but doesn't explain this connection. Baseline 3 is appropriate when the schema does all the work.

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's purpose as 'Writes or modifies a file' with a specific verb and resource. It distinguishes from siblings like fast_read_file or fast_delete_file by focusing on writing/modifying. However, it doesn't explicitly differentiate from fast_large_write_file, which appears to be a similar sibling tool.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'provides emoji guidelines' but doesn't explain what this means or when this tool is preferred over fast_large_write_file or fast_safe_edit. No context about performance characteristics, file size limitations, or use cases is provided.

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