Skip to main content
Glama

Patch note preamble

patch_note_preamble
Destructive

Replace or remove content before the first Markdown heading in a note. Uses expected_hash to ensure safe edits and rejects files without a heading or with unclosed code fences.

Instructions

Use this to replace or remove content strictly before the first Markdown heading recognized by the current write selector. Pass the note's exact expected_hash for CAS. Empty or whitespace-only new_content removes the preamble. The first heading and all following content preserve exact bytes when the file uses uniform line endings; mixed-EOL files follow the existing global dominant-EOL normalization. Notes without a recognized Markdown heading are refused fail-closed, and so is content that leaves a code fence or HTML block open. The shared AST selector supports ATX and Setext headings, normalizes closing hashes, and ignores headings inside fenced code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rel_pathYes
request_idNo
new_contentYes
expected_hashYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexedYes
patchedNo
rel_pathNo
replayedNo
committedNo
content_hashYes
operation_idNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv0.1.5
    • addedInput schema / properties / request_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Request Id"
      +}
    • addedOutput schema / properties / committed
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Committed"
      +}
    • addedOutput schema / properties / operation_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Operation Id"
      +}
    • removedOutput schema / properties / patched / $ref
      Removed value: -"#/$defs/PatchedPreambleOutput"
    • addedOutput schema / properties / patched / anyOf
      Added value: +[
      +  {
      +    "$ref": "#/$defs/PatchedPreambleOutput"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedOutput schema / properties / patched / default
      Added value: +null
    • addedOutput schema / properties / rel_path
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Rel Path"
      +}
    • addedOutput schema / properties / replayed
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Replayed"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "patched",
      -  "content_hash",
      -  "indexed"
      -]New value: +[
      +  "content_hash",
      +  "indexed"
      +]
  2. Addedv0.1.3

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already mark destructiveHint true, and the description goes further: CAS via expected_hash, empty-content deletion semantics, exact-byte preservation with EOL normalization, and fail-closed cases. No contradiction with 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?

Four dense sentences, each adding distinct information: operation, CAS, edge cases, and parser behavior. It is compact despite covering several important caveats, and the main use is front-loaded.

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?

Given the destructiveHint annotation, output schema, and moderate complexity, the description covers all critical calling context: exact scope, CAS requirement, deletion semantics, EOL normalization, and refusal cases. Nothing essential is missing for correct invocation.

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 description coverage is 0%, so the description must compensate. It explains expected_hash (CAS) and new_content (empty removes; whitespace-only same), two of the three key parameters. rel_path and request_id are left to inference, but rel_path is self-evident and request_id has a default.

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?

Description states a precise action – replace or remove content before the first Markdown heading – and identifies the target resource (the note preamble) and the boundary (first heading). It clearly differentiates from section-level siblings by limiting scope to the preamble.

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?

Clearly states when to use (replacing/removing preamble content) and includes fail-closed conditions (no heading, open code fence/HTML block). It does not explicitly name sibling tools as alternatives, but the scope is explicit enough that an agent can decide.

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