Skip to main content
Glama

Patch Document

dokument_patch
Destructive

TEIL-ERSETZUNG eines Dokuments statt Voll-PUT (POST /dokumente/{slug}/patch, CMP-29).

`ersetzungen` ist eine Liste von `{alt, neu, anzahl}`: `alt` muss GENAU `anzahl` Mal im Text stehen (Standard 1), jedes Vorkommen wird durch `neu` ersetzt. Die Ersetzungen gelten in der Reihenfolge der Liste, jede gegen den Stand nach den vorigen. `erwartete_version`
ist PFLICHT: die Version, auf der du aufbaust (aus `dokument_get`). Der Kern ersetzt EXAKT in einer Transaktion und bricht ab, OHNE etwas zu schreiben, wenn die Trefferzahl einer Ersetzung nicht stimmt (409 `trefferzahl`, mit `ersetzung`, `gefunden`, `erwartet`) oder die Version
abweicht (409 `version_geaendert`, mit `aktuelle_version`, `geaendert_am`, `urheber`). Kein Byte ausserhalb der Treffer aendert sich.

Geschrieben wird ueber DENSELBEN Weg wie `dokument_put`: eine neue Version, die alte wird abgelegt, die Spur steht beim Autor -- kein zweiter Schreibweg. `notiz` (hoechstens 300 Zeichen) steht in `dokument_versionen`. Ein beendetes Dokument wird nicht geaendert (409).
In einem verschluesselten Projekt ersetzt der Kern nur, wenn er den Text lesen darf; sonst antwortet er mit dem Fehler des Schluesseldienstes und schreibt nichts. Antwort: das Dokument mit der neuen `version`.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "slug": "<slug>",
      "ersetzungen": "<ersetzungen>",
      "erwartete_version": "<erwartete_version>"
    },
    "name": "dokument_patch"
  }
}

Input Schema

NameRequiredDescriptionDefault
chatNoChat token returned by `persona_waehlen`. With it, the call acts as the persona of that chat; without it, as the unbound connection (Chat-Token aus `persona_waehlen`: mit ihm handelt der Aufruf als die Persona dieses Chats, ohne ihn als die ungebundene Verbindung).
slugYes
notizNo
ersetzungenYes
persona_slugNo
erwartete_versionYes

Output Schema

NameRequiredDescriptionDefault

No arguments

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?

Beyond the destructiveHint=true annotation, the description discloses atomic all-or-nothing semantics, the exact 409 failure payloads (`trefferzahl` with `ersetzung`/`gefunden`/`erwartet`, `version_geaendert` with `aktuelle_version`/`geaendert_am`/`urheber`), that no bytes outside matches change, that a new version is written and the old archived via the same path as dokument_put, that ended documents are rejected, and that encrypted projects fail without writing if the key service denies read.

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-loaded with the operation and its contrast, then parameters, then failure modes, then write semantics. It is long but the density of distinct facts justifies most of it; a few clauses ("kein zweiter Schreibweg") restate the same guarantee.

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 destructive, atomic, version-checked mutation with low schema coverage, the description covers preconditions, conflict behavior, write path, and a new version in the response. An output schema exists, so further return-value detail is unnecessary.

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 only 17%, so the description must compensate, and it largely does: it defines the `{alt, neu, anzahl}` shape, the default anzahl of 1, the exact-count matching rule, the list-order evaluation against prior state, the mandatory `erwartete_version` with its source, and the 300-character cap on `notiz`. It leaves `slug`, `persona_slug`, and the acting-context role of `chat` unaddressed beyond the schema.

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 first sentence names a specific operation (partial replacement via POST /dokumente/{slug}/patch) and explicitly contrasts it with the full-PUT sibling: "TEIL-ERSETZUNG eines Dokuments statt Voll-PUT". An agent can distinguish this from dokument_put without opening either 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?

It states the selecting condition (use this for targeted replacements instead of a full PUT) and names the prerequisite source for the mandatory version: "erwartete_version ist PFLICHT: die Version, auf der du aufbaust (aus dokument_get)". The alternative path (dokument_put) is explicitly identified.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.