Skip to main content
Glama

Patch note section

patch_note_section
Destructive

Rewrite an outdated section of a Markdown note in place by targeting its heading and using the current content hash for atomic replacement.

Instructions

Use this to rewrite an outdated section in place when the topic already has a note. Replace the content under one existing Markdown heading. Pass the note's current content_hash as expected_hash for CAS. The operation preserves the heading line and non-target sections, stores exact prior history, and writes atomically. It refuses, at every level, a section that contains subsections (error code section_has_subsections, which lists them): patch a subsection instead, or delete it explicitly first. It also refuses content that leaves a code fence or HTML block open, or that changes how other headings are read (section_structure_changed). For duplicate titles, pass 1-based heading_occurrence with heading_level and the exact expected_hash; the ordinal follows document order for those hashed bytes. Do not use chunk_id.

Input Schema

NameRequiredDescriptionDefault
headingYes
rel_pathYes
request_idNo
new_contentYes
expected_hashNo
heading_levelNo
heading_occurrenceNo

Output Schema

NameRequiredDescriptionDefault
indexedYes
patchedNo
rel_pathNo
replayedNo
committedNo
content_hashYes
operation_idNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.1.17
    • addedOutput schema / description
      Added value: +"Successful ``patch_note_section`` payload."
    • removedOutput schema / properties / committed / default
      Removed value: -null
    • removedOutput schema / properties / operation_id / default
      Removed value: -null
    • removedOutput schema / properties / patched / default
      Removed value: -null
    • removedOutput schema / properties / rel_path / default
      Removed value: -null
    • removedOutput schema / properties / replayed / default
      Removed value: -null
  2. 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/PatchedSectionOutput"
    • addedOutput schema / properties / patched / anyOf
      Added value: +[
      +  {
      +    "$ref": "#/$defs/PatchedSectionOutput"
      +  },
      +  {
      +    "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"
      +]
  3. Changed2 schema fields changedv0.1.3
    • addedInput schema / properties / heading_occurrence
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Heading Occurrence"
      +}
    • addedOutput schema / $defs / PatchedSectionOutput / properties / heading_occurrence
      Added value: +{
      +  "title": "Heading Occurrence",
      +  "type": "integer"
      +}
  4. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the destructiveHint/idempotentHint annotations: it discloses atomic writes, exact prior-history storage, preservation of the heading line and non-target sections, and enumerated refusal conditions with error codes (section_has_subsections, section_structure_changed, open code fence/HTML block). This is exactly the behavioral detail an agent needs before a destructive in-place rewrite.

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?

Front-loads the purpose in the first sentence, then layers constraints. Every sentence carries information, but the duplicate-title and refusal clauses form a dense wall that could be split for scannability.

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?

For a 7-parameter destructive mutation with an output schema present (so return values need not be explained), the description covers concurrency control, atomicity, failure modes and duplicate-title disambiguation. Nothing critical for a correct call 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 description coverage is 0%, so the description must carry the load, and it explains the non-obvious parameters well: expected_hash as CAS, heading_occurrence as 1-based document-order ordinal for duplicate titles alongside heading_level, and an explicit negative for chunk_id. It does not describe rel_path, new_content or request_id, so coverage is strong but not complete.

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 scope: rewrite an existing section in place under one Markdown heading, only when the topic already has a note. This clearly separates it from rename_note_section, delete_note_section, move_note_section and patch_note_preamble in the sibling list.

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 says when to use it (outdated section, note already exists) and when not: sections containing subsections must be patched at the subsection level or deleted first, and it warns 'Do not use chunk_id.' It routes the agent to the correct alternative behavior in the failure cases.

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