Skip to main content
Glama
igorolv

sonar-mcp-server

listComponents

listComponents
Read-onlyIdempotent

Search or browse a project's analysed component tree to get keys, paths, names, qualifiers, and languages. Use qualifiers=DIR for directory discovery; scope with branch or pull request.

Instructions

Browse or search a project's analysed component tree. Use returned path values as componentPathPrefix; Sonar paths may differ from repository paths. Returns component key, path, name, qualifier, and language. Use qualifiers=DIR to discover directories. 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.
queryNoComponent name/path substring
branchNoBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`.
offsetNoOffset; default 0.
projectKeyNoProject key; omit only if the server has a default. Discover with `listProjects`.
qualifiersNoComma-separated component types, e.g. `DIR,FIL`; use `DIR` for path discovery.
pullRequestNoPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsNoComponents returned by SonarQube.
limitNoEffective page size.
totalNoTotal matching component count reported by SonarQube.
offsetNoRequested offset.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already convey read-only, idempotent, and non-destructive behavior, and the description adds genuinely non-obvious context: Sonar paths may differ from repository paths, returned paths should be reused as `componentPathPrefix`, and omitted branch/pullRequest arguments fall back to the configured default (usually main). It also summarizes the returned fields, which remains useful even with an output schema present.

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?

Six compact sentences are arranged purpose-first, then usage, then branch/PR scoping. Each sentence contributes actionable information, and nothing is repeated unnecessarily.

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 read-only list/browse tool with a rich input schema, an output schema, and safety annotations, the description covers the non-obvious aspects an agent needs: path/prefix semantics, directory discovery, and default branch behavior. No critical information is missing.

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?

With 100% schema description coverage, the baseline is 3; the description adds meaningful extra semantics for `qualifiers` (use `DIR` for path discovery) and for `branch`/`pullRequest` default behavior. It does not exhaustively enrich every parameter, but it raises the definition above the schema-only baseline.

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 action ('Browse or search') and a specific resource ('a project's analysed component tree'), clearly distinguishing this from sibling tools that operate on projects, issues, hotspots, or rules. The additional note about returned path values being usable as `componentPathPrefix` clarifies its role in the wider API workflow.

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?

Provides explicit usage instructions: use `qualifiers=DIR` to discover directories and pass the matching ref for non-main or PR work. It names `listProjectBranches` and `listProjectPullRequests` as the alternatives for discovering refs, giving concrete when-to-use guidance.

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