Skip to main content
Glama

Patch note section

patch_note_section
Destructive

Update an existing Markdown section without affecting other headings, using expected hash for safe in-place replacement and rejecting changes that break structure.

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

TableJSON Schema
NameRequiredDescriptionDefault
headingYes
rel_pathYes
request_idNo
new_contentYes
expected_hashNo
heading_levelNo
heading_occurrenceNo

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/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"
      +]
  2. 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"
      +}
  3. First observedv0.1.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations state destructiveHint=true and readOnlyHint=false, meaning it's a write operation. The description adds context beyond that: it preserves heading line and non-target sections, stores exact prior history, writes atomically, and refuses on structural changes. This covers key behaviors like CAS (expected_hash), which is not in annotations. Minor gap: doesn't specify if changes are reversible via revert_note, but atomic write and history mention are sufficient.

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 dense but focused, with the core purpose and key constraints in the first two sentences. Every sentence adds value: CAS, preservation, atomicity, error conditions, and disambiguation. No filler or repetition.

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 tool's complexity (7 params, duplicate titles, CAS, structural checks), the description covers the essential usage paths: how to handle regular sections, subsections, duplicate headings, and security constraints. It provides action for common errors (patch subsection or delete first). Output schema exists, so return format isn't needed. The reference to error codes (section_has_subsections, section_structure_changed) is enough for agents to recover.

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 that expected_hash is for CAS, heading_occurrence is 1-based for duplicate titles, heading_level is used with it, and chunk_id is explicitly disallowed. It also clarifies new_content restrictions (no open code fences). It doesn't detail rel_path or request_id, but these are standard and inferable from context.

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 clearly states the tool rewrites an outdated section under an existing heading, with the action 'rewrite' and the resource 'note section'. It distinguishes itself from siblings like patch_note_preamble and delete_note_section by specifying it targets an existing heading and preserves other sections, adding uniqueness beyond the name.

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?

It explicitly states when to use: when a topic already has a note and needs a section rewrite. It provides exclusions: do not use for subsections (patch them instead), do not use chunk_id, and implicitly for delete (use delete_note_section). The refusal conditions (has subsections, leaves code fence open) serve as clear guidance against misuse, and alternatives like delete- or move-section are implied by error codes.

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