Skip to main content
Glama

get_commit_statuses

Retrieve GitHub commit statuses to check build results, test outcomes, and deployment states for specific repository references.

Instructions

Get statuses for a commit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
repoYesRepository name
refYesThe ref (SHA, branch name, or tag name) to get statuses for

Implementation Reference

  • The core handler function that fetches commit statuses from the GitHub API endpoint `/repos/{owner}/{repo}/commits/{ref}/statuses` and parses the response using Zod.
    export async function getCommitStatuses(
      github_pat: string,
      owner: string,
      repo: string,
      ref: string
    ): Promise<z.infer<typeof CommitStatusSchema>[]> {
      const response = await githubRequest(
        github_pat,
        `https://api.github.com/repos/${owner}/${repo}/commits/${ref}/statuses`
      );
      return z.array(CommitStatusSchema).parse(response);
    }
  • Zod input schemas: GetCommitStatusesSchema (public) and _GetCommitStatusesSchema (internal with github_pat) used for validation.
    export const GetCommitStatusesSchema = z.object({
      owner: z.string().describe("Repository owner (username or organization)"),
      repo: z.string().describe("Repository name"),
      ref: z.string().describe("The ref (SHA, branch name, or tag name) to get statuses for")
    });
    
    export const _GetCommitStatusesSchema = GetCommitStatusesSchema.extend({
      github_pat: z.string().describe("GitHub Personal Access Token"),
    });
  • src/index.ts:217-220 (registration)
    Tool registration in the listTools handler, defining name, description, and inputSchema.
      name: "get_commit_statuses",
      description: "Get statuses for a commit",
      inputSchema: zodToJsonSchema(statuses.GetCommitStatusesSchema),
    },
  • src/index.ts:629-636 (registration)
    Dispatch handler in the CallToolRequest switch statement that validates arguments and invokes the getCommitStatuses function.
    case "get_commit_statuses": {
      const args = statuses._GetCommitStatusesSchema.parse(params.arguments);
      const { github_pat, owner, repo, ref } = args;
      const result = await statuses.getCommitStatuses(github_pat, owner, repo, ref);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }

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/MissionSquad/mcp-github'

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