Skip to main content
Glama

find_hotspots

Read-onlyIdempotent

Ranks repository files by change frequency and code complexity to identify likely bug hotspots, helping you decide what to read or debug first.

Instructions

Rank files where bugs most likely hide: change frequency (churn) x code complexity.

Use after analyze_repo to decide where to look for bugs or what to read first. Churn = number of commits touching the file in the window (git log --numstat); complexity = approximate McCabe cyclomatic complexity per function via ast. Research basis: relative code churn predicts defect density (Nagappan & Ball, ICSE 2005), and churn combined with complexity pinpoints defect-prone "hotspots" (Tornhill, "Your Code as a Crime Scene", 2015). Test files are excluded.

Returns per file: rank, score (0..1), churn, lines_changed, complexity_total, complexity_max, the 3 most complex functions (name, line, complexity), and the git command used as evidence.

Args: repo: "owner/name" or a github.com URL. top: how many files to return (1-50). since: history window, e.g. "12 months", "6 weeks", or a date "2024-01-31".

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": {
      "repo": "<repo>"
    },
    "name": "find_hotspots"
  }
}

Input Schema

NameRequiredDescriptionDefault
topNo
repoYes
sinceNo12 months

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already cover readOnly/idempotent/non-destructive, and the description goes well beyond them: it defines churn as `git log --numstat` commit counts, complexity as AST-derived McCabe per function, discloses that test files are excluded, and even says the git command is returned as evidence. These are real behavioral traits an agent could not infer from annotations.

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?

Well front-loaded: purpose, then when-to-use, then method, then return shape, then args. The two literature citations are the weakest lines — mildly decorative — but they do justify why the score is trustworthy, so the cost is small.

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?

No output schema exists, yet the description enumerates the return fields (rank, score, churn, lines_changed, complexity_total, complexity_max, top-3 functions, git command) in detail. For a three-parameter analytical tool this is fully complete.

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%, so the description carries the full burden, and it does: repo accepts 'owner/name' or a github.com URL, top is bounded 1-50, and since accepts relative windows ('12 months', '6 weeks') or an absolute date ('2024-01-31'). That is meaning no schema field provides.

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?

States a specific verb and resource ('Rank files where bugs most likely hide') and immediately defines the ranking formula as churn x complexity. This is clearly distinct from analyze_repo and run_static_analysis, so an agent can tell what it produces without opening the 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?

Explicitly sequences the tool: 'Use after analyze_repo to decide where to look for bugs or what to read first.' That gives a clear prerequisite and a decision context. It stops short of naming when NOT to use it or contrasting with run_static_analysis, which is the only gap.

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