Skip to main content
Glama

trim_diff

Read-only

Shrinks a git unified diff for reading: collapses lockfile, generated-file, and whitespace-only changes to one line each and cuts surrounding context. The output is not intended for applying.

Instructions

Shrink a git unified diff: lockfiles, generated files and whitespace-only changes collapse to one line each, and context around changes is cut. The result is for reading, not for applying.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "trim_diff"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoFile to read, inside the server's root folder. Preferred way to pass input.
textNoThe text itself. Only for small inputs: large text costs tokens to send.
commandNoA command to run and trim (no shell). Only works if started with --allow-run.
contextNoUnchanged lines kept around each change.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is covered by structured data. The description adds real value on top by disclosing that the transform is lossy (content is collapsed to one line, context removed) and that the output is not appliable — a behavioral consequence an agent would not otherwise know.

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?

Two sentences, no filler, and the core action and its scope lead the text before the important applicability caveat. Every clause carries information an agent needs.

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?

With an output schema present, return values need no explanation, and the four optional input parameters are fully described in the schema. The one thing left unstated is what happens when multiple input sources (path, text, command) are supplied or when none is, though the schema's 'Preferred way to pass input' note partially mitigates this.

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

Parameters3/5

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

Schema description coverage is 100%, and every parameter (path, text, command, context) is documented in the schema, so the baseline is 3. The phrase 'context around changes is cut' loosely connects to the context parameter but adds no syntax, default, or precedence information beyond what the schema already supplies.

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 names a specific verb ('Shrink') and a precise resource ('a git unified diff'), then clarifies the transformation: lockfiles, generated files, and whitespace-only changes collapse to one line, and surrounding context is cut. That resource specificity implicitly separates it from trim_log and trim_tests without needing to name them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The closing clause 'The result is for reading, not for applying' is a genuine when-not guideline, warning the agent not to treat output as a patch. However, there is no explicit statement of when to prefer this over expand or the other trim_* siblings — the agent must infer that it is for oversized diffs.

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