Skip to main content
Glama

Write a file

write_file

Create or overwrite text files on macOS while respecting path allowlists, blocking protected paths, and requiring confirmation before replacing existing files.

Instructions

Create or overwrite a text file. Honours the path allowlist, refuses protected paths, and asks for confirmation before overwriting an existing file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path (supports ~ for home).
contentYesFull UTF-8 contents to write.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, so the description's added value comes from disclosing specific behaviors: allowing path restrictions, protecting certain paths, and requiring confirmation before overwrite. This gives the agent useful safety expectations beyond what structured fields convey. The description does not contradict the annotations.

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 two short sentences that front-load the core action and then compactly list the key behavioral constraints. Every clause adds useful information with no repetition or filler.

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 simple two-parameter write tool, the schema covers parameters, annotations cover safety posture, and no output schema is needed. The description is sufficient for correct invocation; a minor omission is not showing an example path or explaining failure modes, but these are not essential here.

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%, and both parameters are already well described: path supports ~ and content is full UTF-8. The description adds only the generic 'text file' wording, which is not needed to compensate for a documentation gap, 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 opens with 'Create or overwrite a text file,' a specific verb-resource pair that clearly identifies the tool's action and target. It also implies a mutation operation, which distinguishes it from read-only siblings like read_file and get_clipboard.

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?

It provides clear context for when to use the tool—creating or overwriting a text file—and adds practical guardrails: path allowlist, protected-path refusal, and confirmation before overwriting. It does not explicitly name sibling alternatives or state when not to use it, so it falls short of a 5.

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