Skip to main content
Glama

create_commit_status

Track and update GitHub commit statuses (success, failure, pending, error) for repositories. Provide a state, target URL, description, and context to manage CI/CD workflows and build notifications.

Instructions

Create a status for a commit (build passed/failed, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNoA string label to differentiate this status from others
descriptionNoA short description of the status
ownerYesRepository owner (username or organization)
repoYesRepository name
shaYesThe SHA of the commit to create a status for
stateYesThe state of the status
target_urlNoThe target URL to associate with this status

Implementation Reference

  • The main handler function that executes the tool logic by making a POST request to the GitHub API to create a commit status.
    export async function createCommitStatus( github_pat: string, owner: string, repo: string, sha: string, state: "error" | "failure" | "pending" | "success", options: { target_url?: string; description?: string; context?: string; } = {} ): Promise<z.infer<typeof CommitStatusSchema>> { const response = await githubRequest( github_pat, `https://api.github.com/repos/${owner}/${repo}/statuses/${sha}`, { method: "POST", body: { state, ...options, }, } ); return CommitStatusSchema.parse(response); }
  • Input schemas for validating tool parameters. CreateCommitStatusSchema is used for tool registration; _CreateCommitStatusSchema (with github_pat) is used for parsing in dispatch.
    export const CreateCommitStatusSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), sha: z.string().describe("The SHA of the commit to create a status for"), state: z.enum(["error", "failure", "pending", "success"]).describe("The state of the status"), target_url: z.string().optional().describe("The target URL to associate with this status"), description: z.string().optional().describe("A short description of the status"), context: z.string().optional().describe("A string label to differentiate this status from others") }); export const _CreateCommitStatusSchema = CreateCommitStatusSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
  • src/index.ts:211-215 (registration)
    Tool registration in the MCP server's listTools response, including name, description, and input schema reference.
    { name: "create_commit_status", description: "Create a status for a commit (build passed/failed, etc.)", inputSchema: zodToJsonSchema(statuses.CreateCommitStatusSchema), },
  • src/index.ts:620-627 (registration)
    Dispatch handler in the MCP server's CallToolRequest that parses arguments and calls the createCommitStatus function.
    case "create_commit_status": { const args = statuses._CreateCommitStatusSchema.parse(params.arguments); const { github_pat, owner, repo, sha, state, ...options } = args; const result = await statuses.createCommitStatus(github_pat, owner, repo, sha, state, options); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
  • Output schema used to parse the GitHub API response for the commit status.
    export const CommitStatusSchema = z.object({ url: z.string(), id: z.number(), node_id: z.string(), state: z.enum(["error", "failure", "pending", "success"]), description: z.string().nullable(), target_url: z.string().nullable(), context: z.string(), created_at: z.string(), updated_at: z.string(), creator: GitHubIssueAssigneeSchema.nullable(), });

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