Connect SonarQube to Toolspoke

Read code-quality issues, quality gates, measures and security hotspots from SonarQube Cloud or SonarQube Server, and triage them. Toolspoke gives your agents 16 of its actions, and you decide which ones each project allows.

Connection
Provider REST API
Authentication
User token
Actions exposed
16
What a call bills
Nothing
Adapter
Maintained by Toolspoke

Connected in three steps

  1. Install SonarQube

    Open the marketplace in your workspace, add SonarQube to the project your agents work in, and it appears on the gateway immediately.

  2. Connect the credential

    Provide the credential SonarQube asks for. Where to get it, and what it has to be able to reach, is the next section.

  3. Give it to an agent

    Describe the job in one sentence and the builder proposes the instructions, the toolkits it needs, a schedule and where it should answer, or start from a catalogue agent. It can use every SonarQube action the project leaves on.

Where the agent answers

  • Slack

    Ask it in a channel or a thread, and it replies in the thread it was asked in.

  • Email

    Email it. Each write waits for a person's go-ahead unless that action is allowed in advance.

  • GitHub

    Mention it on a pull request, and it answers there.

  • Schedule

    A routine wakes it on a schedule, or when a new item matches.

Any agent in the project can use SonarQube, and only the actions the project leaves on.

What SonarQube asks for

User token. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.

User tokenRequired
SonarQube Cloud: avatar → My Account → Security → Generate Tokens. SonarQube Server: avatar → My Account → Security → Generate Tokens, type User Token. A project or global analysis token cannot read issues, so use a User token. It sees exactly what your account sees.
squ_… or a 40-character SonarQube Cloud token
SonarQube URLOptional
Leave blank for SonarQube Cloud (EU). Use https://sonarqube.us for a SonarQube Cloud US organization, or the base URL of your self-hosted SonarQube Server (it has to be publicly reachable).
https://sonarcloud.io

What an agent can do in SonarQube

16 actions, each one declared by name in the connector. A workspace policy grants a person all of them, a hand-picked selection, everything on the read side, everything on the write side, or none.

12 read, 4 write, none destructive

Reads

12

Fetches data and changes nothing.

  • list_favorites

    List the projects the token's user has marked as favourite. Takes no required arguments and works the same on SonarQube Cloud and Server, so it is what an install tests itself with, it fails for an invalid token and for an analysis token, which cannot read anything else here either.

  • search_projects

    Search the projects this account can browse, by name or key. This is where project keys come from, every other read takes one. On SonarQube Cloud the organization key is required.

  • get_component

    Read one project, directory or file by its component key, with its ancestors. Use it to resolve a key from an issue into a readable path and project.

  • get_quality_gate_status

    Read whether a project, branch or pull request passes its quality gate, with each condition, its threshold and the actual value. This is the answer to "is this mergeable".

  • search_issues

    Search issues across one or more projects, filtered by status, severity, software quality, tag, assignee or creation date. Returns each issue's key, rule, message, file and line, the issue key is what transition_issue, assign_issue and add_issue_comment take.

  • get_measures

    Read metric values for a project or file, coverage, bugs, vulnerabilities, code smells, duplicated lines, lines of code and so on. Name the metrics wanted; common keys are coverage, ncloc, bugs, vulnerabilities, code_smells, duplicated_lines_density, security_hotspots and sqale_index.

  • search_hotspots

    List a project's security hotspots, code that needs a human to decide whether it is a vulnerability, filtered by review status. Returns the hotspot keys get_hotspot and review_hotspot take.

  • get_hotspot

    Read one security hotspot with its rule, the risk it describes, its location, and the review comments people have left on it.

  • list_analyses

    List a project's past analyses with their dates, versions and events (quality gate changes, new versions). Use it to find when a project's state changed.

  • list_branches

    List a project's branches with each one's quality gate status and the date of its last analysis.

  • list_pull_requests

    List a project's analysed pull requests with each one's quality gate status.

  • get_rule

    Read one rule, what it checks, why it matters and how to fix it. The rule key comes from an issue or hotspot, e.g. typescript:S1854. On SonarQube Cloud the organization key is required.

