Skip to main content
Glama

sonarqube_project_metrics

Read-onlyIdempotent

Fetch code quality measures (coverage, bugs, etc.) for a single SonarQube project. Supports branch or pull request filtering and returns metrics keyed by name for quick lookup.

Instructions

Fetch measures for a single project.

Wraps /api/measures/component. Returns both the raw list (measures) and a dict keyed by metric name (measures_by_metric) — handy when the agent wants to look up a single value quickly.

To find valid metric keys, call with the default set first — SonarQube ignores unknown metric keys and returns what it knows.

Examples: - Use when: "What's the code coverage of einvy:aut_einvy?" → project_key='einvy:aut_einvy', default metric_keys. - Use when: "Coverage on the feature/new-auth branch?" → add branch='feature/new-auth'. - Use when: "Metrics on PR #42?" → pull_request='42'. - Don't use when: You want to compare many projects — use sonarqube_worst_metrics which bulk-fetches and ranks. - Don't use when: You want the Quality Gate's per-condition breakdown — that's sonarqube_quality_gate_status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_keyYesSonarQube project key (e.g. 'einvy:aut_einvy').
metric_keysNoMetric keys to fetch (e.g. ['bugs', 'coverage', 'sqale_rating']). If omitted, a sensible default set is used: bugs, code_smells, coverage, vulnerabilities, ratings, ncloc, tests, alert_status.
branchNoBranch name to query (e.g. 'feature/xyz'). If omitted, the project's main branch is used. Mutually exclusive with pull_request.
pull_requestNoPull request identifier (e.g. '42'). If set, fetches measures from the PR decoration analysis. Mutually exclusive with branch.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_keyYes
project_nameYes
qualifierYes
measures_countYes
measuresYes
measures_by_metricYes
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true. Description adds value by detailing return format (raw list and dict) and behavior on unknown metric keys. Some redundancy with schema mutual exclusion info.

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?

Description is well-structured: purpose, wrapper, return format, advice, examples. Front-loaded and efficient, though slightly verbose with redundant listing of default metrics.

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?

Given annotations, output schema, and 100% schema coverage, the description completes the picture by covering purpose, usage, behavior, and examples. No gaps identified.

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 coverage is 100% with detailed descriptions. The description adds minor context (default metric set) already present in schema. Does not significantly enhance parameter understanding beyond schema.

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?

Clearly states the tool fetches measures for a single project, wraps SonarQube API, and distinguishes from siblings by specifying single project scope. Examples further clarify the purpose.

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?

Explicitly provides when-to-use and when-not-to-use with specific sibling tool names (sonarqube_worst_metrics, sonarqube_quality_gate_status). Also advises on metric key discovery.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mshegolev/sonarqube-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server