Skip to main content
Glama
dozzman
by dozzman

summarize_sonarcloud_issues

Summarize SonarCloud issues for a pull request to identify code quality concerns, filter by severity and status, and detect issues since the leak period for efficient resolution.

Instructions

Get a high-level summary of SonarCloud issues for a PR

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
impactSeveritiesNoComma-separated list of impact severities.
issueStatusesNoComma-separated list of issue statuses
pullRequestNoPull request id
sinceLeakPeriodNoTo retrieve issues created since the leak period. If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided. (default: false)
tokenNoSonarCloud API token (optional if set in environment)

Implementation Reference

  • The core handler function that implements the 'summarize_sonarcloud_issues' tool logic. It fetches detailed issues using the internal fetchSonarCloudIssues method, processes them to create counts by severity, type, status, debt, top rules, and affected files, then returns a JSON summary.
    private async summarizeSonarCloudIssues(args: any): Promise<any> {
      // Get the raw issues first
      const issuesResponse = await this.fetchSonarCloudIssues({
        ...args,
        additionalFields: ["_all"],
        facets: ["issueStatuses", "impactSeverities", "types", "rules"],
        ps: 500 // Get more issues for better summary
      });
      
      const data = JSON.parse(issuesResponse.content[0].text);
      const issues = data.issues;
      
      // Create summary
      const summary: IssueSummary = {
        totalIssues: data.summary.total,
        criticalIssues: issues.filter((i: any) => i.severity === "BLOCKER").length,
        highImpactIssues: issues.filter((i: any) => i.severity === "CRITICAL" || i.severity === "MAJOR").length,
        mediumImpactIssues: issues.filter((i: any) => i.severity === "MINOR").length,
        lowImpactIssues: issues.filter((i: any) => i.severity === "INFO").length,
        infoIssues: issues.filter((i: any) => i.severity === "INFO").length,
        bugCount: issues.filter((i: any) => i.type === "BUG").length,
        vulnerabilityCount: issues.filter((i: any) => i.type === "VULNERABILITY").length,
        codeSmellCount: issues.filter((i: any) => i.type === "CODE_SMELL").length,
        securityHotspotCount: issues.filter((i: any) => i.type === "SECURITY_HOTSPOT").length,
        openIssues: issues.filter((i: any) => i.status === "OPEN").length,
        confirmedIssues: issues.filter((i: any) => i.status === "CONFIRMED").length,
        totalDebt: data.debtTotal?.toString() || "0",
        totalEffort: data.effortTotal?.toString() || "0",
        topRules: this.getTopRules(issues),
        filesAffected: new Set(issues.map((i: any) => i.component)).size,
      };
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(summary, null, 2),
          },
        ],
      };
    }
  • The input schema defining the parameters for the 'summarize_sonarcloud_issues' tool, including pullRequest, token, impactSeverities, sinceLeakPeriod, and issueStatuses.
    type: "object",
    properties: {
      pullRequest: {
        type: "string",
        description: "Pull request id",
      },
      token: {
        type: "string",
        description: "SonarCloud API token (optional if set in environment)",
      },
      impactSeverities: {
        type: "array",
        items: {
          type: "string",
          enum: ["INFO", "LOW", "MEDIUM", "HIGH", "BLOCKER"],
        },
        description: "Comma-separated list of impact severities.",
      },
      sinceLeakPeriod: {
        type: "boolean",
        description: "To retrieve issues created since the leak period. If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided. (default: false)",
      },
      issueStatuses: {
        type: "array",
        items: {
          type: "string",
          enum: [
            "OPEN",
            "CONFIRMED",
            "FALSE_POSITIVE",
            "ACCEPTED",
            "FIXED",
          ],
        },
        description: "Comma-separated list of issue statuses",
      },
    },
  • src/index.ts:402-403 (registration)
    Registration of the tool in the main request handler dispatch logic, mapping the tool name to its handler method.
    if (name === "summarize_sonarcloud_issues") {
      return await this.summarizeSonarCloudIssues(args);
  • src/index.ts:347-390 (registration)
    Tool definition and registration in the tools list, including name, description, and input schema for MCP tool discovery.
    {
      name: "summarize_sonarcloud_issues",
      description: "Get a high-level summary of SonarCloud issues for a PR",
      inputSchema: {
        type: "object",
        properties: {
          pullRequest: {
            type: "string",
            description: "Pull request id",
          },
          token: {
            type: "string",
            description: "SonarCloud API token (optional if set in environment)",
          },
          impactSeverities: {
            type: "array",
            items: {
              type: "string",
              enum: ["INFO", "LOW", "MEDIUM", "HIGH", "BLOCKER"],
            },
            description: "Comma-separated list of impact severities.",
          },
          sinceLeakPeriod: {
            type: "boolean",
            description: "To retrieve issues created since the leak period. If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided. (default: false)",
          },
          issueStatuses: {
            type: "array",
            items: {
              type: "string",
              enum: [
                "OPEN",
                "CONFIRMED",
                "FALSE_POSITIVE",
                "ACCEPTED",
                "FIXED",
              ],
            },
            description: "Comma-separated list of issue statuses",
          },
        },
        required: [],
      },
    },
  • Helper function used by the handler to compute the top 10 most frequent rules in the issues for the summary.
    private getTopRules(issues: any[]): Array<{rule: string; count: number}> {
      const ruleCounts = issues.reduce((acc, issue) => {
        acc[issue.rule] = (acc[issue.rule] || 0) + 1;
        return acc;
      }, {} as Record<string, number>);
      
      return Object.entries(ruleCounts)
        .sort(([,a], [,b]) => (b as number) - (a as number))
        .slice(0, 10)
        .map(([rule, count]) => ({rule, count: count as number}));
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves a 'high-level summary' but doesn't explain what that entails—e.g., format, aggregation level, or whether it's read-only or has side effects. This lack of detail is a significant gap for a tool with 5 parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the core purpose without unnecessary words. It's front-loaded and wastes no space, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain the summary format, behavioral traits, or how it differs from the sibling tool, leaving the agent with insufficient context to use the tool effectively beyond basic invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond implying the tool summarizes issues, which is redundant with the tool name. This meets the baseline for high schema coverage but doesn't enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get a high-level summary') and resource ('SonarCloud issues for a PR'), making the purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'fetch_sonarcloud_issues'—both involve retrieving SonarCloud issues, so the distinction between 'summary' and 'fetch' is unclear without explicit comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling 'fetch_sonarcloud_issues', nor does it mention any prerequisites, alternatives, or exclusions. This leaves the agent to guess based on the tool names alone, which is insufficient for reliable selection.

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

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

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

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dozzman/sonarcloud-mcp'

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