Skip to main content
Glama
talentedmrweb

Local Dev Bridge MCP

write_file

Create or overwrite files with specified content for local development tasks, enabling direct file system access within configured project directories.

Instructions

Create or overwrite a file with new content. Use this to create new files or completely replace existing ones.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the file (relative to projects directory or absolute)
contentYesContent to write to the file

Implementation Reference

  • The main handler function that executes the write_file tool: resolves the file path, creates the directory if necessary, writes the content to the file using fs.writeFile, and returns a success message.
    async writeFile(filePath, content) {
      const resolvedPath = this.resolvePath(filePath);
      const dir = path.dirname(resolvedPath);
      await fs.mkdir(dir, { recursive: true });
      await fs.writeFile(resolvedPath, content, 'utf-8');
      return {
        content: [
          {
            type: 'text',
            text: `File written successfully: ${resolvedPath}`,
          },
        ],
      };
    }
  • index.js:61-78 (registration)
    Registration of the write_file tool in the ListToolsRequestSchema handler, including name, description, and input schema definition.
    {
      name: 'write_file',
      description: 'Create or overwrite a file with new content. Use this to create new files or completely replace existing ones.',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Path to the file (relative to projects directory or absolute)',
          },
          content: {
            type: 'string',
            description: 'Content to write to the file',
          },
        },
        required: ['path', 'content'],
      },
    },
  • index.js:166-167 (registration)
    In the CallToolRequestSchema handler, the switch case that routes write_file calls to the writeFile method.
    case 'write_file':
      return await this.writeFile(args.path, args.content);
  • Input schema definition for the write_file tool, specifying path and content as required string properties.
    inputSchema: {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: 'Path to the file (relative to projects directory or absolute)',
        },
        content: {
          type: 'string',
          description: 'Content to write to the file',
        },
      },
      required: ['path', 'content'],
    },
  • Helper method used by writeFile to resolve relative file paths to absolute paths within the projects directory.
    resolvePath(inputPath) {
      if (!inputPath || inputPath === '.') {
        return PROJECTS_DIR;
      }
      if (path.isAbsolute(inputPath)) {
        return inputPath;
      }
      return path.join(PROJECTS_DIR, inputPath);
    }
Behavior3/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 clearly indicates this is a write/mutation operation ('create or overwrite') and specifies it completely replaces existing files. However, it doesn't mention permission requirements, error conditions (e.g., path validation), or what happens on success/failure, which are important for a destructive operation.

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

Conciseness5/5

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

The description is perfectly concise with two sentences that each earn their place: the first states the core functionality, the second provides usage guidance. No wasted words, and it's front-loaded with the essential information.

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

Completeness3/5

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

For a destructive write operation with no annotations and no output schema, the description is adequate but has clear gaps. It covers the basic purpose and behavior but lacks information about return values, error handling, and specific constraints. Given the complexity of file operations, more context would be helpful.

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?

The input schema has 100% description coverage, providing clear documentation for both parameters. The description doesn't add any additional parameter semantics beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

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

Purpose5/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 with specific verbs ('create or overwrite') and resource ('a file with new content'), distinguishing it from siblings like edit_file (partial updates) and read_file (read-only). It explicitly covers both creation and replacement scenarios.

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

Usage Guidelines4/5

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

The description provides clear usage context ('create new files or completely replace existing ones'), which helps differentiate from edit_file for partial modifications. However, it doesn't explicitly mention when NOT to use this tool (e.g., for appending) or name specific alternatives beyond the implied contrast with edit_file.

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/talentedmrweb/local-dev-bridge-mcp'

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