Skip to main content
Glama

write

Create or overwrite files while preserving encoding, applying .editorconfig to new files, and creating parent directories automatically.

Instructions

Create or overwrite a file. Preserves existing encoding, uses .editorconfig for new files, and creates parent directories.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "content": "<content>"
    },
    "name": "write"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoAlias for file_path
contentYesContent to write to the file
encodingNoCharset override, e.g. EUC-KR or Shift_JIS; overrides .editorconfig, existing BOM takes priority
file_pathNoWorkspace-relative, absolute, or @name/subpath (directory_alias)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.1.2
    • changedInput schema / properties / file_path / description
      Previous value: -"File path; relative to workspace/MCP root"New value: +"Workspace-relative, absolute, or @name/subpath (directory_alias)"
  2. Changed1 schema field changedv1.0.5
    • addedInput schema / properties / encoding
      Added value: +{
      +  "description": "Charset override, e.g. EUC-KR or Shift_JIS; overrides .editorconfig, existing BOM takes priority",
      +  "type": "string"
      +}
  3. Changed1 schema field changedv0.9.7
    • changedInput schema / properties / file_path / description
      Previous value: -"File to write. Relative paths use the configured workspace or MCP client root"New value: +"File path; relative to workspace/MCP root"
  4. Changed1 schema field changedv0.9.5
    • changedInput schema / properties / file_path / description
      Previous value: -"Absolute path to the file to write"New value: +"File to write. Relative paths use the configured workspace or MCP client root"
  5. Addedv0.8.7
  6. Removed
  7. Changed1 schema field changedv0.7.12
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": false,
      -  "properties": {
      -    "result": {
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "type": "object"
      -}New value: +null
  8. First observedv0.4.2

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full disclosure burden and does disclose real side effects: parent directories are created, existing encoding is preserved, and .editorconfig governs new files. It does not state whether an existing file's contents are lost irrecoverably, what permissions are needed, or what the call returns — notable gaps for a write 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?

Two short sentences, front-loaded with the core action, with the behavioral notes packed into the second sentence. No filler or redundancy.

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

Completeness4/5

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

For a four-parameter write tool with no annotations and no output schema, the description covers the main behavioral surprises (parent dir creation, encoding inheritance) and the schema covers parameter details. The remaining gap is the absence of any return-value or failure-mode information, which nothing else supplies.

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 all four parameters (including the path/file_path alias and the encoding override with BOM precedence) are already documented. The description adds only the default resolution rule for encoding on new vs existing files, which is a modest increment over the schema.

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?

"Create or overwrite a file" gives a specific verb (create/overwrite) and resource (file), and the create-vs-overwrite contrast implicitly separates it from partial-modification siblings like edit or patch. However, it never names an alternative, so the differentiation is inferred rather than stated.

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

Usage Guidelines3/5

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

The overwrite framing hints at whole-file replacement rather than surgical edits, but there is no explicit when-to-use guidance, no exclusion pointing to edit/multiedit/patch, and no prerequisite conditions (e.g., existing file, permissions). Usage must be inferred from the verb.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.