Skip to main content
Glama

SonarLint: scan file

sonarlint_scan_file

Run a local static analysis on a single file to detect code-quality, bug, and security issues as JSON after edits.

Instructions

Run a local SonarLint (SonarQube for IDE engine) analysis on a single file and return code-quality, bug and security issues as JSON. Use after editing a file.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "sonarlint_scan_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesFile to analyze (absolute or relative to the workspace root)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full disclosure burden. It usefully states that analysis is local (SonarQube for IDE engine) and that results come back as JSON, but it omits prerequisites such as whether SonarLint must be installed or configured, expected runtime, and whether any files or caches are written.

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?

Two short sentences, both of which earn their place: the first defines the action and output, the second gives the usage cue. The essential information is front-loaded with 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?

For a simple single-parameter tool the definition covers what the tool does, what it returns, and when to reach for it. There is no output schema, but the description summarizes the return payload well; only setup prerequisites and runtime expectations are left unstated.

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 single path parameter is fully documented in the schema, including absolute versus workspace-relative handling. The description adds no further meaning about the path beyond what the schema already provides, so the baseline score of 3 for high coverage is appropriate.

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?

States a specific verb (run a SonarLint analysis) and resource (a single file), plus what it returns: code-quality, bug and security issues as JSON. The scoping phrase 'single file' distinguishes it from the sibling scan_folder and scan_project tools without needing to name them.

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

Usage Guidelines4/5

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

Gives a clear trigger condition with 'Use after editing a file', telling the agent when this tool is appropriate. It stops short of explicit exclusions or naming scan_folder/scan_project as the choice for multi-file work, so the agent must infer the alternative itself.

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