Skip to main content
Glama

Generate patch

generate_patch
Read-only

Convert concrete file edits into a guaranteed-valid unified diff for apply_patch. Omit edits to receive a generation brief with file context and edit format.

Instructions

Turn concrete edits into a guaranteed-valid unified diff that apply_patch can consume. If edits is omitted, returns a generation brief (relevant file contents + the exact edit format to use) so you can produce the edits. Does not write to disk. Read-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
planNoOptional plan text for context.
editsNoConcrete edits to turn into a unified diff. Omit to get a generation brief instead.
risksNoKnown risks of this patch.
confidenceNoYour confidence in these edits.
projectPathYesAbsolute path to the project root.
relevantFilesNoFiles to include as context when no edits are supplied yet.
taskDescriptionYesWhat the patch should accomplish.
Behavior5/5

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

Beyond the readOnlyHint annotation, the description explicitly states 'Does not write to disk' and 'Read-only,' reinforcing the safety profile. It also discloses the conditional behavior (returning a brief when `edits` is omitted) and the 'guaranteed-valid' promise, which add substantial behavioral context beyond the annotation.

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 three sentences, each earning its place: the core action, the conditional alternative, and the side-effect statement. It is front-loaded with the primary purpose and contains zero filler.

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 the tool's dual-mode behavior and lack of an output schema, the description covers both return modes and the read-only safety aspect. It doesn't detail the exact structure of diffs or briefs, but that is reasonable for a description. Some metadata parameters (`plan`, `risks`, `confidence`, `relevantFiles`) are left to the schema, which is acceptable given the schema's completeness.

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?

The schema covers all 7 parameters with descriptions (100% coverage), so the baseline is 3. The description adds meaningful semantics for the `edits` parameter by clarifying its role and the consequences of omitting it (returns a brief instead of a diff). Other parameters rely on the schema, which is sufficient.

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 that the tool converts concrete `edits` into a unified diff that `apply_patch` can consume, and also explains the alternative mode where omitting `edits` returns a generation brief. This distinguishes it from siblings like `apply_patch` (which applies) and `create_change_plan` (which plans).

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?

The description names `apply_patch` as the consumer, implying a generate-then-apply workflow, and explains when to omit `edits` to get a generation brief. It doesn't explicitly say 'use apply_patch instead when you want to apply changes,' but the statement 'Does not write to disk' signals that this tool is not for applying changes. This provides clear context but lacks an explicit when-not alternative.

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/remimenguy/mcp-flow'

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