Skip to main content
Glama

Replace one block

geml_set
DestructiveIdempotent

Replace one block in a GEML or Markdown document while leaving every other byte unchanged. The edit is validated first and refused if it would break the document.

Instructions

Replace ONE block and leave every other byte untouched — prefer this to rewriting a file. For content that does not exist yet use geml_add; to remove a block, geml_delete. The replacement is validated before it is written: if it would break the document, nothing is written and the diagnostics come back — fix the body rather than resending it. Removing content is not refused: if the replacement drops blocks, the write goes through and the result names each one, so check it after shortening a section; geml_revert puts one back. part replaces the whole block (default), its head line, a section's intro, or its body. In a Markdown file a heading's anchor is its text, as on GitHub: new heading text gives the heading a new address, and the document's links to the old one follow in the same write. GEML content written over a Markdown heading or prose is converted to Markdown, as in geml_add; a GEML block already in the file stays GEML. An id that matches no block, or several, is refused. Returns {ok, file, diagnostics, revision}, with notes when the write did something to say out loud (a block it dropped, an address it changed); a refusal is ok: false with a hint, and the file is unchanged.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWhich block to replace: an id (with or without `#`), a `@<hex>` content address from `geml_list` for a block with no id, or `L27`/`L27-58` for the smallest block holding those lines. Must match exactly one block
bodyYesThe replacement text
fileYesDocument path relative to the server's --root directory, e.g. notes/spec.geml
partNoWhat to replace (default: whole). `intro` replaces a section's opening — everything under the heading up to its first subheading — and leaves every subsection byte-identical, which is what makes a read-edit-write cycle on a long section safe. An empty intro (a subheading follows the heading immediately) is written into, so this also adds an opening where there was none.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and non-read-only, but the description goes well beyond them: validation happens before the write, a breaking body leaves the file untouched and returns diagnostics, replacing-with-fewer-blocks is NOT refused and the result enumerates each dropped block, and an ambiguous or missing id is refused. It also discloses the return shape and the ok:false/hint refusal path.

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?

The core constraint and the sibling routing are front-loaded, and every sentence carries distinct information (validation, refusal, id matching, part variants, Markdown conversion, return shape). It is dense and lengthy, but not padded — the length is justified by the tool's branching behavior.

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?

There is no output schema, yet the description describes the return payload ({ok, file, diagnostics, revision}, optional notes) and the refusal form, plus the Markdown/GEML conversion rules and the dropped-block reporting. Nothing an agent needs to invoke this mutation correctly 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 baseline is 3, but the description genuinely adds meaning: it explains what `part` values do behaviorally (intro leaves subsections byte-identical, making read-edit-write cycles safe, and an empty intro is written into). It also adds the Markdown anchor/heading-address semantics that the schema does not cover.

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 and resource ('Replace ONE block') plus its defining scope constraint ('leave every other byte untouched'), and explicitly distinguishes itself from geml_add, geml_delete, and geml_revert. An agent can tell it apart from all siblings without opening a schema.

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?

Gives explicit routing rules: 'prefer this to rewriting a file,' 'For content that does not exist yet use geml_add,' 'to remove a block, geml_delete,' and 'geml_revert puts one back.' When-to-use, when-not-to-use, and the alternatives are all named.

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