Skip to main content
Glama
rajbos

GHAS MCP server (GitHub Advanced Security)

list_dependabot_alerts

Retrieve current GitHub Dependabot alerts for a repository to view and manage security vulnerabilities. Input repository owner and name to access detailed alerts.

Instructions

List the current GitHub Dependabot alerts for a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes
repoYes

Implementation Reference

  • The core handler function that validates access token and uses Octokit to fetch and return Dependabot alerts for the specified GitHub repository.
    export async function listDependabotAlerts(owner: string, repo: string) {
        const octokit = await validateAccessToken(owner, repo);
    
        console.log(`Fetching Dependabot alerts for repository: [${owner}/${repo}]`);
        console.log("Starting to fetch Dependabot alerts...");
        try {
            const { data } = await octokit.rest.dependabot.listAlertsForRepo({
                owner,
                repo
            });
            console.log(`Fetched [${data.length}] Dependabot alerts.`);
            return data;
        } catch (error) {
            console.error("Error fetching Dependabot alerts:", error);
            throw error;
        }
    }
  • src/index.ts:64-71 (registration)
    Registers the tool in the ListTools response with name, description, and Zod-based input schema for owner and repo.
    {
        name: "list_dependabot_alerts",
        description: "List the current GitHub Dependabot alerts for a repository",
        inputSchema: zodToJsonSchema(z.object({
            owner: z.string(),
            repo: z.string(),
        })),
    },
  • src/index.ts:96-102 (registration)
    Dispatches the tool call by parsing arguments with Zod schema and invoking the listDependabotAlerts handler, returning JSON-formatted alerts.
    case "list_dependabot_alerts": {
        const args = z.object({ owner: z.string(), repo: z.string() }).parse(request.params.arguments);
        const alerts = await listDependabotAlerts(args.owner, args.repo);
        return {
            content: [{ type: "text", text: JSON.stringify(alerts, null, 2) }],
        };
    }
  • Zod schema definition for the tool's input parameters: owner and repo strings.
    inputSchema: zodToJsonSchema(z.object({
        owner: z.string(),
        repo: z.string(),
    })),
  • Helper function called by the handler to validate GitHub token access and permissions for the repository, returning an authenticated Octokit instance.
    async function validateAccessToken(owner: string, repo: string): Promise<Octokit> {
    
        console.log("Validating GitHub Personal Access Token...");
    
        let authToken = null;
        if (process.env.GITHUB_PERSONAL_ACCESS_TOKEN_USE_GHCLI) {
            const token = getGitHubToken();
            authToken = token;
        } else {
            if (!process.env.GITHUB_PERSONAL_ACCESS_TOKEN) {
                throw new Error("GITHUB_PERSONAL_ACCESS_TOKEN is not set in environment variables. This is needed to be able to find code scanning alerts.");
            } else {
                console.log(`GITHUB_PERSONAL_ACCESS_TOKEN is set in environment variables with length: [${process.env.GITHUB_PERSONAL_ACCESS_TOKEN.length}]`);
                authToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN.trim();
            }
        }
    
        const octokit = new Octokit({
            auth: authToken
        });
    
        // Validate token access and scope
        try {
            console.log("Starting to validate token access and scope...");
            const user = await octokit.rest.users.getAuthenticated();
            console.log(`Authenticated as: [${user.data.login}]`);
            const repoInfo = await octokit.rest.repos.get({
                owner,
                repo
            });
    
            console.log(`Repository information fetched: [${repoInfo.data.name}]`);
            if (!repoInfo.data.permissions || !repoInfo.data.permissions.admin) {
                throw new Error("The provided token does not have admin access to the repository. Admin access is required to fetch security information.");
            } else {
                console.log("Token has admin access to the repository.");
            }
            console.log("Token has sufficient permissions for the repository.");
        } catch (error) {
            console.error("Error validating token or repository access:", error);
            throw new Error("Failed to validate token or repository access. Ensure the token has the necessary scopes and permissions.");
        }
    
        return octokit;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists alerts but does not describe key behaviors like whether it requires authentication, rate limits, pagination, or what the output format looks like. For a tool with zero annotation coverage, this lack of detail is a significant gap, warranting a score of 2.

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, efficient sentence: 'List the current GitHub Dependabot alerts for a repository.' It is front-loaded with the core action and resource, with no wasted words or unnecessary details. This makes it highly concise and well-structured, earning a score of 5.

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 tool's complexity (listing security alerts), lack of annotations, and no output schema, the description is incomplete. It does not cover behavioral aspects like authentication needs, rate limits, or output format, which are crucial for an AI agent to use the tool effectively. With these gaps, the description falls short of being fully helpful, resulting in a score of 2.

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 input schema has 2 parameters (owner and repo) with 0% description coverage, meaning the schema provides no semantic details. The description does not add any parameter-specific information, such as explaining what 'owner' and 'repo' refer to or their expected formats. Since the description does not compensate for the low schema coverage, the baseline score of 3 is applied, as it neither adds value nor fully addresses the gap.

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 tool's purpose: 'List the current GitHub Dependabot alerts for a repository.' It specifies the verb ('List'), resource ('GitHub Dependabot alerts'), and scope ('for a repository'), which is specific and actionable. However, it does not explicitly differentiate from sibling tools like 'list_code_scanning_alerts' or 'list_secret_scanning_alerts', which reduces the score from a 5 to a 4.

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 alternatives. It does not mention sibling tools or any context for choosing this tool over others, such as for dependency-related security issues. Without explicit usage instructions or exclusions, the score is a 2, as it offers minimal guidance beyond the basic purpose.

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/rajbos/ghas-mcp-server'

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