Skip to main content
Glama

patch_document

Apply a unified diff patch to an existing document to create a new version, avoiding full content resends and payload size limits.

Instructions

Apply a unified diff patch to an existing document, producing a new version.

Use instead of push_document when only part of the document changed — avoids sending the full content and works around tool-call payload size limits.

patch must be in unified diff format (output of difflib.unified_diff). base_version must match the current latest version; if not, returns PATCH_BASE_MISMATCH — call get_document to fetch latest and regenerate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
doc_idYes
base_versionYes
patchYes
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses patch format requirement, base version constraint, error return (PATCH_BASE_MISMATCH), and recommended follow-up. Lacks explicit mention of side effects (e.g., whether changes are persisted immediately), but 'producing a new version' implies non-destructive versioning.

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?

Three sentences with no fluff. First sentence states purpose, second gives usage comparison, third details format and error handling. Front-loaded with core information, each sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 4 required parameters, the description covers purpose, usage guidance, patch format, error case, and fallback. Could briefly mention what the tool returns (e.g., new version object) but overall quite complete.

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 has 0% description coverage. Description adds meaning for 'patch' (must be unified diff format) and 'base_version' (must match latest, otherwise error). Does not elaborate on 'project_id' or 'doc_id', but these are self-explanatory from context. Overall, compensates well for missing schema descriptions.

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?

Clearly states 'Apply a unified diff patch to an existing document, producing a new version' with specific verb (apply), resource (document), and outcome (new version). Also explicitly distinguishes from sibling push_document by noting when to use it.

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 'Use instead of push_document when only part of the document changed' and explains benefits (avoids full content, works around payload limits). Also describes error condition for base_version mismatch and remediation (call get_document).

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dugubuyan/agent-nexus'

If you have feedback or need assistance with the MCP directory API, please join our Discord server