github_apps_list_webhook_deliveries
Retrieve a paginated list of webhook deliveries for a GitHub App, with optional filtering by delivery status (success or failure) to monitor delivery outcomes.
Instructions
List deliveries for an app webhook
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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)." | |
| cursor | No | Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors. | |
| status | No | Returns webhook deliveries filtered by delivery outcome classification based on `status_code` range. A `status` of `success` returns deliveries with a `status_code` in the 200-399 range (inclusive). A `status` of `failure` returns deliveries with a `status_code` in the 400-599 range (inclusive). |
Implementation Reference
- src/tools/apps.ts:50-52 (handler)The handler function for github_apps_list_webhook_deliveries. It makes a GET request to /app/hook/deliveries with optional query parameters: per_page, cursor, and status.
handler: async (args: Record<string, any>) => { return githubRequest("GET", `/app/hook/deliveries`, undefined, { per_page: args.per_page, cursor: args.cursor, status: args.status }); }, - src/tools/apps.ts:45-49 (schema)The input schema for github_apps_list_webhook_deliveries using Zod. Defines three optional query parameters: per_page (number), cursor (string), and status (enum: success|failure).
inputSchema: z.object({ 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).\""), cursor: z.string().optional().describe("Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors."), status: z.enum(["success", "failure"]).optional().describe("Returns webhook deliveries filtered by delivery outcome classification based on `status_code` range. A `status` of `success` returns deliveries with a `status_code` in the 200-399 range (inclusive). A `status` of `failure` returns deliveries with a `status_code` in the 400-599 range (inclusive).") }), - src/tools/apps.ts:42-53 (registration)The tool registration entry: name 'github_apps_list_webhook_deliveries', description 'List deliveries for an app webhook', inputSchema, and handler are all part of the appsTools array exported from this file.
{ name: "github_apps_list_webhook_deliveries", description: "List deliveries for an app webhook", inputSchema: z.object({ 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).\""), cursor: z.string().optional().describe("Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors."), status: z.enum(["success", "failure"]).optional().describe("Returns webhook deliveries filtered by delivery outcome classification based on `status_code` range. A `status` of `success` returns deliveries with a `status_code` in the 200-399 range (inclusive). A `status` of `failure` returns deliveries with a `status_code` in the 400-599 range (inclusive).") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/app/hook/deliveries`, undefined, { per_page: args.per_page, cursor: args.cursor, status: args.status }); }, }, - src/index.ts:110-130 (registration)The MCP server registers tools by iterating all tool modules (including appsTools) and calling server.tool() with each tool's name, description, schema, and handler wrapper.
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)The githubRequest helper function that all tool handlers call. It constructs the URL, adds query parameters, sets auth headers, and executes the HTTP fetch to GitHub's REST API.
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>; }