> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-mcp-server/reference/tools.md).

# Tools

Reference for the SonarQube MCP Server tools, toolsets, and supported parameters.

This page lists the tools of the SonarQube MCP Server by toolset and shows how to limit the toolsets your agent can use. It's for developers who set up an agent with the SonarQube MCP Server.

## Enable specific toolsets

MCP clients load every enabled tool (its name, description, and input schema) into your agent's context in every conversation. Enabling fewer toolsets reduces context usage and the token cost of each session.

Set `SONARQUBE_TOOLSETS` to a comma-separated list of toolset keys, for example `issues,quality-gates`. The server then enables only those toolsets. The `projects` toolset is always enabled and does not need to be listed. If you do not set `SONARQUBE_TOOLSETS`, the server enables its default toolsets. For the default list and every available key, see the [Tool enablement](https://docs.sonarsource.com/sonarqube-mcp-server/reference/environment-variables.md#tool-enablement) section.

The server ignores keys it does not recognize and does not show an error. If a toolset's tools are missing, check the spelling of its key.

Where you set `SONARQUBE_TOOLSETS` depends on how you run the MCP server.

### Local server (Stdio)

Pass `SONARQUBE_TOOLSETS` as an environment variable on the MCP server process. With Docker:

```bash
docker run -i --init --pull=always --name sonarqube-mcp-server --rm \
  -e SONARQUBE_TOKEN="<YourSonarQubeUserToken>" \
  -e SONARQUBE_ORG="<YourSonarQubeOrganization>" \
  -e SONARQUBE_TOOLSETS="issues,quality-gates" \
  sonarsource/sonarqube-mcp
```

In your agent's MCP configuration file, add `"-e", "SONARQUBE_TOOLSETS"` to the Docker `args` and set the value in the `env` block:

```json
{
  "mcpServers": {
    "sonarqube": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "--init", "--pull=always", "-e", "SONARQUBE_TOKEN", "-e", "SONARQUBE_ORG", "-e", "SONARQUBE_TOOLSETS", "sonarsource/sonarqube-mcp"],
      "env": {
        "SONARQUBE_TOKEN": "<YourSonarQubeUserToken>",
        "SONARQUBE_ORG": "<YourSonarQubeOrganization>",
        "SONARQUBE_TOOLSETS": "issues,quality-gates"
      }
    }
  }
}
```

The server reads `SONARQUBE_TOOLSETS` once at startup. After you change the value, restart the MCP server process.

### SonarQube Cloud-hosted

Send `SONARQUBE_TOOLSETS` as an HTTP header in your agent's MCP configuration. This example uses a SonarQube user token. For the US region URL and OAuth sign-in, see the [Manual setup](https://docs.sonarsource.com/sonarqube-mcp-server/setup/sonarqube-cloud-hosted.md#manual-setup) and [Sign in with OAuth](https://docs.sonarsource.com/sonarqube-mcp-server/setup/sonarqube-cloud-hosted.md#sign-in-with-oauth) sections.

```json
"sonarqube": {
  "type": "http",
  "url": "https://api.sonarcloud.io/mcp",
  "headers": {
    "Authorization": "Bearer <YourSonarQubeUserToken>",
    "SONARQUBE_ORG": "<YourSonarQubeOrganization>",
    "SONARQUBE_TOOLSETS": "issues,quality-gates"
  }
}
```

The header replaces the default toolsets. With `issues,quality-gates`, the `security-hotspots` toolset is not loaded. For the toolset keys this server supports, see [Tool availability with SonarQube Cloud](https://docs.sonarsource.com/sonarqube-mcp-server/setup/sonarqube-cloud-hosted.md#tool-availability-with-sonarqube-cloud). The server reads the header with each request. No server restart is involved.

### Self-hosted server (Streamable HTTP)

Set `SONARQUBE_TOOLSETS` as an environment variable on the server, as in the [Local server (Stdio)](#local-server-stdio) example. Restart the server after you change the value. Each client can also send a `SONARQUBE_TOOLSETS` header with its requests. This example uses HTTPS, the recommended transport for production:

```json
{
  "mcpServers": {
    "sonarqube": {
      "type": "https",
      "url": "https://<YourSonarQubeMCPServer>:8443/mcp",
      "headers": {
        "Authorization": "Bearer <YourSonarQubeUserToken>",
        "SONARQUBE_TOOLSETS": "issues,quality-gates"
      }
    }
  }
}
```

The header can only narrow the toolsets the server already allows. It cannot add toolsets. For details, see the [Self-hosted setups](https://docs.sonarsource.com/sonarqube-mcp-server/setup/self-hosted.md) page.

### SonarQube Server-hosted

Set `SONARQUBE_TOOLSETS` as an environment variable on the MCP server, using the method for your installation: the `environment` block in Docker Compose, `-e` with `docker run`, `mcp.env` in your Helm values, or `export` (or `Environment=` in a systemd unit) for the ZIP install. Then restart the MCP server. Each client can also send a `SONARQUBE_TOOLSETS` header with its requests. SonarQube Server forwards the header to the MCP server, which applies it to each request and can only narrow the toolsets the MCP server allows. For the setup, see the [SonarQube Server-hosted](https://docs.sonarsource.com/sonarqube-mcp-server/setup/sonarqube-server-hosted.md) page.

### Apply the change

After you edit your agent's MCP configuration, restart the MCP server from your agent. If your agent has no command to restart an MCP server, restart the agent. A `SONARQUBE_TOOLSETS` value set on a self-hosted or SonarQube Server-hosted server needs a restart of that server, not of your agent.

## SonarQube Cloud organization

On SonarQube Cloud, these tools accept an optional `organization` argument when the organization is not fixed:

* `analyze_code_snippet`
* `run_advanced_code_analysis`
* `search_dependency_risks`
* `search_sonar_issues_in_projects`
* `search_my_sonarqube_projects`
* `list_quality_gates`
* `show_rule`
* `create_webhook`
* `list_webhooks`
* `architecture_get`
* `architecture_set`

Pass a key from [`list_organizations`](#projects). The argument applies only to that call. `list_organizations`, and tools that take only a resource identifier, do not use `organization`.

When [`SONARQUBE_ORG`](https://docs.sonarsource.com/sonarqube-mcp-server/reference/environment-variables.md#sonarqube_org) fixes the organization, those tools omit `organization`. A call that includes it fails with `Organization is fixed by SONARQUBE_ORG. Remove the organization argument.` In stdio, the environment variable fixes the organization. For a token request in Streamable HTTP, a deprecated `SONARQUBE_ORG` set on the SonarQube MCP Server or a request `SONARQUBE_ORG` header does the same for that scope.

An OAuth request on the [SonarQube Cloud-hosted MCP server](https://docs.sonarsource.com/sonarqube-mcp-server/setup/sonarqube-cloud-hosted.md#sign-in-with-oauth) rejects a `SONARQUBE_ORG` header with `SONARQUBE_ORG is not supported for OAuth requests. Use the tool organization argument.` Pass `organization` on the tool call. The scopes `mcp:tools:read` and `mcp:tools:write` independently control read and write tools. A call outside your scopes fails with `Insufficient OAuth scope`.

If the organization is missing, the tool fails with `Organization is required. Call list_organizations first, then pass its key as organization, or configure SONARQUBE_ORG.` `analyze_code_snippet` and `run_advanced_code_analysis` return that guidance before they wait for analyzers or read files. Profile and rule lookups for `analyze_code_snippet` use the organization selected for that call.

In stdio, a token that belongs to one organization uses that organization as the default. Zero or multiple organizations leave it unresolved. A tool argument does not change that default.

Vortex context tools use the organization configured at startup, or the single organization detected at startup. A later `organization` argument does not retarget that proxied engine. When startup leaves the organization unresolved, the server does not start the Vortex context proxy.

`run_advanced_code_analysis` is separate from that proxy. On SonarQube Cloud stdio, the server registers it when the workspace is mounted and at least one organization you can access has an active Vortex subscription, even when startup leaves the organization unresolved. [`SONARQUBE_ORG`](https://docs.sonarsource.com/sonarqube-mcp-server/reference/environment-variables.md#sonarqube_org) limits that check to the fixed organization. Each call checks the organization you select. An organization without Vortex fails with `Vortex is not enabled for the selected SonarQube Cloud organization.`

## SonarQube Cloud-hosted MCP server

The list of toolset keys for the SonarQube Cloud-hosted MCP server is in the [Tool availability with SonarQube Cloud](https://docs.sonarsource.com/sonarqube-mcp-server/setup/sonarqube-cloud-hosted.md#tool-availability-with-sonarqube-cloud) section of the setup page.

* Sonar Vortex analysis is not available on the SonarQube Cloud-hosted MCP server because it requires a local filesystem mount. To use [Sonar Vortex analysis](https://docs.sonarsource.com/agent-centric-development-cycle/inside-your-agent-the-agentic-loop/sonar-vortex-analysis.md), set up a local MCP Server using [Stdio](https://docs.sonarsource.com/sonarqube-mcp-server/setup/self-hosted.md#local-server-stdio).
* For details about the tools in each toolset, see the relevant section below.

## Agentic Readiness

Agentic Readiness tools are available only on SonarQube Cloud when the feature is enabled for your organization. In stdio mode, the server checks the feature flag at startup. In HTTP or HTTPS mode, the server does not load these tools unless you opt in explicitly. To opt in, set `SONARQUBE_TOOLSETS` on the server and include `agentic-readiness` along with every other toolset you need, because setting the variable replaces the defaults. This applies even though `agentic-readiness` is in the default toolset list.

## Branch and pull request context

Many tools accept optional `branch` or `pullRequest` parameters to analyze a specific branch or pull request.

**SonarQube Cloud** has three analysis contexts:

* **Long-lived branches** (main, develop, release/\*): use `branch`. Discover valid names with `list_branches` (`branchTypes=LONG` or check the `type` field).
* **Short-lived branches** (feature branches analyzed without pull requests): use `branch`. Discover via `list_branches` (`branchTypes=SHORT` or check the `type` field), or pass the current git branch name directly.
* **Pull requests**: use `pullRequest`. Discover keys with `list_pull_requests`.

**SonarQube Server** has two analysis contexts:

* **Branches**: use `branch`. Discover names with `list_branches`, or pass the current git branch name directly.
* **Pull requests**: use `pullRequest`. Discover keys with `list_pull_requests`.

For both environments:

* Do not pass a git branch name to `pullRequest` — it expects the SonarQube pull request key.
* Do not provide both `branch` and `pullRequest` on the same call.
* Omit both to query the default (main) branch analysis.

## Analysis

| Tool                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p><strong>analyze\_code\_snippet</strong>: Analyze a file or code snippet with SonarQube analyzers to identify code quality and security issues. Specify the language of the snippet to improve analysis accuracy. Optionally filter results to a specific code snippet.<br><br><strong>Deprecated:</strong> <code>analyze\_code\_snippet</code> will be removed in a future release. Connect SonarQube for IDE to use <code>analyze\_file\_list</code>, or enable Vortex analysis for your organization to use <code>run\_advanced\_code\_analysis</code> (see below).<br><br>Supported Languages: Java, Kotlin, Python, Ruby, Go, JavaScript (<code>js</code>, <code>jsx</code>), TypeScript (<code>ts</code>, <code>tsx</code>), JSP, PHP, XML, HTML, CSS, CloudFormation, Kubernetes, Terraform, ARM, Ansible, Docker, Secrets detection.</p> | <p>Usage:</p><ul><li><strong>With workspace mounted (recommended):</strong> pass <code>filePath</code> (project-relative): the server reads the file directly, keeping file content out of the agent context window.</li><li><strong>Without workspace mount:</strong> pass complete <code>fileContent</code> for full file analysis (reports all issues).</li><li>Add optional <code>codeSnippet</code> to filter results. Only issues within the snippet will be reported (snippet location auto-detected).</li></ul><p>Parameters:</p><ul><li><code>codeSnippet</code> (string, optional): Code snippet to filter issues (must match content in <code>fileContent</code>).</li><li><code>fileContent</code> (string, optional): Complete file content as a string; required when workspace is not mounted.</li><li><code>filePath</code> (string, optional): Project-relative path of the file to analyze (e.g., <code>src/main/java/MyClass.java</code>). Used when the workspace is mounted at <code>/app/mcp-workspace</code>.</li><li><code>language</code> (string, optional): Language of the code snippet. For example, <code>java</code>, <code>python</code>, <code>js</code>, <code>ts</code>, <code>tsx</code>, <code>jsx</code>.</li><li><code>projectKey</code> (string, optional): Optional SonarQube project key. Defaults to the configured project when <code>SONARQUBE\_PROJECT\_KEY</code> is set; otherwise uses organization default quality profiles when omitted. Use <code>search\_my\_sonarqube\_projects</code> when the key is unknown.</li><li><code>scope</code> (string, optional): Scope of the file: MAIN or TEST. Default: MAIN.</li><li><code>organization</code> (string, optional): SonarQube Cloud organization key. Use only when <code>SONARQUBE\_ORG</code> is unset. Call <code>list\_organizations</code> if the organization is ambiguous.</li></ul><p>Response fields:</p><ul><li><code>deprecationNotice</code> (string): Deprecation notice for this tool.</li></ul><p>NOTE: The <strong>analyze\_code\_snippet</strong> tool is disabled if you are using the MCP server embedded in SonarQube Cloud. A self-hosted server connected to SonarQube Cloud over HTTP or HTTPS registers this tool when a startup <code>SONARQUBE\_TOKEN</code> is set and the <code>analysis</code> toolset is enabled. Without a startup token, it does not register analysis tools. For a full overview of which tools are unavailable with the embedded server and why, see <a href="https://docs.sonarsource.com/sonarqube-mcp-server/setup/sonarqube-cloud-hosted.md#tool-availability-with-sonarqube-cloud">Tool availability with SonarQube Cloud</a>.</p> |

### When integration with SonarQube for IDE is enabled

These two tools are tagged under both the `analysis` and `ide` toolsets.

| Tool                                                                                                                                                                                                                                                | Type                                                                                        |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| **analyze\_file\_list**: Analyze files in the current working directory using SonarQube for IDE. This tool connects to a running SonarQube for IDE instance to perform code quality analysis on a list of files.                                    | `file_absolute_paths` (array of strings, required): List of absolute file paths to analyze. |
| **toggle\_automatic\_analysis**: Enable or disable SonarQube for IDE automatic analysis. When enabled, SonarQube for IDE automatically analyzes files as you modify them in the working directory. When disabled, automatic analysis is turned off. | `enabled` (boolean, required): Enable or disable the automatic analysis.                    |

### When Vortex analysis is available

[Vortex analysis](https://docs.sonarsource.com/agent-centric-development-cycle/inside-your-agent-the-agentic-loop/sonar-vortex-analysis.md) is available with an active subscription when you run the MCP server in stdio mode with SonarQube Cloud, or with SonarQube Server 2026.5 and newer Enterprise or Data Center edition.

The server selects one analysis path at startup. Enabled toolsets still apply.

* **SonarQube Cloud:** Vortex analysis (`run_advanced_code_analysis`) when the workspace is mounted and at least one organization has an active subscription; local analysis otherwise. A call accepts only an organization with an active subscription.
* **SonarQube Server:** Vortex analysis when the instance has an active subscription and the workspace is mounted. Local analysis when the instance does not have Vortex.

Local analysis uses SonarQube for IDE when it is connected, or `analyze_code_snippet`. Without a workspace mount, snippet analysis requires `fileContent`.

On SonarQube Cloud, `SONARQUBE_ORG` limits the subscription check to that organization. To analyze snippets for every organization, set [`SONARQUBE_FORCE_LOCAL_ANALYSIS`](https://docs.sonarsource.com/sonarqube-mcp-server/reference/environment-variables.md#sonarqube_force_local_analysis) to `true`, enable the `analysis` toolset, and restart. That setting registers `analyze_code_snippet` even when SonarQube for IDE is connected. It has no effect on SonarQube Server or on SonarQube Cloud over HTTP or HTTPS.

Over HTTP and HTTPS, a self-hosted MCP server connected to SonarQube Cloud or SonarQube Server supports `analyze_code_snippet` when a startup `SONARQUBE_TOKEN` is set and the `analysis` toolset is enabled, which it is by default. The startup token initializes the analyzers; SonarQube Cloud analyzer downloads are anonymous. Analysis calls use the caller's token and, on SonarQube Cloud, the organization selected for the request. Without a startup token, snippet analysis and analyzer downloads are unavailable, even with `SONARQUBE_FORCE_LOCAL_ANALYSIS=true`. Vortex entitlement is not required.

> Requires having the workspace mounted at `/app/mcp-workspace`

When the server selects Vortex analysis, it does not register `analyze_code_snippet` or the SonarQube for IDE bridge tools (`analyze_file_list`, `toggle_automatic_analysis`).

| Tool                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **run\_advanced\_code\_analysis**: Run Vortex analysis on a single file. On SonarQube Cloud, pass optional `organization` when `SONARQUBE_ORG` does not fix the organization. Call `list_organizations` when the organization is ambiguous (see [SonarQube Cloud organization](#sonarqube-cloud-organization)). The call checks that organization's subscription and fails with `Vortex is not enabled for the selected SonarQube Cloud organization.` when Vortex is not enabled. SonarQube Server uses the nil UUID placeholder. Requires the workspace to be mounted at `/app/mcp-workspace`. Unlike `analyze_code_snippet` with a workspace mount, this tool uses full CI-level analysis context collected from a previous SonarQube scan for higher-precision results. | <p><code>organization</code> (string, optional): Organization key. Use only when <code>SONARQUBE\_ORG</code> is unset; call <code>list\_organizations</code> if ambiguous. Defaults to the configured organization, or to the single organization detected at startup.</p><p><code>projectKey</code> (key, required): The key of your project. Ignored when <code>SONARQUBE\_PROJECT\_KEY</code> is defined.</p><p><code>branch</code> (string, required): Branch name used to retrieve the latest analysis context.</p><p><code>filePath</code> (string, required): Project-relative path of the file to analyze (e.g., <code>src/main/java/MyClass.java</code>).</p><p><code>fileScope</code> (string, optional): Defines in which scope the file originates from: <code>MAIN</code> or <code>TEST</code>. Default: <code>MAIN</code>.</p> |

## Vortex context

The following tools are available with an active Sonar Vortex subscription. For more information, see [Sonar Vortex context](https://docs.sonarsource.com/agent-centric-development-cycle/inside-your-agent-the-agentic-loop/sonar-vortex-context.md).

### Semantic navigation

| Tool                                                                                                                                                                                                         | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **search\_by\_signature\_patterns:** Find code elements (classes, methods, interfaces) by their declaration signatures using regex patterns.                                                                 | <ul><li><code>include\_code\_regex\_list</code> - List of regex patterns to match against signatures - <em>Required String\[]</em></li><li><code>exclude\_code\_regex\_list</code> - List of regex patterns to exclude from results - <em>String\[]</em></li><li><code>include\_glob</code> - File filter glob pattern (e.g., <code>\*.java</code>) - <em>String</em></li><li><code>exclude\_glob</code> - File exclusion glob pattern - <em>String</em></li><li><code>fields</code> - Comma-separated list of fields to include in the response - <em>String</em></li><li><code>limit</code> - Maximum number of results to return (default: 10) - <em>Integer</em></li><li><code>regex\_lists\_operator</code> - How to combine multiple patterns: <code>OR</code> (default) or <code>AND</code> - <em>String</em></li></ul> |
| **search\_by\_body\_patterns:** Find code elements by their implementation body using regex patterns. Useful for locating where APIs or patterns are actually used.                                          | <ul><li><code>include\_code\_regex\_list</code> - List of regex patterns to match in code bodies - <em>Required String\[]</em></li><li><code>exclude\_code\_regex\_list</code> - List of regex patterns to exclude from results - <em>String\[]</em></li><li><code>include\_glob</code> - File filter glob pattern - <em>String</em></li><li><code>exclude\_glob</code> - File exclusion glob pattern - <em>String</em></li><li><code>fields</code> - Comma-separated list of fields to include in the response - <em>String</em></li><li><code>limit</code> - Maximum number of results to return (default: 10) - <em>Integer</em></li><li><code>regex\_lists\_operator</code> - How to combine multiple patterns: <code>OR</code> (default) or <code>AND</code> - <em>String</em></li></ul>                                  |
| **get\_upstream\_call\_flow:** Trace what functions call a given function. Useful for finding all callers and entry points, and understanding what breaks if a signature changes.                            | <ul><li><code>fqn</code> - Fully qualified name of the function - <em>Required String</em></li><li><code>depth</code> - Call chain depth (0=function only, 1=direct callers, etc.) - <em>Integer</em></li><li><code>fields</code> - Comma-separated list of fields to include in the response - <em>String</em></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **get\_downstream\_call\_flow:** Trace what functions a given function calls. Useful for impact analysis and understanding execution flow.                                                                   | <ul><li><code>fqn</code> - Fully qualified name of the function - <em>Required String</em></li><li><code>depth</code> - Call chain depth (0=function only, 1=direct callees, etc.) - <em>Integer</em></li><li><code>fields</code> - Comma-separated list of fields to include in the response - <em>String</em></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **get\_source\_code** - Get complete source code (signature and body) for a code element by its fully qualified name.                                                                                        | <ul><li><code>fqn</code> - Fully qualified name of the element - <em>Required String</em></li><li><code>fields</code> - Comma-separated list of fields to include in the response - <em>String</em></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **get\_type\_hierarchy** - Get the full inheritance hierarchy for a class-like structure (class, interface, enum, record, exception, struct). Essential for understanding inheritance trees and refactoring. | <ul><li><code>fqn</code> - Fully qualified name of the class-like structure - <em>Required String</em></li><li><code>fields</code> - Comma-separated list of fields to include in the response - <em>String</em></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **get\_references** - Get direct inbound and outbound code references for a class or module. Returns only direct (non-transitive) references.                                                                | <ul><li><code>fqn</code> - Fully qualified name of the class or module - <em>Required String</em></li><li><code>fields</code> - Comma-separated list of fields to include in the response - <em>String</em></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

### Architecture

| Tool                                                                                                                                                                         | Type                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **get\_current\_architecture** - Get a hierarchical architecture graph filtered by path prefix and depth. Useful for exploring module structure and high-level dependencies. | <ul><li><code>depth</code> - Hierarchy depth (0=root only, 1=root + children, etc.) - <em>Required Integer</em></li><li><code>path\_prefix</code> - Optional path prefix to filter nodes (e.g., <code>com.example.service</code>) - <em>String</em></li><li><code>ecosystem</code> - Optional ecosystem to filter by (<code>java</code>, <code>cs</code>, <code>py</code>, <code>js</code>, <code>ts</code>) - <em>String</em></li></ul> |
| **get\_intended\_architecture** - Get user-defined architectural constraints specifying which modules are allowed to depend on others.                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                          |

### Guidelines

| Tool                                                                                                                         | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **get\_guidelines** - Get coding guidelines based on SonarQube project issues, catalog categories, or a combination of both. | <ul><li><code>mode</code> - Guidelines retrieval mode: <code>project\_based</code>, <code>category\_based</code>, or <code>combined</code> - <em>Required String</em></li><li><code>categories</code> - List of category names (required for <code>category\_based</code> and <code>combined</code> modes) - <em>String\[]</em></li><li><code>languages</code> - List of target languages in SonarQube repository key format (required when <code>categories</code> is provided) - <em>String\[]</em></li><li><code>file\_paths</code> - Optional list of file paths to filter guidelines by - <em>String\[]</em></li></ul> |

### Dependencies

> **Note:** Third-party dependency tools are only available when [SCA](https://docs.sonarsource.com/sonarqube-cloud/advanced-security/analyzing-projects-for-dependencies-sca.md) is enabled for your SonarQube Cloud organization.

| Tool                                                                                                                                                                                                                                                                                                                                                                                                   | Type                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **check\_dependency** - Check a third-party dependency for security vulnerabilities, supply-chain malware, and license compliance before adding or updating it. Covers npm, Maven, PyPI, Go, NuGet, Cargo, Composer (PHP), RubyGems, and more. Must be called before modifying any dependency manifest or lockfile (e.g. `package.json`, `pom.xml`, `build.gradle`, `requirements.txt`, `Cargo.toml`). | <ul><li><code>purl</code> (string, required): Package URL (purl) with version, per <a href="https://github.com/package-url/purl-spec">purl-spec</a>. Format: <code>pkg:\<type>/\<namespace>/\<name>@\<version></code> (e.g. <code>pkg:npm/lodash\@4.17.21</code>, <code>pkg:maven/org.apache.logging.log4j/log4j-core\@2.14.1</code>, <code>pkg:pypi/django\@3.2.0</code>).</li></ul> |

## Coverage

| Tool                                                                                                                                                                                                                                                                                                         | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **search\_files\_by\_coverage**: Search for files in a project sorted by coverage (ascending, worst coverage first). Use this tool to identify files that are candidates for test coverage improvements.                                                                                                     | <p><code>projectKey</code> (string, required): The project key to search in. Ignored when <code>SONARQUBE\_PROJECT\_KEY</code> is defined.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p><p><code>maxCoverage</code> (number, optional): Maximum coverage threshold (0–100). Only returns files with coverage less than or equal to this value.</p><p><code>pageIndex</code> (number, optional): Page index (1-based). Default: 1.</p><p><code>pageSize</code> (number, optional): Page size. Default: 100. Max: 500.</p> |
| **get\_file\_coverage\_details**: Get line-by-line coverage information for a specific file, including which exact lines are uncovered and which have partially covered branches. Use this tool after identifying low-coverage files with `search_files_by_coverage` to pinpoint where to add test coverage. | <p><code>key</code> (string, required): File key (e.g., <code>my\_project:src/foo/Bar.java</code>).</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p><p><code>from</code> (number, optional): First line to return (1-based). Default: 1.</p><p><code>to</code> (number, optional): Last line to return (inclusive). If not specified, all lines are returned.</p>                                                                                                                                                           |

## Dependency risks

> **Note:** Dependency risks require SonarQube Advanced Security. On SonarQube Cloud, enable [Advanced Security](https://docs.sonarsource.com/sonarqube-cloud/advanced-security/analyzing-projects-for-dependencies-sca.md) for the organization. On SonarQube Server, use version 2025.4 Enterprise edition or higher with [SonarQube Advanced Security](https://docs.sonarsource.com/sonarqube-server/2025.4/advanced-security.md) enabled.

| Tool                                                                                                                                                                                                           | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **search\_dependency\_risks**: Search for software composition analysis issues (dependency risks) of a SonarQube project, paired with releases that appear in the analyzed project, application, or portfolio. | <p><code>projectKey</code> (string): Project key. Ignored when <code>SONARQUBE\_PROJECT\_KEY</code> is defined.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p><p><code>pageIndex</code> (integer, optional): Page index. Default: 1.</p><p><code>pageSize</code> (integer, optional): Page size. Must be greater than 0 and less than or equal to 500. Default: 100.</p><p><code>organization</code> (string, optional): SonarQube Cloud organization key. Use only when <code>SONARQUBE\_ORG</code> is unset. Call <code>list\_organizations</code> if the organization is ambiguous.</p> |

## Duplications

| Tool                                                                                                                                                                                                                                   | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **search\_duplicated\_files**: Search for files with code duplications in a SonarQube project. By default, automatically fetches all duplicated files across all pages (up to 10,000 files max). Returns only files with duplications. | <p><code>projectKey</code> (string, required): Project key. Ignored when <code>SONARQUBE\_PROJECT\_KEY</code> is defined.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p><p><code>pageSize</code> (integer, optional): Optional number of results per page for manual pagination. Max: 500. If not specified, auto-fetches all duplicated files.</p><p><code>pageIndex</code> (integer, optional): Optional page number for manual pagination. Starts at 1. If not specified, auto-fetches all duplicated files.</p> |
| **get\_duplications**: Get duplications for a file. Require Browse permission on file's project.                                                                                                                                       | <p><code>key</code> (string, required): File key.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p>                                                                                                                                                                                                                                                                                                                                                                                                                    |

## Enterprises

> **Note:** Enterprise tools are only available when connecting to SonarQube Cloud Enterprise.

| Tool                                                                                                                                                                          | Type                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| **list\_enterprises**: List the enterprises available in SonarQube Cloud that you have access to. Use this tool to discover enterprise IDs that can be used with other tools. | `enterpriseKey` (string, optional): Enterprise key to filter results. |

## Issues

| Tool                                                                                                                           | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **change\_sonar\_issue\_status**: Change the status of a SonarQube issue to "accept", "falsepositive" or to "reopen" an issue. | <p><code>key</code> (string, required): Issue key</p><p><code>status</code> (enum, required): New issue's status. <em>Required Enum {"accept", "falsepositive", "reopen"}</em></p><p><code>comment</code> (string, optional): Optional comment explaining the status change.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **search\_sonar\_issues\_in\_projects**: Search for SonarQube issues in your organization's projects.                          | <p><code>issueStatuses</code> (array of strings, optional): List of issue statuses to filter by. Possible values: OPEN, CONFIRMED, FALSE\_POSITIVE, ACCEPTED, FIXED, IN\_SANDBOX.</p><p><code>tags</code> (array of strings, optional): List of issue tags to filter by. Tags are lowercase.</p><p><code>inNewCodePeriod</code> (boolean, optional): Only return issues in the new code period. Requires exactly one entry across <code>projectKeys</code> and <code>files</code>.</p><p><code>issueKey</code> (string, optional): Issue key used to fetch a specific issue.</p><p><code>impactSoftwareQualities</code> (array of strings, optional): List of software qualities to filter by. Possible values: MAINTAINABILITY, RELIABILITY, SECURITY.</p><p><code>pageIndex</code> (integer, optional): 1-based page index. Default: 1.</p><p><code>projectKeys</code> (array of strings, optional): Optional list of SonarQube project keys.</p><p><code>pageSize</code> (integer, optional): Page size. Must be greater than 0 and less than or equal to 500. Default: 100.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p><p><code>severities</code> (array of strings, optional): List of severities to filter by. Possible values: INFO, LOW, MEDIUM, HIGH, BLOCKER.</p><p><code>organization</code> (string, optional): SonarQube Cloud organization key. Use only when <code>SONARQUBE\_ORG</code> is unset. Call <code>list\_organizations</code> if the organization is ambiguous.</p> |

## Languages

| Tool                                                                                      | Type                                               |
| ----------------------------------------------------------------------------------------- | -------------------------------------------------- |
| **list\_languages**: List all programming languages supported in this SonarQube instance. | `q`: Pattern to match language keys/names against. |

## Measures

| Tool                                                                                             | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **get\_component\_measures**: Get SonarQube measures for a component (project, directory, file). | <p><code>projectKey</code> (string, required): The project key. Required when <code>SONARQUBE\_PROJECT\_KEY</code> is not configured.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>metricKeys</code> (array of strings, optional): Metric keys to retrieve (for example: ncloc, complexity, violations, coverage, new\_violations).</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p><p>New Code metrics (typically <code>new\_\*</code>) return their New Code period value in <code>value</code>.</p><p>Response fields:</p><ul><li><code>value</code> (string): Measure value. For New Code metrics, this is the New Code period value.</li><li><code>period</code> (integer, optional): New Code period index. Present when the value is a New Code metric.</li><li><code>bestValue</code> (boolean, optional): Whether this is the metric's best possible value.</li></ul> |

## Metrics

| Tool                                               | Type                                                                                                                                                                                                               |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **search\_metrics**: Search for SonarQube metrics. | <p><code>pageIndex</code> (integer, optional): 1-based page index. Default: 1.</p><p><code>pageSize</code> (integer, optional): Page size. Must be greater than 0 and less than or equal to 500. Default: 100.</p> |

## Portfolios

| Tool                                                                                                           | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **list\_portfolios**: List enterprise portfolios available in SonarQube with filtering and pagination options. | <p><strong>For SonarQube Server:</strong></p><p><code>q</code> (string, optional): Search query to filter portfolios by name or key.</p><p><code>favorite</code> (boolean): If true, returns favorite portfolios.</p><p><code>pageIndex</code> (integer, optional): Optional 1-based page number. Default: 1.</p><p><code>pageSize</code> (integer, optional): Optional page size, max 500. Default: 100.</p><p><strong>For SonarQube Cloud:</strong></p><p><code>enterpriseId</code> (string): Enterprise uuid. Can be omitted only if the <code>favorite</code> parameter is supplied with value true.</p><p><code>q</code> (string, optional): Search query to filter portfolios by name.</p><p><code>favorite</code> (boolean, required): Required to be true if the <code>enterpriseId</code> parameter is omitted. If true, returns portfolios favorited by the logged-in user. Cannot be true when <code>draft</code> is true.</p><p><code>draft</code> (boolean): If true, returns drafts created by the logged-in user. Cannot be true when <code>favorite</code> is true.</p><p><code>pageIndex</code> (integer, optional): Index of the page to fetch. Default: 1,</p><p><code>pageSize</code> (integer, optional): Size of the page to fetch. Default: 50.</p> |

## Projects

| Tool                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **list\_organizations**: List SonarQube Cloud organizations that you're a member of, including each organization's key, name, ID, and UUID. Use a returned key as `organization` on organization-aware tools. Available on SonarQube Cloud only. The tool does not take an `organization` argument.                                                                                                                                                                                                                                  | <p>No parameters.</p><p>Response fields:</p><ul><li><code>organizations</code> (array): Organizations you're a member of. Each item includes <code>key</code>, <code>name</code>, <code>id</code>, and <code>uuidV4</code>.</li></ul>                                                                                                                                                                                                                                                                                                                       |
| **search\_my\_sonarqube\_projects**: Find SonarQube projects. The response is paginated.                                                                                                                                                                                                                                                                                                                                                                                                                                             | <p><code>pageIndex</code> (integer, optional): 1-based page index. Default: 1.</p><p><code>pageSize</code> (integer, optional): Page size. Must be greater than 0 and less than or equal to 500. Default: 500.</p><p><code>q</code> (string, optional): Search query to filter projects by name (partial match) or key (exact match).</p><p><code>organization</code> (string, optional): SonarQube Cloud organization key. Use only when <code>SONARQUBE\_ORG</code> is unset. Call <code>list\_organizations</code> if the organization is ambiguous.</p> |
| **list\_branches**: List analyzed branches for a project. **SonarQube Cloud**: returns long-lived (`LONG`) and short-lived (`SHORT`) branches with `type` and `mergeBranch` fields. Optional `branchTypes` filter: `ALL` (default), `LONG`, or `SHORT`. **SonarQube Server**: returns all analyzed branches (name, quality gate, analysis date). No `type`, `mergeBranch`, or `branchTypes` filter. Use returned branch names as the `branch` parameter on other tools. For pull request analysis, use `list_pull_requests` instead. | <p><code>projectKey</code> (string, required): Project key. Ignored when <code>SONARQUBE\_PROJECT\_KEY</code> is defined.</p><p><code>branchTypes</code> (enum, optional, SonarQube Cloud only): Filter branches by type. <code>ALL</code> (default), <code>LONG</code>, or <code>SHORT</code>.</p>                                                                                                                                                                                                                                                         |
| **list\_pull\_requests**: List all pull requests for a project. Use this tool to discover pull requests for PR-decorated analysis (coverage, issues, quality gate). Returns the pull request key/ID which can be used with other tools. For branch-based analysis without pull requests, use `list_branches` instead.                                                                                                                                                                                                                | `projectKey` (string, required): Project key. Ignored when `SONARQUBE_PROJECT_KEY` is defined.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

## Quality gates

| Tool                                                                                            | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **get\_project\_quality\_gate\_status**: Get the quality gate status for the SonarQube project. | <p><code>analysisId</code> (string, optional): Analysis ID.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>projectId</code> (string, optional): Project ID.</p><p><code>projectKey</code> (string, optional): Project key.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p> |
| **list\_quality\_gates**: List all quality gates in my SonarQube.                               | `organization` (string, optional): SonarQube Cloud organization key. Use only when `SONARQUBE_ORG` is unset. Call `list_organizations` if the organization is ambiguous.                                                                                                                                                                                                                                                                                                                          |

## Rules

| Tool                                                               | Type                                                                                                                                                                                                                                                                    |
| ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **show\_rule**: Shows detailed information about a SonarQube rule. | <p><code>key</code> (string, required): Rule key.</p><p><code>organization</code> (string, optional): SonarQube Cloud organization key. Use only when <code>SONARQUBE\_ORG</code> is unset. Call <code>list\_organizations</code> if the organization is ambiguous.</p> |

## Sources

| Tool                                                                                                                                | Type                                                                                                                                                                                                                                                                                                                                                        |
| ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **get\_raw\_source**: Get source code as raw text from SonarQube. Requires the *See Source Code* permission on file.                | <p><code>key</code> (string, required): File key.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p> |
| **get\_scm\_info**: Get SCM information of SonarQube source files. Requires the *See Source Code* permission on the file's project. | <p><code>key</code> (string, required): File key.</p><p><code>commits\_by\_line</code> (string): If the value is false, group lines by SCM commit; else display commits for each line.</p><p><code>from</code> (number): First line to return. Starts at 1.</p><p><code>to</code> (inclusive): Last line to return.</p>                                     |

## Security Hotspots

| Tool                                                                                                                                                                              | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **search\_security\_hotspots** - Search for Security Hotspots in a SonarQube project.                                                                                             | <p><code>projectKey</code> (string): Project or application key. Ignored when <code>SONARQUBE\_PROJECT\_KEY</code> is defined.</p><p><code>hotspotKeys</code> (array of strings): Comma-separated list of specific Security Hotspot keys to retrieve.</p><p><code>branch</code> (string, optional): Optional branch name for branch-based analysis. Use <code>list\_branches</code> to discover valid names.</p><p><code>pullRequest</code> (string, optional): Optional pull request key/ID. Use <code>list\_pull\_requests</code> to discover valid keys.</p><p><code>files</code> (array of strings, optional): List of file paths to filter.</p><p><code>status</code> (string, optional): Optional status filter: TO\_REVIEW, REVIEWED.</p><p><code>resolution</code> (string, optional): Optional resolution filter: FIXED, SAFE, ACKNOWLEDGED.</p><p><code>sinceLeakPeriod</code> (boolean): Filter hotspots created since the leak period (new code).</p><p><code>onlyMine</code> (boolean): Show only hotspots assigned to me.</p><p><code>pageIndex</code> (integer, optional): 1-based page index. Default: 1.</p><p><code>pageSize</code> (integer, optional): Page size. Must be greater than 0 and less than or equal to 500. Default: 100.</p> |
| **show\_security\_hotspot** - Get detailed information about a specific Security Hotspot, including rule details, code context, flows, and comments.                              | `hotspotKey` - Security Hotspot key - *Required String*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **change\_security\_hotspot\_status** - Review a Security Hotspot by changing its status. When marking as REVIEWED, you must specify a resolution (FIXED, SAFE, or ACKNOWLEDGED). | <p><code>hotspotKey</code> (string, required): Security Hotspot key.</p><p><code>status</code> (enum, required): New status. <em>Required Enum {"TO\_REVIEW", "REVIEWED"}.</em></p><p><code>resolution</code> (enum): Resolution when status is REVIEWED. <em>Enum {"FIXED", "SAFE", "ACKNOWLEDGED"}</em>.</p><p><code>comment</code> (string, optional): Optional review comment.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

## System

> **Note:** System tools are only available when connecting to SonarQube Server.

| Tool                                                                                                                                                                                        | Type                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **get\_system\_health**: Get the health status of SonarQube Server instance. Returns GREEN (fully operational), YELLOW (usable but needs attention), or RED (not operational).              |                                                                                                                           |
| **get\_system\_info**: Get detailed information about SonarQube Server system configuration including JVM state, database, search indexes, and settings. Requires 'Administer' permissions. |                                                                                                                           |
| **get\_system\_logs**: Get SonarQube Server system logs in plain-text format. Requires system administration permission.                                                                    | `name` (string, optional): Name of the logs to get. Possible values: access, app, ce, deprecation, es, web. Default: app. |
| **ping\_system**: Ping the SonarQube Server system to check if it's alive. Returns 'pong' as plain text.                                                                                    |                                                                                                                           |
| **get\_system\_status**: Get state information about SonarQube Server. Returns status (STARTING, UP, DOWN, RESTARTING, DB\_MIGRATION\_NEEDED, DB\_MIGRATION\_RUNNING), version, and id.     |                                                                                                                           |

## Webhooks

| Tool                                                                                                                                                                                       | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **create\_webhook**: Create a new webhook for the SonarQube organization or project. Requires *Administrator* permissions on the specified project, or *Global Administrator* permissions. | <p><code>name</code> (string, required): Webhook name.</p><p><code>url</code> (string, required): Webhook URL.</p><p><code>projectKey</code> (string, optional): Project key for project-specific webhook.</p><p><code>secret</code> (string, optional): Webhook secret for securing the webhook payload.</p><p><code>organization</code> (string, optional): SonarQube Cloud organization key. Use only when <code>SONARQUBE\_ORG</code> is unset. Call <code>list\_organizations</code> if the organization is ambiguous.</p> |
| **list\_webhooks**: List all webhooks for the SonarQube organization or project. Requires *Administrator* permissions on the specified project, or *Global Administrator* permissions.     | <p><code>projectKey</code> (string, optional): Project key to list project-specific webhooks.</p><p><code>organization</code> (string, optional): SonarQube Cloud organization key. Use only when <code>SONARQUBE\_ORG</code> is unset. Call <code>list\_organizations</code> if the organization is ambiguous.</p>                                                                                                                                                                                                             |

## Architecture

> **Note:** On SonarQube Cloud, the architecture tools require a Team or Enterprise plan. On SonarQube Server, they require version 2026.6 or later and Developer edition or higher. They are not available on older versions or SonarQube Community Build.

Add `architecture` to [`SONARQUBE_TOOLSETS`](https://docs.sonarsource.com/sonarqube-mcp-server/reference/environment-variables.md#available-toolsets) to enable these tools in stdio, HTTP, or HTTPS mode. The toolset is not enabled by default. Use the tool schema that the running MCP server advertises, because a feature that your SonarQube build does not support fails when called.

On SonarQube Cloud, pass `organization` only when none is configured or detected. A current read fails without a resolved organization. For details, see the [SonarQube Cloud organization](#sonarqube-cloud-organization) article.

`architecture_get` reads current dependencies, intended groups and constraints, project directives, or project findings. Directive pages return summary objects without descriptions. Use `directiveId` to retrieve one full directive, including its description. Findings come from the project's main branch analysis and have no IDs.

A current view shows at most 150 nodes, 20 dependencies, and 5 feedback pairs across languages. Narrow the view with `component` or `language`. Omitted siblings can remain undiscoverable, which means a capped view is not a complete graph export. Each current node includes `children`, `descendants`, and `truncated` fields. `children` and `descendants` count the direct and transitive children in the whole graph; `truncated` is `true` when at least one direct child is outside the view because of the requested depth or response limits. If the selected component has no children, the response identifies it as a leaf.

To inspect dependencies between two components, set `target` to `current` and provide exact `from` and `to` keys. Each endpoint includes its descendants; use `depth` to control the level at which dependencies are aggregated (default: `1`). The query returns leaf-level dependencies sorted by weight, with up to 20 dependencies per page. Use `pageIndex` and `pageSize` to paginate, and specify `language` when the endpoints match more than one language graph. Do not combine `from` or `to` with `component`. The response includes the selected `language`, `from`, `to`, `depth`, `revision`, each dependency's `from`, `to`, and `weight`, and `paging` metadata with `pageIndex`, `pageSize`, `total`, and `hasNextPage`.

Current graph reads and intended-model discovery diagnostics share a two-read limit across the architecture tools. Further operations wait up to five seconds, then fail with `Architecture reads are busy. Try again shortly.` Each accepted operation still downloads and processes the full selected graph.

If the server returns a malformed or incomplete architecture response, the tool reports an API error with validation details. Authentication, permission, missing-resource, and server errors keep their own messages, and an empty result is not an error.

* `target` (required): `current`, `intended`, `directives`, or `findings`
* `projectKey` (required string): Project key, ignored when `SONARQUBE_PROJECT_KEY` is defined
* `organization` (optional string, SonarQube Cloud): Organization key when none is configured or detected; a `current` read fails without a resolved organization
* `from` and `to` (optional strings, current only): Exact source and destination keys, including descendants, for a dependency query; provide both, and do not combine them with `component`
* `component` (optional string): Exact key from this tool, with no wildcards (Java current keys use `module:package`; intended keys join group labels with `/`); top level when omitted
* `depth` (optional number): Levels below the start (default 1 for `current`, all levels for `intended`); must be 1 or more
* `language` (optional): `java`, `cs`, `js`, `ts`, or `py` (all languages when omitted); applies to `current`, `intended`, and `findings`
* `directiveId` (optional string, directives only): Read one directive by UUID instead of a page; cannot be combined with paging
* `type` (optional string, findings only): Filter findings by type: `structuralDeviation`, `relationshipDeviation`, `tangle`, `oversizedComponent`, `weakTangle`, or `splitResponsibility`
* `category` (optional string, findings only): Filter findings by category: `deviation`, `flaw`, or `smell`
* `pageIndex` (optional number, current dependency queries, directives, and findings): Page number, starting at 1 (default 1)
* `pageSize` (optional number, current dependency queries, directives, and findings): Number of items per page. Current dependency queries accept 1–20 and default to 20; directives accept 1–50 and default to 50; findings accept 0–1000 and default to 50. Use `0` for a count-only findings query.

For findings, combine `category`, `type`, and `language` filters with AND. Each finding includes its type, category, language, structured details, and related files:

* `structuralDeviation` (`deviation`): `misplacedComponent` or `unimplementedComponent`, with a node key and an optional misplaced-component count
* `relationshipDeviation` (`deviation`): `disallowedDependency` or `interfaceViolation`, with source and target node keys and an optional dependency count
* `tangle` (`flaw`) and `weakTangle` (`smell`): node keys and node count
* `oversizedComponent` (`flaw`): node key and an optional leaf-artifact count
* `splitResponsibility` (`smell`): node key and an optional fragment count

The response includes `pageIndex`, `pageSize`, and `total`. If the server skips findings with unsupported types, languages, or reasons, it also returns `skippedFindings`. It counts only the skipped findings that match the active filters, and `total` remains the backend total. An empty result with `total: 0` reports that no findings are visible; it does not claim that the project is healthy. An empty later page reports the requested page and total. The server rejects incompatible category/type pairs before backend requests, refuses findings reads before main-branch analysis, validates returned rows against active filters, identifies active filters for zero results, and gives a last-page hint. Malformed known findings still fail, so omitted future rows do not imply a clean or complete analysis.

`architecture_set` replaces the whole intended model or creates, updates, and deletes explicit project directives. Start from an unfiltered `architecture_get` response with `target` set to `intended`, and set `dryRun` to `true` to review the diff before you apply it. If you pass a full intended-architecture response, its top-level `projectKey` or `project` marker must match `projectKey`; the tool rejects mismatched, invalid, or conflicting markers before any architecture request. Bare model arrays and matching markers remain supported. It's hidden when [`SONARQUBE_READ_ONLY`](https://docs.sonarsource.com/sonarqube-mcp-server/reference/environment-variables.md#sonarqube_read_only) is `true`. An OAuth call needs both `mcp:tools:read` and `mcp:tools:write`. A call outside those scopes fails with `Insufficient OAuth scope`.

For intended architecture, preview an empty complete model before applying its DELETE. Applying a clear requires the revision from `architecture_get` with `target: intended`, either inside the whole response or in `revision`. That revision covers the whole stored model even when the read is filtered. An empty array without a revision cannot clear it.

For directives, supply a JSON object with optional `create`, `update`, and `delete` arrays. Create records contain directive fields, update records contain `{id, changed fields}`, and delete records contain only `{id}`. Unspecified update fields and unmentioned directives are retained. Creation skips duplicate operations. Preview with `dryRun=true` and apply only after confirmation. Directive pages return summaries without descriptions; request a directive by ID when you need its full record. The whole batch is validated before writing; conflicting IDs are rejected. Writes are individual, not atomic. A partial or uncertain failure reports confirmed IDs and stops without retry or rollback. Duplicate checks and preflight reads can race concurrent edits. Optional fields cannot be cleared with `null`; the API has no conditional writes.

Directive fields: `type` (`REMOVE_EDGE`, `RENAME_NODE`, `MOVE_NODE`), `ecosystem`, `graphType` (`file_graph`, `namespace_graph`), `fromNodeKey`, and `toNodeKey`. Use the existing destination container for `toNodeKey` with `MOVE_NODE`, and the new complete key with `RENAME_NODE`. Optional fields are `graphPerspective` (defaults to `default_perspective`) and `description`. Creation sets origin to `sonarqube-mcp-server`; updates preserve the stored origin.

Replacing the intended architecture has data-loss limitations. The call removes any perspective or group you omit. Keep labels, descriptions, and imported pattern links from the exported model. Imported patterns stay references: the public export does not expand their groups or constraints, exported child groups must stay unchanged or be omitted, and imported contents cannot be edited here. The call rejects partial views. An empty complete model deletes the stored intended resource after preview only when its exported revision is supplied. Supply the whole response to retain its revision check; concurrent edits can still race the check. The tool relays definite HTTP client rejections directly. An empty collection read after a failed DELETE response does not confirm deletion; the result reports that no model is visible and leaves the write unconfirmed. Uncertain writes return a recovery export when the desired state cannot be verified; no automatic rollback is attempted.

For intended architecture, a successful call returns `mode` as `dry-run`, `unchanged`, `created`, or `replaced`, plus a `diff` of removed, added, and changed entries.

For directives, a dry run returns `mode: dry-run`, with `toCreate`, `changes` containing `before` and `after` values, and `toDelete` entries. An applied call returns `mode: applied`, with `counts` and `createdIds`, `updatedIds`, `deletedIds`, `skippedIds`, and warning details. Applied responses use IDs instead of repeating full payloads.

For intended architecture, `architecture_set` rejects literal constraint endpoints that do not identify exactly one group and rejects self-referential constraints. The tool accepts constraint endpoints that contain the wildcards `*` or `?`, and endpoints below an imported pattern group, without checking them, because the server resolves those. When the model changes, the tool also checks the discovery graph and adds advisory warnings for exact patterns that name containers or groups whose physical parents do not match discovery. Logical groupings are allowed, and no groups are moved. If a complete discovery graph is unavailable, the response says that pattern and physical-hierarchy checks were skipped; structural validation still applies. The response shows up to 10 discovery warnings and reports how many additional warnings were omitted.

* `target` (required): `intended` or `directives`
* `projectKey` (required string): Project key, ignored when `SONARQUBE_PROJECT_KEY` is defined
* `organization` (optional string, SonarQube Cloud): Organization key when none is configured or detected
* `model` (required string): For `intended`, the whole JSON response or its `models` array from an unfiltered `architecture_get`; for `directives`, `{create: [...], update: [...], delete: [...]}` using the directive fields (`type`, `ecosystem`, `graphType`, `fromNodeKey`, `toNodeKey`, and optionally `graphPerspective` and `description`)
* `dryRun` (required boolean): `true` to validate and list the changes, `false` to write them
* `revision` (optional string): Revision from `architecture_get` (defaults to the revision on the whole response); required when applying a clear; other bare arrays without it cannot detect changes since the export


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-mcp-server/reference/tools.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
