Skip to main content
Glama

semgrep_scan_diff

Scan only the lines changed between two git revisions for security and bug patterns, returning exact line numbers and source snippets for actionable code review.

Instructions

Run deterministic static analysis (Semgrep) restricted to the lines changed between two revisions, and return findings with exact line numbers plus the matched source snippet.

Prefer this over semgrep_scan when reviewing a pull request. OpenCodeReview reviews a diff and only permits comments on changed lines, so a finding on an untouched line cannot be reported — this tool does not return those at all, which keeps the result short and entirely actionable.

base and head are any git revisions (abc123, main, HEAD~1). Pass paths to narrow the scan to specific changed files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseYes
headYes
pathsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden. It discloses determinism, diff-scoping, exclusion of findings on untouched lines, and the output format. It does not explicitly state read-only/no side-effect behavior, but 'static analysis' and 'scan' strongly imply it, so the gap is minor.

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?

The description is three tightly packed sentences: the core action, the key usage guidance with rationale, and parameter clarification. Every sentence earns its place, with the most important distinguishing detail front-loaded.

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 3-parameter tool with an output schema present, the description covers purpose, selection criteria, parameter semantics, and business context. Nothing needed for an agent to call and interpret this tool correctly is left unaddressed, and the output schema handles return-value details.

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

Parameters5/5

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

Schema description coverage is 0%, yet the description compensates fully: it explains that base and head are 'any git revisions (`abc123`, `main`, `HEAD~1`)' and that paths is used 'to narrow the scan to specific changed files.' This adds meaning beyond the bare schema titles.

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 clearly states the specific action ('Run deterministic static analysis (Semgrep)'), the resource ('restricted to the lines changed between two revisions'), and the output shape ('findings with exact line numbers plus the matched source snippet'). It also names the sibling tool it is not, semgrep_scan, making the distinction explicit.

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?

The description directly instructs when to use this tool: 'Prefer this over semgrep_scan when reviewing a pull request.' It explains why with the OpenCodeReview diff-comment constraint and contrasts the tool's behavior ('does not return those at all'), leaving no ambiguity about selection.

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

Deploy Server

Other Tools