Skip to main content
Glama

cgis_diff_check

Check a git diff against a code graph before review or merge to find subclasses, callers, and data-key dependants affected by changed or removed symbols.

Instructions

What else depends on what a diff changed: subclasses, callers and data keys.

Call this before review or merge. It reads the lines ``base..head`` changed,
finds the graph symbols they fall in (and symbols the diff removed, read from
the base text), and lists the classes that extend a changed class and the
functions that call a changed or removed function. For each data key the
changed lines read, write or declare (``doc["avatar"]``, a mapping field) it
lists the key's other readers, writers and declarers, reads of a dotted path
a mapping does not declare, and reads of a declaration the diff removed;
common keys (``id``, ``name``, or used in many files) are left out. Key items
need a graph ingested with data keys on (``cgis_ingest(data_keys=True)`` or
``cgis ingest --data-keys``); on a graph without them the answer says so and
lists subclasses and callers only. Sites in test files are counted, not
listed. An empty list means no static dependants were found, not that the
change is safe: dispatch the graph cannot see is not covered. How to read
the list: caller and subclass items are leads to read; data-key items are
noisy — measured on one application (owner-api), about a quarter of listed
items were worth a look (docs/lab-notes/2026-10-19-data-key-diff-check.md).
Before judging a code site that reads or writes a key unaffected, read its
callers (cgis_analyze_impact): they decide what values reach it.

Input Schema

NameRequiredDescriptionDefault
capNoItems listed; the rest are only counted.
baseNoBase revision of the diff, e.g. origin/main or a sha.origin/main
headNoHead revision of the diff.HEAD
prefixNoThe path of the ingested directory inside the repository (e.g. 'src' after cgis_ingest of ./src); empty when the repository root was ingested. Left out, it comes from the root the graph recorded at ingest.
db_pathNoSQLite graph built by cgis_ingest. A relative path resolves against the MCP server's working directory, not the agent's — prefer an absolute path.graph.db
repo_pathYesGit repository holding the diff; prefer an absolute path.
output_formatNo'text' or 'json'.text

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.21.15

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses the data-key prerequisite (graph ingested with data_keys=True), the degraded behavior when keys are absent, that test-file sites are counted not listed, that common keys are omitted, and a measured precision caveat (~a quarter of data-key items worth a look). These are exactly the operational traits an agent needs before trusting output.

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 core idea is front-loaded in the first sentence, and most sentences carry distinct operational information. It is dense and long with some run-on clauses, but there is little that could be dropped without losing a real constraint.

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?

An output schema exists, so return values need not be explained, and the description still covers prerequisites, edge cases (empty list, missing data keys), scope limits (test files, common keys) and interpretation guidance. Nothing an agent needs to call or trust the tool is missing.

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%, so the schema already documents cap, base, head, prefix, db_path and output_format, making 3 the baseline. The description adds little parameter-level syntax beyond mentioning the base text is read for removed symbols, so it does not rise above baseline.

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 states a specific verb+resource: it lists what else depends on lines a diff changed (subclasses, callers, data keys). It clearly distinguishes itself from siblings by naming cgis_analyze_impact as the follow-up for judging a site and cgis_ingest for building the required graph.

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?

It explicitly says when to call it ('before review or merge') and when its output is insufficient ('an empty list means no static dependants were found, not that the change is safe'). It routes the agent to cgis_analyze_impact for the decision a caller makes, giving both when-to-use and an alternative.

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