Skip to main content
Glama

write_file

Create a new file or replace or append content in a repository, with parent directories automatically created. Choose mode to avoid overwriting or to extend existing files.

Instructions

Create a new file, or replace / append to an existing one. Use this for NEW files. To change part of an existing file use edit_file instead — it is safer and much cheaper than resending the whole file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNocreate (default, fails if the file exists), overwrite, or append.
pathYesFile path relative to the workspace root. Parent directories are created.
contentYesFull file content (or the text to append).
workspaceNoWorkspace alias. Defaults to the active workspace.
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the three operation modes (create, replace, append) and implies that write_file rewrites the whole file by contrasting it with 'edit_file' as 'safer and much cheaper'. It does not dwell on destructive details, but the schema's mode enum covers the specifics.

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 consists of two tight sentences. It is front-loaded with the core action, includes an explicit usage restriction, and names an alternative tool — all without unnecessary words.

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

Completeness5/5

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

Given the complete parameter schema and the focused description, the agent has everything needed to select and invoke the tool correctly. The description covers usage context and sibling differentiation, and the schema explains mode, path, content, and workspace. No output schema is required.

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% and each parameter is fully described (mode defaults/fail behavior, path resolution, content meaning, workspace default). The description itself adds no parameter-specific insights, so the baseline of 3 is appropriate.

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 function: 'Create a new file, or replace / append to an existing one.' It identifies the specific verb and resource, and explicitly scopes usage to 'NEW files', distinguishing it from the sibling tool edit_file.

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

Usage Guidelines5/5

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

The description provides explicit when-to-use guidance: 'Use this for NEW files.' It also gives an exclusion and names an alternative: 'To change part of an existing file use edit_file instead — it is safer and much cheaper.' This is a textbook example of usage direction.

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/zcrossoverz/repo-bridge'

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