Skip to main content
Glama

analyze_code_scanning

Read-onlyIdempotent

Identify static code vulnerabilities by fetching or triggering CodeQL scan alerts for a GitHub repository, including severity and rule details.

Instructions

Fetches or triggers open Code Scanning (CodeQL) alerts for a GitHub repository.

  • Side effects: Read-only by default. If trigger_scan=true, writes to GitHub Actions by creating a workflow_dispatch event.

  • Data sources: GitHub REST API (code-scanning/alerts and actions).

  • Auth requirements: Requires GITHUB_TOKEN with appropriate permissions (security-events).

  • Rate limits: Subject to standard GitHub API limits.

  • Return shape: Returns a JSON array of alert objects including rule_id, severity, rule_description, state, location paths, and html_url.

  • Usage guidelines: Use this tool ONLY for deep static code vulnerability scanning (CodeQL). DO NOT use this tool for other checks:

    • For package/dependency vulnerabilities, use 'analyze_dependencies' instead.

    • For a computed A-F health score grading, use 'get_health_score' instead.

    • For checking standard CI/CD workflow statuses, use 'check_ci_status' instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoYesGitHub repository name (e.g., 'sdk')
ownerYesGitHub repository owner (e.g., 'modelcontextprotocol')
trigger_scanNoIf true, triggers CodeQL workflow then polls for results before returning alerts
poll_timeout_secondsNoMax seconds to wait for CodeQL scan completion (default 300)
poll_interval_secondsNoSeconds between poll attempts (default 15)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
alertsYes
warningNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.1.7
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "alerts": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "alert_number": {
      +            "type": "number"
      +          },
      +          "created_at": {
      +            "type": "string"
      +          },
      +          "end_line": {
      +            "type": "number"
      +          },
      +          "html_url": {
      +            "type": "string"
      +          },
      +          "message_text": {
      +            "type": "string"
      +          },
      +          "most_recent_instance_path": {
      +            "type": "string"
      +          },
      +          "most_recent_instance_start_line": {
      +            "type": "number"
      +          },
      +          "rule_description": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "rule_id": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "severity": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "state": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "rule_id",
      +          "severity",
      +          "rule_description",
      +          "state",
      +          "html_url",
      +          "alert_number",
      +          "created_at"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "warning": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "alerts"
      +  ],
      +  "type": "object"
      +}
  2. Changed2 schema fields changedv1.1.4
    • changedInput schema / properties / owner / description
      Previous value: -"GitHub repository owner"New value: +"GitHub repository owner (e.g., 'modelcontextprotocol')"
    • changedInput schema / properties / repo / description
      Previous value: -"GitHub repository name"New value: +"GitHub repository name (e.g., 'sdk')"
  3. First observedv1.1.3

TDQS

A4/5.0
Behavior1/5

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

The annotations declare readOnlyHint=true, but the description states that trigger_scan=true 'writes to GitHub Actions by creating a workflow_dispatch event.' This is a direct side-effect contradiction. The description is otherwise transparent about auth, rate limits, and return shape, but under the rubric a contradiction with annotations forces a score of 1.

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 well-structured with labeled bullets, front-loads the core action, and every section adds necessary context. It is longer than average, but the tool genuinely has conditional side effects, auth requirements, and alternatives to disambiguate.

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 itself covers side effects, data sources, auth, rate limits, return shape, and alternatives, so it is nearly complete. It loses a point because the readOnlyHint annotation conflicts with the documented trigger_scan write path, leaving the overall tool context internally inconsistent.

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

Parameters4/5

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

The input schema already documents all parameters with 100% coverage, so the baseline is 3. The description adds value by explaining the concrete side effect of trigger_scan=true and by summarizing the alert return shape, going slightly beyond the schema.

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 opens with a specific verb and resource: it 'Fetches or triggers open Code Scanning (CodeQL) alerts for a GitHub repository.' It also names the exact technologies and scope, making it easy to distinguish from sibling tools that handle dependencies, CI status, or health scores.

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?

The description explicitly says to use this tool ONLY for CodeQL static vulnerability scanning and gives concrete alternatives for other cases: analyze_dependencies for dependency vulnerabilities, get_health_score for health scoring, and check_ci_status for CI statuses. This is fully actionable routing guidance.

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