github_checks_list_for_suite
Retrieve check runs for a specified check suite, with filters for name, status, and pagination to manage results.
Instructions
List check runs in a check suite
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | owner | |
| repo | Yes | repo | |
| check_suite_id | Yes | check_suite_id | |
| check_name | No | Returns check runs with the specified `name`. | |
| status | No | Returns check runs with the specified `status`. | |
| filter | No | Filters check runs by their `completed_at` timestamp. `latest` returns the most recent check runs. | |
| per_page | No | The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." | |
| page | No | The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." |
Implementation Reference
- src/tools/checks.ts:118-120 (handler)Handler for github_checks_list_for_suite: makes a GET request to the GitHub API to list check runs in a check suite, with optional query parameters for check_name, status, filter, per_page, and page.
handler: async (args: Record<string, any>) => { return githubRequest("GET", `/repos/${args.owner}/${args.repo}/check-suites/${args.check_suite_id}/check-runs`, undefined, { check_name: args.check_name, status: args.status, filter: args.filter, per_page: args.per_page, page: args.page }); }, - src/tools/checks.ts:108-117 (schema)Zod input schema for github_checks_list_for_suite defining required params (owner, repo, check_suite_id) and optional params (check_name, status, filter, per_page, page).
inputSchema: z.object({ owner: z.string().describe("owner"), repo: z.string().describe("repo"), check_suite_id: z.string().describe("check_suite_id"), check_name: z.string().optional().describe("Returns check runs with the specified `name`."), status: z.enum(["queued", "in_progress", "completed"]).optional().describe("Returns check runs with the specified `status`."), filter: z.enum(["latest", "all"]).optional().describe("Filters check runs by their `completed_at` timestamp. `latest` returns the most recent check runs."), per_page: z.number().optional().describe("The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), page: z.number().optional().describe("The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"") }), - src/index.ts:62-62 (registration)Registration of all checks tools (including github_checks_list_for_suite) into the MCP server under the 'checks' category.
{ category: "checks", tools: checksTools }, - src/index.ts:110-129 (registration)Registration loop that registers each tool (including github_checks_list_for_suite) with the MCP server using its name, description, inputSchema, and handler.
for (const tool of allTools) { server.tool( tool.name, tool.description, tool.inputSchema.shape as any, async (args: any) => { try { const result = await tool.handler(args as any); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } } ); - src/client.ts:9-59 (helper)Helper function githubRequest that handles HTTP calls to the GitHub API, used by the handler to make the GET request to list check runs in a check suite.
export async function githubRequest<T>( method: string, path: string, body?: Record<string, unknown>, params?: Record<string, string | number | boolean | string[] | undefined> ): Promise<T> { const url = new URL(`${BASE_URL}${path}`); if (params) { for (const [key, value] of Object.entries(params)) { if (value === undefined || value === null || value === "") continue; if (Array.isArray(value)) { url.searchParams.set(key, value.join(",")); } else { url.searchParams.set(key, String(value)); } } } const headers: Record<string, string> = { Authorization: `Bearer ${getToken()}`, Accept: "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28", "User-Agent": "github-mcp/1.0.0", }; if (body) { headers["Content-Type"] = "application/json"; } const res = await fetch(url.toString(), { method, headers, body: body ? JSON.stringify(body) : undefined, }); if (!res.ok) { const text = await res.text().catch(() => ""); let detail = text; try { const json = JSON.parse(text); detail = json.message || text; if (json.errors) detail += ` -- ${JSON.stringify(json.errors)}`; } catch {} throw new Error(`GitHub API error ${res.status}: ${detail}`); } if (res.status === 204) return {} as T; return res.json() as Promise<T>; }