Skip to main content
Glama
L-Jovi

Keyhole – Local files for ChatGPT

write_file

DestructiveIdempotent

Create or replace a UTF-8 file in a read-write workspace with SHA-256 verification and recoverable change tracking. Preserves line endings and permissions.

Instructions

Create or replace a UTF-8 text/code/Markdown/config file in an rw space. Supply full text <=1 MiB, observed SHA-256 (or 'absent' for create), and unique request_id. Preserve existing UTF-8 BOM, CRLF and permissions by default; line_ending can be preserve/lf/crlf. Returns recoverable change_id. Prefer apply_text_patch for partial reads. No document binaries or code execution.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
textYes
workspaceYes
request_idYes
line_endingNopreserve
expected_sha256Yes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.2-demo.1

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare destructive and idempotent behavior. The description adds valuable behavioral context: it preserves BOM, CRLF, and permissions; enforces a 1 MiB size cap; requires a unique request_id for idempotency; and returns a recoverable change_id. It even explains the SHA-256 semantics (supply observed hash or 'absent' for create). No contradiction with 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 a tight paragraph that leads with the primary action, then packs constraints, parameters, and the alternative tool into a few sentences. Every sentence earns its place—no fluff, no repetition. The format is easy to scan.

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?

Given there is no output schema, the description appropriately mentions the return value ('recoverable change_id'). It covers size limits, encoding preservation, line-ending options, and the distinction from apply_text_patch. It doesn't delve into error cases (e.g., SHA mismatch handling) but that is not essential for a basic write operation. It is complete enough for an agent to call the tool correctly in most scenarios.

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?

The schema gives no parameter descriptions (0% coverage), so the description must compensate. It does explain the critical parameters: expected_sha256 ('observed SHA-256 (or 'absent' for create)'), request_id ('unique'), line_ending ('preserve/lf/crlf'), and text ('full text <=1 MiB'). Workspace and path are self-explanatory from their names, so the description covers the key semantics well even though not every parameter is individually dissected.

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 a specific verb and resource: 'Create or replace a UTF-8 text/code/Markdown/config file in an rw space.' It delimits file types and workspace type, and it contrasts with apply_text_patch by telling the agent to prefer that sibling for partial reads. An agent can immediately tell what this tool does and how it differs.

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 explicitly directs the agent to 'Prefer apply_text_patch for partial reads,' which is a clear alternative. It also sets boundaries with 'No document binaries or code execution.' However, it does not enumerate all use cases where the tool is inappropriate beyond partial reads, so it's strong but not exhaustive.

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