Skip to main content
Glama

session_diff

Reconstruct agent changes from a session without git, generating chronological per-file diffs and stitched edit history.

Instructions

Reconstruct what the agent changed in one session — without git.

Stitches the session's own edit records (Edit/MultiEdit old_stringnew_string, Write content, codex shell-exec redirections) into a per-file, chronological diff. Returns {"files": [...], "count": N, "caveats": [...]}; each file carries its ordered edits (timestamp + intent + hunks) and a stitched, readable diff.

caveats always carries two honest blind spots: (1) this is a diff of the agent's actions, not the git outcome — manual edits / partial commits / merges are invisible; (2) RISK-3 — inherits the find_file_edits shell-redirect gap (tee / sed -i / cp / mv / heredoc writes are not detected and are silently skipped).

redact=True (default) masks secrets in the emitted diff/hunks/ intents as [REDACTED_<TYPE>] and adds a redactions type→count dict when any replacement happened; redact=False returns raw.

Size-bounded output (mirrors find_file_edits): over-long intent / hunk bodies / per-file diff text are cut with a …[truncated] marker and named in the per-file truncated_fields (indexed paths), and whole-file emission stops at a total byte budget (output_truncated; count keeps the true total). The full edit body stays reachable on demand via get_body / read_session.

Thin wrapper over :func:ai_r.session_diff.session_diff that translates the core ValueError contract into the {"error": "invalid_argument", "message": str(exc)} shape the MCP client expects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo
agentYes
redactNo
session_uuidYes

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 fully carries the behavioral disclosure burden. It explicitly states two blind spots (actions vs. git outcome, and shell-redirect gap vulnerability), describes redaction behavior with redact=True/False, explains truncation and byte budgets (output_truncated, truncated_fields), and details error-shape translation. This is exceptionally transparent for a tool with zero annotations.

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?

The description is front-loaded with the core purpose and clearly structured across paragraphs. It contains a moderate amount of detail—caveats, redaction, truncation, error handling—but every sentence contributes useful information. It is not overly terse nor bloated, though it is longer than strictly necessary.

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?

Despite an output schema being present, the description goes beyond and explains the return shape, caveats, truncation, redaction, and error handling. It is comprehensive for a complex tool. The only notable omission is the meaning of 'path', but the overall context and references to sibling tools make the tool's behavior clear enough for selection.

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

Parameters2/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 for all four parameters. It only explicitly explains redact (default true, masks secrets). session_uuid and agent are inferable from names but not described, and path is not addressed at all despite being an optional parameter. The description does not provide semantics for a quarter of the parameters, leaving a significant gap.

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+resource+scope: 'Reconstruct *what the agent changed* in one session — without git.' It clearly differentiates from siblings by mentioning find_file_edits, get_body, and read_session, and by emphasizing it builds a per-file chronological diff from edit records, not a git diff.

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 provides clear context for when this tool is appropriate: when you need a diff of the agent's actions without git, and it explicitly warns that manual edits, partial commits, and merges are invisible. It names alternatives for getting full edit bodies (get_body/read_session) and references find_file_edits for shell-redirect gaps, but it does not explicitly say 'use this instead of X' in a comparative form.

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