Skip to main content
Glama

Opsphere — DevOps & SRE Intelligence

SonarQube duplicated code

sq_duplications_show
Read-only

Find duplicated code in a project: lists files with duplicated lines and, by default, duplication blocks (line ranges + duplicate file paths) for the top files. Use when the user asks where code is duplicated, código duplicado, or duplication blocks. For issue-level detail (code smells, bugs), use sq_issues_search instead.

Input Schema

NameRequiredDescriptionDefault
fileNoOptional file path or component key — when set, returns blocks for that file only
pageNo
branchNo
projectYesSonarQube project key, SonarCloud org_project key (e.g. cepsadigital_my-repo), or sonarcloud.io overview URL
pageSizeNo
topFilesNoHow many top duplicated files to expand with line blocks (default 5, 0 = list only)
context_idNoOptional explicit Connection Hub work context (ctx_*). Omit to use the conversation's active workspace; global Hub tools ignore it.

Output Schema

NameRequiredDescriptionDefault
okYes
dataYes
contractVersionYes
dataSchemaVersionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed23 schema fields changed
    • changedOutput schema / properties / data / additionalProperties
      Previous value: -trueNew value: +false
    • removedOutput schema / properties / data / properties / analyses
      Removed value: -{
      -  "$ref": "#/properties/data/properties/projects"
      -}
    • removedOutput schema / properties / data / properties / branches
      Removed value: -{
      -  "$ref": "#/properties/data/properties/projects"
      -}
    • removedOutput schema / properties / data / properties / count
      Removed value: -{
      -  "type": "number"
      -}
    • removedOutput schema / properties / data / properties / duplications
      Removed value: -{
      -  "$ref": "#/properties/data/properties/projects/items"
      -}
    • addedOutput schema / properties / data / properties / family
      Added value: +{
      +  "const": "sonarqube",
      +  "type": "string"
      +}
    • addedOutput schema / properties / data / properties / gaps
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • removedOutput schema / properties / data / properties / issues
      Removed value: -{
      -  "$ref": "#/properties/data/properties/projects"
      -}
    • removedOutput schema / properties / data / properties / measures
      Removed value: -{
      -  "$ref": "#/properties/data/properties/projects"
      -}
    • addedOutput schema / properties / data / properties / operation
      Added value: +{
      +  "const": "sq_duplications_show",
      +  "type": "string"
      +}
    • addedOutput schema / properties / data / properties / partial
      Added value: +{
      +  "type": "boolean"
      +}
    • removedOutput schema / properties / data / properties / project
      Removed value: -{
      -  "$ref": "#/properties/data/properties/projects/items"
      -}
    • removedOutput schema / properties / data / properties / projects
      Removed value: -{
      -  "items": {
      -    "additionalProperties": true,
      -    "properties": {},
      -    "type": "object"
      -  },
      -  "type": "array"
      -}
    • removedOutput schema / properties / data / properties / pullRequests
      Removed value: -{
      -  "$ref": "#/properties/data/properties/projects"
      -}
    • removedOutput schema / properties / data / properties / qualityGate
      Removed value: -{
      -  "$ref": "#/properties/data/properties/projects/items"
      -}
    • addedOutput schema / properties / data / properties / records
      Added value: +{
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "assignee": {
      +        "type": "string"
      +      },
      +      "body": {
      +        "type": "string"
      +      },
      +      "component": {
      +        "type": "string"
      +      },
      +      "createdAt": {
      +        "type": "string"
      +      },
      +      "environment": {
      +        "type": "string"
      +      },
      +      "facts": {
      +        "items": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "name": {
      +              "type": "string"
      +            },
      +            "value": {
      +              "anyOf": [
      +                {
      +                  "type": "string"
      +                },
      +                {
      +                  "type": "number"
      +                },
      +                {
      +                  "type": "boolean"
      +                },
      +                {
      +                  "type": "null"
      +                },
      +                {
      +                  "items": {
      +                    "type": [
      +                      "string",
      +                      "number",
      +                      "boolean",
      +                      "null"
      +                    ]
      +                  },
      +                  "type": "array"
      +                }
      +              ]
      +            }
      +          },
      +          "required": [
      +            "name",
      +            "value"
      +          ],
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "id": {
      +        "type": "string"
      +      },
      +      "key": {
      +        "type": "string"
      +      },
      +      "name": {
      +        "type": "string"
      +      },
      +      "priority": {
      +        "type": "string"
      +      },
      +      "project": {
      +        "type": "string"
      +      },
      +      "qualityGate": {
      +        "type": "string"
      +      },
      +      "reporter": {
      +        "type": "string"
      +      },
      +      "rule": {
      +        "type": "string"
      +      },
      +      "status": {
      +        "type": "string"
      +      },
      +      "summary": {
      +        "type": "string"
      +      },
      +      "tags": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "title": {
      +        "type": "string"
      +      },
      +      "type": {
      +        "type": "string"
      +      },
      +      "updatedAt": {
      +        "type": "string"
      +      },
      +      "url": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "facts"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / data / properties / summary
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / data / properties / total
      Added value: +{
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedOutput schema / properties / data / properties / truncated
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / data / properties / warnings
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / data / required
      Added value: +[
      +  "family",
      +  "operation",
      +  "records",
      +  "total",
      +  "partial",
      +  "truncated",
      +  "warnings",
      +  "gaps"
      +]
    • addedOutput schema / properties / dataSchemaVersion
      Added value: +{
      +  "const": 2,
      +  "type": "number"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "contractVersion",
      -  "ok",
      -  "data"
      -]New value: +[
      +  "contractVersion",
      +  "dataSchemaVersion",
      +  "ok",
      +  "data"
      +]
  2. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already establish that this is a safe read-only operation, so the main behavioral addition is the default expansion of top duplicated files into line-range blocks, which is useful context. It does not cover auth, rate limits, or pagination behavior, but it adds meaningful operational detail beyond the annotations.

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?

Three tight sentences front-load the purpose, then the trigger cases, then the alternative tool. Every sentence contributes to selection or invocation and there is no filler.

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

Completeness4/5

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

The description is complete enough for an agent to select and invoke the tool: purpose, default block expansion, and sibling routing are covered, and an output schema exists so return values need no explanation. The remaining gap is that pagination and branch parameters are not addressed, which is a minor omission given the schema.

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

Parameters3/5

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

Schema coverage is 57%, so the schema already documents file, project, topFiles, and context_id. The description reinforces the default topFiles expansion behavior, but branch, page, and pageSize are undocumented in both places, so it only partially compensates for the coverage gap.

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

Purpose5/5

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

The description states a specific verb and resource ('Find duplicated code in a project') and explains the output shape: files with duplicated lines plus duplication blocks by default. It also names the sibling tool it is not, making the scope distinguishable without opening the schema.

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

Usage Guidelines5/5

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

It gives explicit trigger language ('where code is duplicated, código duplicado, or duplication blocks') and an explicit exclusion with the alternative: issue-level detail should use sq_issues_search. The routing decision is fully specified.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources