Skip to content

Commit 63bcb4e

Browse files
authored
MCP-90 Unify descriptions of all the tools (#83)
1 parent 607fd50 commit 63bcb4e

File tree

21 files changed

+68
-55
lines changed

21 files changed

+68
-55
lines changed

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -233,61 +233,61 @@ When using custom certificates, you can modify your MCP configuration to mount t
233233

234234
### Analysis
235235

236-
- **analyze_code_snippet** - Analyze a code snippet with SonarQube analyzers to find SonarQube issues in it.
236+
- **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.
237237
- `codeSnippet` - Code snippet or full file content - _Required String_
238238
- `language` - Optional language of the code snippet - _String_
239239

240240
### Dependency Risks
241241

242242
**Note: Dependency risks are only available when connecting to SonarQube Server 2025.4 Enterprise or higher with SonarQube Advanced Security enabled.**
243243

244-
- **search_dependency_risks** - Search for software composition analysis issues (dependency risks) of a project, paired with releases that appear in the analyzed project, application, or portfolio.
244+
- **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.
245245
- `projectKey` - Project key - _String_
246246
- `branchKey` - Optional branch key - _String_
247247
- `pullRequestKey` - Optional pull request key - _String_
248248

249-
### Languages
249+
### Enterprises
250250

251-
- **list_languages** - List all programming languages supported in this instance
252-
- `q` - Optional pattern to match language keys/names against - _String_
251+
**Note: Enterprises are only available when connecting to SonarQube Cloud.**
252+
253+
- **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.
254+
- `enterpriseKey` - Optional enterprise key to filter results - _String_
253255

254256
### Issues
255257

256-
- **change_sonar_issue_status** - Change the status of a SonarQube issue to "accept", "falsepositive" or to "reopen" an issue
258+
- **change_sonar_issue_status** - Change the status of a SonarQube issue to "accept", "falsepositive" or to "reopen" an issue.
257259
- `key` - Issue key - _Required String_
258260
- `status` - New issue's status - _Required Enum {"accept", "falsepositive", "reopen"}_
259261

260262

261-
- **search_sonar_issues_in_projects** - Search for SonarQube issues in my organization's projects
263+
- **search_sonar_issues_in_projects** - Search for SonarQube issues in my organization's projects.
262264
- `projects` - Optional list of Sonar projects - _String[]_
263265
- `pullRequestId` - Optional Pull Request's identifier - _String_
264266
- `p` - Optional page number (default: 1) - _Integer_
265267
- `ps` - Optional page size. Must be greater than 0 and less than or equal to 500 (default: 100) - _Integer_
266268

269+
### Languages
270+
271+
- **list_languages** - List all programming languages supported in this SonarQube instance.
272+
- `q` - Optional pattern to match language keys/names against - _String_
273+
267274
### Measures
268275

269-
- **get_component_measures** - Get measures for a component (project, directory, file)
276+
- **get_component_measures** - Get SonarQube measures for a component (project, directory, file).
270277
- `component` - Optional component key to get measures for - _String_
271278
- `branch` - Optional branch to analyze for measures - _String_
272279
- `metricKeys` - Optional metric keys to retrieve (e.g. nloc, complexity, violations, coverage) - _String[]_
273280
- `pullRequest` - Optional pull request identifier to analyze for measures - _String_
274281

275282
### Metrics
276283

277-
- **search_metrics** - Search for metrics
284+
- **search_metrics** - Search for SonarQube metrics.
278285
- `p` - Optional page number (default: 1) - _Integer_
279286
- `ps` - Optional page size. Must be greater than 0 and less than or equal to 500 (default: 100) - _Integer_
280287

281-
### Enterprises
282-
283-
**Note: Enterprises are only available when connecting to SonarQube Cloud.**
284-
285-
- **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.
286-
- `enterpriseKey` - Optional enterprise key to filter results - _String_
287-
288288
### Portfolios
289289

290-
- **list_portfolios** - List portfolios available in SonarQube with filtering and pagination options.
290+
- **list_portfolios** - List enterprise portfolios available in SonarQube with filtering and pagination options.
291291

292292
**For SonarQube Server:**
293293
- `q` - Optional search query to filter portfolios by name or key - _String_
@@ -305,40 +305,40 @@ When using custom certificates, you can modify your MCP configuration to mount t
305305

306306
### Projects
307307

308-
- **search_my_sonarqube_projects** - Find Sonar projects in my organization
308+
- **search_my_sonarqube_projects** - Find SonarQube projects. The response is paginated.
309309
- `page` - Optional page number - _String_
310310

311311
### Quality Gates
312312

313-
- **get_project_quality_gate_status** - Get the Quality Gate Status for the project
313+
- **get_project_quality_gate_status** - Get the Quality Gate Status for the SonarQube project.
314314
- `analysisId` - Optional analysis ID - _String_
315315
- `branch` - Optional branch key - _String_
316316
- `projectId` - Optional project ID - _String_
317317
- `projectKey` - Optional project key - _String_
318318
- `pullRequest` - Optional pull request ID - _String_
319319

320320

321-
- **list_quality_gates** - List all quality gates in the organization
321+
- **list_quality_gates** - List all quality gates in my SonarQube.
322322

323323
### Rules
324324

325-
- **list_rule_repositories** - List rule repositories available in SonarQube
325+
- **list_rule_repositories** - List rule repositories available in SonarQube.
326326
- `language` - Optional language key - _String_
327327
- `q` - Optional search query - _String_
328328

329329

330-
- **show_rule** - Shows detailed information about a SonarQube rule
330+
- **show_rule** - Shows detailed information about a SonarQube rule.
331331
- `key` - Rule key - _Required String_
332332

333333
### Sources
334334

335-
- **get_raw_source** - Get source code as raw text. Require 'See Source Code' permission on file
335+
- **get_raw_source** - Get source code as raw text from SonarQube. Require 'See Source Code' permission on file.
336336
- `key` - File key - _Required String_
337337
- `branch` - Optional branch key - _String_
338338
- `pullRequest` - Optional pull request id - _String_
339339

340340

341-
- **get_scm_info** - Get SCM information of source files. Require See Source Code permission on file's project
341+
- **get_scm_info** - Get SCM information of SonarQube source files. Require See Source Code permission on file's project.
342342
- `key` - File key - _Required String_
343343
- `commits_by_line` - Group lines by SCM commit if value is false, else display commits for each line - _String_
344344
- `from` - First line to return. Starts at 1 - _Number_
@@ -348,31 +348,31 @@ When using custom certificates, you can modify your MCP configuration to mount t
348348

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

351-
- **get_system_health** - Get the health status of SonarQube Server instance
351+
- **get_system_health** - Get the health status of SonarQube Server instance. Returns GREEN (fully operational), YELLOW (usable but needs attention), or RED (not operational).
352352

353353

354-
- **get_system_info** - Get detailed information about SonarQube Server system configuration including JVM state, database, search indexes, and settings. Requires 'Administer' permissions
354+
- **get_system_info** - Get detailed information about SonarQube Server system configuration including JVM state, database, search indexes, and settings. Requires 'Administer' permissions.
355355

356356

357-
- **get_system_logs** - Get SonarQube Server system logs in plain-text format. Requires system administration permission
357+
- **get_system_logs** - Get SonarQube Server system logs in plain-text format. Requires system administration permission.
358358
- `name` - Optional name of the logs to get. Possible values: access, app, ce, deprecation, es, web. Default: app - _String_
359359

360360

361-
- **ping_system** - Ping the SonarQube Server system to check if it's alive
361+
- **ping_system** - Ping the SonarQube Server system to check if it's alive. Returns 'pong' as plain text.
362362

363363

364-
- **get_system_status** - Get state information about SonarQube Server
364+
- **get_system_status** - Get state information about SonarQube Server. Returns status (STARTING, UP, DOWN, RESTARTING, DB_MIGRATION_NEEDED, DB_MIGRATION_RUNNING), version, and id.
365365

366366
### Webhooks
367367

368-
- **create_webhook** - Create a new webhook for the organization or project. Requires 'Administer' permission on the specified project, or global 'Administer' permission
368+
- **create_webhook** - Create a new webhook for the SonarQube organization or project. Requires 'Administer' permission on the specified project, or global 'Administer' permission.
369369
- `name` - Webhook name - _Required String_
370370
- `url` - Webhook URL - _Required String_
371371
- `projectKey` - Optional project key for project-specific webhook - _String_
372372
- `secret` - Optional webhook secret for securing the webhook payload - _String_
373373

374374

375-
- **list_webhooks** - List all webhooks for the organization or project. Requires 'Administer' permission on the specified project, or global 'Administer' permission
375+
- **list_webhooks** - List all webhooks for the SonarQube organization or project. Requires 'Administer' permission on the specified project, or global 'Administer' permission.
376376
- `projectKey` - Optional project key to list project-specific webhooks - _String_
377377

378378
## Troubleshooting

src/main/java/org/sonarsource/sonarqube/mcp/tools/analysis/AnalysisTool.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public class AnalysisTool extends Tool {
5252
public AnalysisTool(BackendService backendService, ServerApi serverApi) {
5353
super(new SchemaToolBuilder()
5454
.setName(TOOL_NAME)
55-
.setDescription("Analyze a code snippet with Sonar analyzers to find Sonar issues in it.")
55+
.setDescription("Analyze a file or code snippet with SonarQube analyzers to identify code quality and security issues. " +
56+
"Specify the language of the snippet to improve analysis accuracy.")
5657
.addRequiredStringProperty(PROJECT_KEY_PROPERTY, "The SonarQube project key")
5758
.addRequiredStringProperty(SNIPPET_PROPERTY, "Code snippet or full file content")
5859
.addStringProperty(LANGUAGE_PROPERTY, "Language of the code snippet")
@@ -157,6 +158,9 @@ private static String buildResponseFromAnalysisResults(AnalyzeFilesResponse resp
157158
}
158159
}
159160

161+
stringBuilder.append("\nDisclaimer: Analysis results might not be fully accurate as the code snippet is not part of a complete project context." +
162+
" Use SonarQube for IDE for better results, or setup a full project analysis in SonarQube Server or Cloud.");
163+
160164
return stringBuilder.toString().trim();
161165
}
162166

src/main/java/org/sonarsource/sonarqube/mcp/tools/dependencyrisks/SearchDependencyRisksTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class SearchDependencyRisksTool extends Tool {
3434
public SearchDependencyRisksTool(ServerApi serverApi) {
3535
super(new SchemaToolBuilder()
3636
.setName(TOOL_NAME)
37-
.setDescription("Search for software composition analysis issues (dependency risks) of a project, " +
37+
.setDescription("Search for software composition analysis issues (dependency risks) of a SonarQube project, " +
3838
"paired with releases that appear in the analyzed project, application, or portfolio.")
3939
.addRequiredStringProperty(PROJECT_KEY_PROPERTY, "The project key")
4040
.addStringProperty(BRANCH_KEY_PROPERTY, "The branch key")

src/main/java/org/sonarsource/sonarqube/mcp/tools/enterprises/ListEnterprisesTool.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public ListEnterprisesTool(ServerApi serverApi) {
3737
private static McpSchema.Tool createToolDefinition() {
3838
return new SchemaToolBuilder()
3939
.setName(TOOL_NAME)
40-
.setDescription("List enterprises available in SonarQube Cloud. Available only for SonarQube Cloud instances.")
40+
.setDescription("List the enterprises available in SonarQube Cloud that you have access to. " +
41+
"Use this tool to discover enterprise IDs that can be used with other tools.")
4142
.addStringProperty(ENTERPRISE_KEY_PROPERTY, "Optional enterprise key to filter results")
4243
.build();
4344
}

src/main/java/org/sonarsource/sonarqube/mcp/tools/issues/SearchIssuesTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class SearchIssuesTool extends Tool {
3434
public SearchIssuesTool(ServerApi serverApi) {
3535
super(new SchemaToolBuilder()
3636
.setName(TOOL_NAME)
37-
.setDescription("Search for Sonar issues in my organization's projects.")
37+
.setDescription("Search for SonarQube issues in my organization's projects.")
3838
.addArrayProperty(PROJECTS_PROPERTY, "string", "An optional list of Sonar projects to look in")
3939
.addStringProperty(PULL_REQUEST_ID_PROPERTY, "The identifier of the Pull Request to look in")
4040
.addNumberProperty(PAGE_PROPERTY, "An optional page number. Defaults to 1.")

src/main/java/org/sonarsource/sonarqube/mcp/tools/languages/ListLanguagesTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class ListLanguagesTool extends Tool {
3131
public ListLanguagesTool(ServerApi serverApi) {
3232
super(new SchemaToolBuilder()
3333
.setName(TOOL_NAME)
34-
.setDescription("List all programming languages supported in this instance")
34+
.setDescription("List all programming languages supported in this SonarQube instance")
3535
.addStringProperty(QUERY_PROPERTY, "Optional pattern to match language keys/names against")
3636
.build());
3737
this.serverApi = serverApi;

src/main/java/org/sonarsource/sonarqube/mcp/tools/measures/GetComponentMeasuresTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class GetComponentMeasuresTool extends Tool {
3535
public GetComponentMeasuresTool(ServerApi serverApi) {
3636
super(new SchemaToolBuilder()
3737
.setName(TOOL_NAME)
38-
.setDescription("Get measures for a component (project, directory, file).")
38+
.setDescription("Get SonarQube measures for a component (project, directory, file).")
3939
.addStringProperty(COMPONENT_PROPERTY, "The component key to get measures for")
4040
.addStringProperty(BRANCH_PROPERTY, "The branch to analyze for measures")
4141
.addArrayProperty(METRIC_KEYS_PROPERTY, "string", "The metric keys to retrieve (e.g. nloc, complexity, violations, coverage)")

src/main/java/org/sonarsource/sonarqube/mcp/tools/metrics/SearchMetricsTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class SearchMetricsTool extends Tool {
3232
public SearchMetricsTool(ServerApi serverApi) {
3333
super(new SchemaToolBuilder()
3434
.setName(TOOL_NAME)
35-
.setDescription("Search for metrics")
35+
.setDescription("Search for SonarQube metrics")
3636
.addNumberProperty(PAGE_PROPERTY, "1-based page number (default: 1)")
3737
.addNumberProperty(PAGE_SIZE_PROPERTY, "Page size. Must be greater than 0 and less than or equal to 500 (default: 100)")
3838
.build());

src/main/java/org/sonarsource/sonarqube/mcp/tools/portfolios/ListPortfoliosTool.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private static McpSchema.Tool createToolDefinition(ServerApi serverApi) {
4646
.setName(TOOL_NAME);
4747

4848
if (serverApi.isSonarQubeCloud()) {
49-
builder.setDescription("List enterprise portfolios with filtering options.")
49+
builder.setDescription("List enterprise portfolios available in SonarQube Cloud with filtering and pagination options.")
5050
.addStringProperty(ENTERPRISE_ID_PROPERTY, "Enterprise uuid. Can be omitted only if 'favorite' parameter is supplied with value true")
5151
.addStringProperty(QUERY_PROPERTY, "Search query to filter portfolios by name")
5252
.addBooleanProperty(FAVORITE_PROPERTY, "Required to be true if 'enterpriseId' parameter is omitted. " +
@@ -55,7 +55,7 @@ private static McpSchema.Tool createToolDefinition(ServerApi serverApi) {
5555
.addNumberProperty(PAGE_INDEX_PROPERTY, "Index of the page to fetch (default: 1)")
5656
.addNumberProperty(PAGE_SIZE_PROPERTY, "Size of the page to fetch (default: 50)");
5757
} else {
58-
builder.setDescription("List portfolios available in SonarQube Server with filtering options.")
58+
builder.setDescription("List portfolios available in SonarQube Server with filtering and pagination options.")
5959
.addStringProperty(QUERY_PROPERTY, "Search query to filter portfolios by name or key")
6060
.addBooleanProperty(FAVORITE_PROPERTY, "If true, only returns favorite portfolios")
6161
.addNumberProperty(PAGE_INDEX_PROPERTY, "1-based page number (default: 1)")

src/main/java/org/sonarsource/sonarqube/mcp/tools/projects/SearchMyProjectsTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class SearchMyProjectsTool extends Tool {
3131
public SearchMyProjectsTool(ServerApi serverApi) {
3232
super(new SchemaToolBuilder()
3333
.setName(TOOL_NAME)
34-
.setDescription("Find Sonar projects. The response is paginated.")
34+
.setDescription("Find SonarQube projects. The response is paginated.")
3535
.addStringProperty(PAGE_PROPERTY, "An optional page number. Defaults to 1.")
3636
.build());
3737
this.serverApi = serverApi;

0 commit comments

Comments
 (0)