Skip to main content
Glama

cgis_audit_reachability

Find IDOR/authz gaps: list route handlers or functions that never reach a required ownership check, including via Depends(), then return uncovered gaps as JSON.

Instructions

Reachability/authorization audit — which sources never reach a checkpoint.

The headline use is **IDOR/authz coverage**: list every route handler that does
NOT transitively reach an ownership check. Reachability follows behavioral edges
(CALLS *and* FastAPI ``Depends()`` DEPENDS_ON), so a guard wired via DI counts.

Select sources with ``from_type`` (the ``ROUTE_HANDLER`` role — FastAPI handlers on
a router built in the same module — or a NodeType like ``FUNCTION``) and/or
``from_prefix`` (FQN prefix) — at least
one is required. Returns JSON ``{target, covered, gaps}`` where each gap carries
``fqn``/``file``/``line``. Generalizes to validators, event tracking, or
service-layer-boundary rules by pointing ``target`` at the required node.

A selection that matches no source returns a ❌ message, not an empty
``{covered: [], gaps: []}`` that would read as a passing audit (#467).

Input Schema

NameRequiredDescriptionDefault
depthNoMaximum reachability depth; a longer path is reported as a gap.
targetYesFQN of the checkpoint every source must reach, e.g. an ownership check. A unique dot-boundary suffix also resolves.
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
from_typeNoNodeType or role of the sources to audit (any case): ROUTE_HANDLER selects FastAPI handlers on a router built in the same module; a structural type such as FUNCTION selects by type. Give this, from_prefix, or both.
from_prefixNoOnly audit sources at or under this FQN prefix, matched on whole dot-segments. A selection matching no source is an error naming the whole-segment prefixes it may have meant. Combined with from_type when both are given.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.21.13
    • changedInput schema / properties / from_type / description
      Previous value: -"NodeType of the sources to audit, e.g. ROUTE_HANDLER, API_ENDPOINT or FUNCTION (any case). Give this, from_prefix, or both."New value: +"NodeType or role of the sources to audit (any case): ROUTE_HANDLER selects FastAPI handlers on a router built in the same module; a structural type such as FUNCTION selects by type. Give this, from_prefix, or both."
  2. Changed1 schema field changedv0.21.4
    • changedInput schema / properties / from_prefix / description
      Previous value: -"Only audit sources at or under this FQN prefix, matched on whole dot-segments — a partial segment selects nothing and returns an empty audit, not a clean one. Combined with from_type when both are given."New value: +"Only audit sources at or under this FQN prefix, matched on whole dot-segments. A selection matching no source is an error naming the whole-segment prefixes it may have meant. Combined with from_type when both are given."
  3. Changed5 schema fields changedv0.21.1
    • addedInput schema / properties / db_path / description
      Added value: +"SQLite graph built by cgis_ingest. A relative path resolves against the MCP server's working directory, not the agent's — prefer an absolute path."
    • addedInput schema / properties / depth / description
      Added value: +"Maximum reachability depth; a longer path is reported as a gap."
    • addedInput schema / properties / from_prefix / description
      Added value: +"Only audit sources at or under this FQN prefix, matched on whole dot-segments — a partial segment selects nothing and returns an empty audit, not a clean one. Combined with from_type when both are given."
    • addedInput schema / properties / from_type / description
      Added value: +"NodeType of the sources to audit, e.g. ROUTE_HANDLER, API_ENDPOINT or FUNCTION (any case). Give this, from_prefix, or both."
    • addedInput schema / properties / target / description
      Added value: +"FQN of the checkpoint every source must reach, e.g. an ownership check. A unique dot-boundary suffix also resolves."
  4. First observedv0.21.0

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 that reachability follows CALLS *and* FastAPI Depends() DEPENDS_ON edges, that depth overrun is reported as a gap, the exact JSON shape ({target, covered, gaps}), and the non-obvious behavior that an empty selection returns a ❌ message rather than a misleading empty-but-passing result. These are genuine behavioral traits beyond the schema.

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 headline constraint is front-loaded and the paragraphs are tightly scoped to selection, edge semantics, and error behavior. It is on the longer side with some markdown emphasis, but each block earns its place.

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?

For a 5-param audit tool with an output schema but zero annotations, the description covers the missing pieces: graph edge semantics, selection requirements, depth behavior, and the failure case. An agent can call this correctly without opening anything else.

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?

Schema coverage is 100%, so 3 is the baseline. The description adds real value on top: it imposes the 'at least one of from_type/from_prefix is required' constraint that the schema (which lists only target as required) does not capture, and explains the ROUTE_HANDLER role semantics and whole-dot-segment prefix matching.

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 first line states a specific verb and resource — 'Reachability/authorization audit — which sources never reach a checkpoint' — and immediately narrows to the flagship use case (IDOR/authz coverage). It is clearly distinguishable from siblings like cgis_trace_flow and cgis_analyze_impact because it audits coverage gaps rather than tracing a flow or impact.

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 gives a clear when-to-use anchor ('the headline use is IDOR/authz coverage: list every route handler that does NOT transitively reach an ownership check') and explains how to repurpose it for validators, event tracking, or service-layer boundaries. It does not name sibling tools to route against, so it stops short of explicit alternatives.

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