Skip to main content
Glama

Analyze changed files

statica_pre_analyze
Idempotent

Analyze only changed files to summarize defects by rule before reporting. Covers this run's scope, never uploads, and flags missing project connection with a guided bootstrap.

Instructions

Run STATIC on the files that changed since the last analysis and summarize defects by rule. Never uploads. For C/C++ only changed translation units run; Java, Kotlin, Python and C# are analyzed in full and the summary is narrowed to changed files. Counts cover this run's scope, not the project total - say so when reporting, and do not list defects file by file. reason=NO_CHANGES usually means the Stop hook already analyzed the edit; do not suggest a rebuild or upload for it. code=NEEDS_BOOTSTRAP means the project is not connected: offer to connect it (statica_get_guide topic=bootstrap) and start only after the user agrees. reason=BOOTSTRAP_IN_PROGRESS means a connection was started earlier: resume it per the guide, never start over.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "projectDir": "<projectDir>"
    },
    "name": "statica_pre_analyze"
  }
}

Input Schema

NameRequiredDescriptionDefault
forceNoRe-analyze even when nothing changed.
parallelNoAnalyzer parallelism. Omit for the default.
projectDirYesAbsolute path of the project directory being analyzed (usually the session's working directory).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the annotations (which only declare non-destructive, idempotent, non-uploading writes), the description discloses the per-language analysis model — C/C++ runs only changed translation units, while Java/Kotlin/Python/C# are analyzed in full but the summary is narrowed to changed files. That is non-obvious behavior that materially affects result interpretation, and the "counts cover this run's scope, not the project total" warning plus named reason/code outcomes add further transparency. No contradiction with the annotation set: readOnlyHint=false is consistent with a tool that persists analysis results locally without uploading.

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?

Front-loaded with the core action and scope, then progressively adds reporting rules and error-state handling, so an agent can stop reading early and still call it correctly. It is dense but nearly every sentence carries operational value; only the clustered reason=/code= clauses could be tightened into a compact list.

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?

With no output schema, the description carries the return-shape burden and does so: it explains the summary is by-rule defect counts scoped to this run, and names the reason and code fields with their meanings and required follow-up actions. Combined with annotations covering safety, an agent has everything needed to invoke it and to interpret the common non-success outcomes.

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 projectDir, force, and parallel are already documented in the schema, making 3 the baseline. The description adds no parameter-level meaning of its own — it never mentions force or parallel, nor does it explain how parallel interacts with run cost or how projectDir must relate to the session working directory.

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?

"Run STATIC on the files that changed since the last analysis and summarize defects by rule" names a specific verb (analyze), a specific resource (changed files), and the output shape (defects grouped by rule). "Never uploads" immediately separates it from the statica_upload sibling, so an agent can distinguish the two without opening a schema.

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?

Strong routing guidance for the edge states: reason=NO_CHANGES means don't suggest rebuild/upload, code=NEEDS_BOOTSTRAP means offer connection via statica_get_guide topic=bootstrap and wait for consent, reason=BOOTSTRAP_IN_PROGRESS means resume rather than restart. It also prescribes reporting behavior (state that counts are run-scoped, don't enumerate defects per file). What it lacks is a plain positive trigger sentence ("call this after editing files") and any mention of when force/parallel should be used instead of the defaults.

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