Skip to main content
Glama

diff

Stitch edit rows into a per-file chronological diff, render unified format, and redact secrets on demand.

Instructions

Stitch edit rows into a per-file chronological diff — the diff verb.

Reproduces the synthesis of session_diff: given the edit events of a session (query(type="tool_call(edit)", session=…) — plus write / shell-redirect events), group them per file in chronological order and render a stitched, readable diff. Bodies are fetched on demand (via each event's stored message_index), never inlined on the row.

Args: rows: Edit-event dicts (query output). Each must carry an id and a refs list with a file entry; unresolvable rows skip. per_file: Group by file (the only mode today). format: "unified" (the only rendering today). redact: When True (default) secrets in the stitched output are masked as [REDACTED_<TYPE>] and the result carries a redactions type→count dict when any replacement happened; False returns raw content.

Returns: {"files": [{"file", "edits", "diff", "hunks"}], "count", "caveats"} (same shape + caveats as session_diff, size-bounded the same way: capped fields named in the per-file truncated_fields, byte budget → output_truncated) or the standard {"error": ..., "message": ...} dict on an unsupported format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYes
formatNounified
redactNo
per_fileNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations provided, the description carries the full burden and does so thoroughly. It discloses that bodies are fetched on demand via message_index, unresolvable rows are skipped, and redaction behavior includes masking as [REDACTED_<TYPE>] and returning a redactions dict. It also describes return structure, truncation, and error handling, offering deep insight into the tool's behavior beyond mere input/output.

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 well-structured with a summary sentence, followed by detailed argument explanations and a clear Returns section. While somewhat long, every sentence provides essential information, and the front-loaded first sentence gives the core purpose immediately. It avoids fluff and earns its length.

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 and the absence of annotations, the description covers all necessary aspects: input requirements, processing behavior, output shape, edge cases (unresolvable rows, unsupported format), and constraints (size-bounded, truncated_fields). It also references session_diff for known caveats, making it complete for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides only titles with no descriptions (0% coverage), but the description explains each parameter in detail: rows must contain id and refs with a file entry, per_file is the only mode, format supports only 'unified', and redact controls secret masking. This fully compensates for the schema's lack of documentation.

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 opens with a specific verb and resource: 'Stitch edit rows into a per-file chronological diff — the diff verb.' It clearly distinguishes from session_diff by explaining that it reproduces the synthesis from provided edit-event rows rather than querying directly. The purpose is unambiguous and aligns with the tool name.

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?

It provides clear context: use this when you have edit-event rows from a query and want a per-file diff, as opposed to session_diff which likely queries the session directly. It also notes that per_file and format are the only modes today, implying no alternatives within the tool. However, it does not explicitly list alternative tools or state when not to use it, though the contrast with session_diff gives implicit guidance.

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/pro-target/ai-r'

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