# Source: https://docs.sonarsource.com/sonarqube-mcp-server/tools.md

# Tools

Note also the SONARQUBE\_TOOLSETS  environment variable that accepts a comma-separated list of toolsets to enable. See the [#tool-enablement](https://docs.sonarsource.com/sonarqube-mcp-server/build-and-configure/environment-variables#tool-enablement "mention") article for a list of available toolsets.

### Analysis

| Tool                                                                                                                                                                                                | Type                                                                                                                                                                                     |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **analyze\_code\_snippet**: 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. | <p></p><ul><li><code>codeSnippet</code> (string, required): Code snippet or full file content.</li><li><code>language</code> (string, optional): Language of the code snippet.</li></ul> |

#### **When integration with SonarQube for IDE is enabled:**

| 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 will automatically analyze files as they are modified in the working directory. When disabled, automatic analysis is turned off. | `enabled` (boolean, required): Enable or disable the automatic analysis.                    |

### Dependency risks

{% hint style="info" %}
Dependency risks are only available when connecting to SonarQube Server 2025.4 Enterprise edition or higher with [SonarQube Advanced Security](https://app.gitbook.com/s/yDv2XwTC1xoOKBYeCK45/advanced-security) enabled.
{% endhint %}

| 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.</p><p><code>branchKey</code> (string): Branch key.</p><p><code>pullRequestKey</code> (string, optional): Pull request key.</p> |

### Enterprises

{% hint style="info" %}
Enterprise tools are only available when connecting to a SonarQube Cloud Enterprise edition.
{% endhint %}

| 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></p><p><code>key</code> (string, required): Issue key - <em>Required String</em></p><p><code>status</code> (enum, required): New issue's status - <em>Required Enum {"accept", "falsepositive", "reopen"}</em></p>                                                                                                                                                                                                                                                                                                           |
| **search\_sonar\_issues\_in\_projects**: Search for SonarQube issues in my organization's projects.                            | <p></p><p><code>projects</code> (array of strings, optional): Optional list of Sonar projects.</p><p><code>pullRequestId</code> (string, optional): Pull Request's identifier.</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>p</code> (integer, optional): Page number. Default: 1.</p><p><code>ps</code> (integer, optional): Page size. Must be greater than 0 and less than or equal to 500. Default: 100.</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></p><p><code>component</code> (string, optional): Component key to get measures.</p><p><code>branch</code> (string, optional): Branch to analyze for measures.</p><p><code>metricKeys</code> (array of strings, optional): Metric keys to retrieve (for example: ncloc, complexity, violations, coverage).</p><p><code>pullRequest</code> (string, optional): Optional pull request identifier to analyze for measures - <em>String</em></p> |

### Metrics

| Tool                                               | Type                                                                                                                                                                                                 |
| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **search\_metrics**: Search for SonarQube metrics. | <p></p><p><code>p</code> (integer, optional): Page number. Default: 1.</p><p><code>ps</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></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                                                       |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| **search\_my\_sonarqube\_projects**: Find SonarQube projects. The response is paginated. | `page` (string, optional): Optional page number - *String* |

### Quality gates

| Tool                                                                                            | Type                                                                                                                                                                                                                                                                                                                             |
| ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **get\_project\_quality\_gate\_status**: Get the quality gate status for the SonarQube project. | <p></p><p><code>analysisId</code> (string, optional): Analysis ID.</p><p><code>branch</code> (string, optional): Branch key.</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): Pull request ID.</p> |
| **list\_quality\_gates**: List all quality gates in my SonarQube.                               |                                                                                                                                                                                                                                                                                                                                  |

### Rules

| Tool                                                                         | Type                                                                                                                         |
| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **list\_rule\_repositories**: List rule repositories available in SonarQube. | <p></p><p><code>language</code> (string, optional): Language key.</p><p><code>q</code> (string, optional): Search query.</p> |
| **show\_rule**: Shows detailed information about a SonarQube rule.           | `key` (string, required): Rule key.                                                                                          |

### Sources

| Tool                                                                                                                                | Type                                                                                                                                                                                                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **get\_raw\_source**: Get source code as raw text from SonarQube. Requires the *See Source Code* permission on file.                | <p></p><p><code>key</code> (string, required): File key.</p><p><code>branch</code> (string, optional): Branch key.</p><p><code>pullRequest</code> (string, optional): Pull request id.</p>                                                                                                                                     |
| **get\_scm\_info**: Get SCM information of SonarQube source files. Requires the *See Source Code* permission on the file's project. | <p></p><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> |

### System

{% hint style="info" %}
System tools are only available when connecting to SonarQube Server.
{% endhint %}

| 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></p><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> |
| **list\_webhooks**: List all webhooks for the SonarQube organization or project. Requires *Administrator* permissions on the specified project, or *Global Administrator* permissions.     | `projectKey` (string, optional): Project key to list project-specific webhooks.                                                                                                                                                                                                                                      |

<br>