Writes

4

Creates or updates something on the other side.

  • transition_issue

    Change an issue's status: confirm, accept, falsepositive, resolve, reopen and so on. A write rather than destructive, because every transition can be reversed with reopen. Accepting or marking false positive does change whether a quality gate passes, so do it only when asked.

  • assign_issue

    Assign an issue to a user by login, or unassign it by leaving assignee out.

  • add_issue_comment

    Add a comment to an issue. Visible to everyone who can browse the project.

  • review_hotspot

    Record a review of a security hotspot, mark it REVIEWED with a resolution (FIXED, SAFE or ACKNOWLEDGED), or put it back to TO_REVIEW. Reversible, so a write; it needs the Administer Security Hotspots permission on the project.

What it will not do

The gateway enforces each of these, so they can be stated flatly.

It cannot call anything else
The 16 actions above are the whole of it. A call to any other name is refused before it reaches SonarQube rather than forwarded on, and connecting your account does not add to the list: it is fixed by the connector, not discovered at run time.
Nothing here deletes
This connector writes to SonarQube, but nothing in it deletes or permanently alters anything.
It reaches no further than your credential
Toolspoke holds no access to SonarQube of its own. Every call carries the credential you stored and nothing besides, so whatever that credential cannot reach, this connector cannot reach either.
It never hears from SonarQube
Nothing is pushed to it. There is no webhook, no subscription and no polling, so this connector cannot notice by itself that something changed in SonarQube. An agent has to ask.
It does not smooth over provider limits
Toolspoke does not retry, queue or back off around SonarQube's own rate limits. A call that SonarQube refuses comes back to the agent as a failed call.

Before you connect it

What can an agent do in SonarQube?

16 named actions: 12 that only read and 4 that write. They include list_favorites, search_projects and get_component. Nothing outside that list is reachable: the connector declares each operation by name rather than proxying whatever an agent asks for.

What credentials does the SonarQube connector need?

User token. The connector asks for user token, and optionally sonarqube url. Values are encrypted at rest and attached to the outbound request by the gateway, so they are never part of the arguments an agent sends and never reach the audit log.

How does an agent get to use SonarQube?

Install SonarQube in a project and every agent in that project can use the actions the project leaves on. Describe a job in one sentence and the builder proposes the instructions, the toolkits it needs, a schedule and where it should answer, or start from a catalogue agent. The agent answers when someone asks it in Slack, emails it or mentions it on a GitHub pull request, or when its routine wakes it.

What does the SonarQube connector not do?

The 16 actions above are the whole of it. A call to any other name is refused before it reaches SonarQube rather than forwarded on, and connecting your account does not add to the list: it is fixed by the connector, not discovered at run time. This connector writes to SonarQube, but nothing in it deletes or permanently alters anything. Toolspoke holds no access to SonarQube of its own. Every call carries the credential you stored and nothing besides, so whatever that credential cannot reach, this connector cannot reach either. Nothing is pushed to it. There is no webhook, no subscription and no polling, so this connector cannot notice by itself that something changed in SonarQube. An agent has to ask. Toolspoke does not retry, queue or back off around SonarQube's own rate limits. A call that SonarQube refuses comes back to the agent as a failed call.

Can I limit which actions an agent can call?

Yes, in two places. The project switches SonarQube's actions on and off one at a time, for everyone in the project at once, and the screen groups them by read, write and destructive so turning off everything that deletes is one click. An individual agent key can then be narrowed further, to particular toolkits in a project and to particular actions in a toolkit. Whatever it was granted, a key never reaches a project its owner cannot.

What gets recorded when an agent calls SonarQube?

Every attempt, with the agent that made it and the person that agent belongs to, the full request payload, the response payload, the status, the duration, and what the call cost in sandbox time and model tokens. Values whose key names a secret are masked out before the record is shown to anyone. An operation the connector marks as not retained never has its response body written at all, so the gateway keeps no second copy of what was read.

Connect SonarQube to Toolspoke

Add SonarQube to a project and give it to an agent.