Skip to main content
Glama

files/create

DestructiveIdempotent

Create or overwrite a file with text content. Missing parent directories are created; omit content to only make an empty file or refresh its modification time.

Instructions

Writes a whole file: creates it, or REPLACES the content of an existing one entirely. Mutating and not atomic. Missing parent directories are created (mode 0755); a new file gets mode 0644, an existing file keeps its mode. With content omitted or empty it only touches: creates an empty file or refreshes the modification time and never truncates an existing file. To change part of an existing file use files/update (append or replace lines); to check first whether a path exists use files/list or files/find; afterwards set mode or owner with files/chmod/files/chown. content is text and no trailing newline is added; path must be absolute. Writing where your account cannot needs privileged: true (a grant, and for root a paths: entry covering the path, which also refuses symlinks in the path; otherwise a symlink at the path is followed). Returns one line, Successfully created and wrote to PATH or Successfully touched PATH; failures are plain text such as failed to write to file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path of the file; missing parent directories are created
contentNoText to write; replaces any existing content entirely, no newline is added. Omit or leave empty to only create an empty file or refresh its mtime (never truncates)
privilegedNoRun as root. Needs a grant for this tool in mcp-sudo.yaml and a `paths:` entry covering the path, otherwise refused

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.4.1
    • changedInput schema / properties / content / description
      Previous value: -"Text content to write to the file"New value: +"Text to write; replaces any existing content entirely, no newline is added. Omit or leave empty to only create an empty file or refresh its mtime (never truncates)"
    • changedInput schema / properties / path / description
      Previous value: -"Path to the file to create"New value: +"Absolute path of the file; missing parent directories are created"
    • changedInput schema / properties / privileged / description
      Previous value: -"Set to true to write as root"New value: +"Run as root. Needs a grant for this tool in mcp-sudo.yaml and a `paths:` entry covering the path, otherwise refused"
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations (destructiveHint=true, idempotentHint=true): not atomic, parent dirs created at 0755, new file 0644, existing file keeps mode, empty content only touches and never truncates, privileged mode needs a grant plus a paths entry covering the path and refuses symlinks, and the exact success/failure return strings.

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

Conciseness4/5

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

One dense paragraph that front-loads the core behavior (whole-file write, replacement, non-atomic) before alternatives and edge cases. Every sentence carries information, though the volume makes it slightly heavy for a three-parameter tool.

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?

With no output schema, the description supplies the return contract (one success line, plain-text failures), plus privileged-mode prerequisites and symlink behavior. Nothing an agent needs to call it safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: content is text with no trailing newline appended, path must be absolute, and privileged requires both a grant and a covering paths entry. It largely mirrors the schema for path but enriches the privileged and content semantics.

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?

States a specific verb+resource with scope: 'Writes a whole file: creates it, or REPLACES the content of an existing one entirely.' It immediately distinguishes itself from the closest sibling by noting it replaces entire content versus files/update which changes parts.

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?

Explicitly routes to alternatives with conditions: use files/update to change part of a file, files/list or files/find to check existence, files/chmod/files/chown to set mode or owner. It also clarifies the empty-content touch semantics versus truncation, leaving nothing to inference.

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