Skip to main content
Glama
igorolv

sonar-mcp-server

listHotspots

listHotspots
Read-onlyIdempotent

List security hotspots awaiting human review, with optional branch, pull request, path, and status filters. Get rule, vulnerability probability, message, and file location for each hotspot.

Instructions

List project Security Hotspots that need human review. Defaults to TO_REVIEW; supports path and ref filters. Returns rule/category, vulnerability probability, message, and file location. Scope explicitly: omitting both branch and pullRequest uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with listProjectBranches / listProjectPullRequests.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoPage size; server default if omitted.
branchNoBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`.
offsetNoOffset; default 0.
statusNo`TO_REVIEW` or `REVIEWED`; default `TO_REVIEW`
projectKeyNoProject key; omit only if the server has a default. Discover with `listProjects`.
pullRequestNoPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.
componentPathPrefixNoSonar `componentPath` prefix relative to the project root; an exact file path is also allowed. Uses directory boundaries, so `src` does not match `srcExtra`. For Java/Kotlin packages use slashes. Sonar paths may differ from repository paths; use `listComponents` instead of guessing. If `pathPrefixTruncated=true`, narrow the prefix.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsNoHotspots in this page.
limitNoMaximum number of items per page.
totalNoTotal number of hotspots matching the query across all pages.
offsetNoZero-based offset of this page within the full result set.
pathPrefixTruncatedNoTrue when componentPathPrefix was supplied and the underlying scan hit the configured maximum hotspot count before exhausting Sonar. Tighten the prefix to see the rest.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds valuable behavioral context by disclosing that omitting both branch and pullRequest uses the configured default (usually main) and by stating what fields are returned. This goes beyond the annotations and helps an agent predict behavior.

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 compact and front-loaded: purpose, default, supported filters, return contents, and ref-scoping guidance all fit into four efficient sentences. Every sentence carries useful information and none of it merely restates the tool name or title.

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 an output schema present, the description does not need to detail return structure, and the input schema already documents all seven parameters. The description covers default behavior, filtering, return fields, and the important branch/pullRequest scope pitfall. This is complete enough for an agent to select and invoke the tool correctly.

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 the baseline is 3, but the description adds meaningful cross-parameter guidance: it ties branch/pullRequest omission to the default ref and explicitly says to pass a ref for non-main or PR work. It also points to the right discovery tools for those refs, which is more than the individual schema descriptions provide.

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 opens with a specific verb and resource: 'List project Security Hotspots that need human review.' It clearly distinguishes from siblings like getHotspot (single item) and listIssues (different resource type) by naming the hotspot domain and the 'TO_REVIEW' default. The scope is precise enough that an agent knows exactly what this tool returns.

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?

The description gives clear context: it defaults to TO_REVIEW and supports path and ref filters, and it explains how to handle non-main branches or PRs by passing the matching ref explicitly and discovering it via listProjectBranches/listProjectPullRequests. It does not explicitly contrast with listIssues or getHotspot, but the resource distinction is strongly implied by the wording.

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