get_webhook_notifications_failed
Retrieve failed webhook notifications for a specific webhook, with options to filter by date range and paginate results.
Instructions
Get the failed webhook notifications
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webhook_id | Yes | ID of the parent resource | |
| cursor | No | Cursor for fetching the next page of results | |
| per_page | No | Number of results per page (default: 25) | |
| start | No | Only show failed notifications created after this date and time | |
| end | No | Only show failed notifications starting before this date and time |
Implementation Reference
- src/tools/webhook_notifications.ts:8-39 (handler)The handler function that executes the tool logic. It calls apiList on GET /webhooks/{webhook_id}/notifications/failed with query params (cursor, per_page, start, end), logs the response, formats the results via formatList, and handles errors via formatError.
server.registerTool( "get_webhook_notifications_failed", { description: "Get the failed webhook notifications", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { webhook_id: z.number().int().positive().describe("ID of the parent resource"), cursor: z.string().optional().describe("Cursor for fetching the next page of results"), per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"), start: z.string().optional().describe("Only show failed notifications created after this date and time"), end: z.string().optional().describe("Only show failed notifications starting before this date and time"), }, }, async ({ webhook_id, cursor, per_page, start, end }) => { try { const result = await apiList<EduframeRecord>(`/webhooks/${webhook_id}/notifications/failed`, { cursor, per_page, start, end, }); void logResponse("get_webhook_notifications_failed", { webhook_id, cursor, per_page, start, end }, result); const toolResult = formatList(result.records, "webhook notifications"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, ); - Input schema definition using Zod. Required: webhook_id (positive integer). Optional: cursor (string), per_page (positive integer), start (string date), end (string date).
inputSchema: { webhook_id: z.number().int().positive().describe("ID of the parent resource"), cursor: z.string().optional().describe("Cursor for fetching the next page of results"), per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"), start: z.string().optional().describe("Only show failed notifications created after this date and time"), end: z.string().optional().describe("Only show failed notifications starting before this date and time"), }, - src/tools/webhook_notifications.ts:7-40 (registration)Registration of the tool via server.registerTool with name 'get_webhook_notifications_failed'. The function registerWebhookNotificationTools is imported and called from src/tools/index.ts (line 61, 124) in the registerAllTools function.
export function registerWebhookNotificationTools(server: McpServer): void { server.registerTool( "get_webhook_notifications_failed", { description: "Get the failed webhook notifications", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { webhook_id: z.number().int().positive().describe("ID of the parent resource"), cursor: z.string().optional().describe("Cursor for fetching the next page of results"), per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"), start: z.string().optional().describe("Only show failed notifications created after this date and time"), end: z.string().optional().describe("Only show failed notifications starting before this date and time"), }, }, async ({ webhook_id, cursor, per_page, start, end }) => { try { const result = await apiList<EduframeRecord>(`/webhooks/${webhook_id}/notifications/failed`, { cursor, per_page, start, end, }); void logResponse("get_webhook_notifications_failed", { webhook_id, cursor, per_page, start, end }, result); const toolResult = formatList(result.records, "webhook notifications"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, ); } - src/api.ts:122-137 (helper)The apiList helper function used to perform the paginated GET request to the Eduframe API. It handles authentication, URL building, fetching, response validation, and cursor-based pagination.
export async function apiList<T>(path: string, query?: Record<string, QueryValue>): Promise<ListResult<T>> { const { token } = getConfig(); const url = buildUrl(path, query); const response = await fetch(url.toString(), { method: "GET", headers: buildHeaders(token), }); await checkResponse(response); const records = (await response.json()) as T[]; const nextCursor = parseNextCursor(response.headers.get("Link")); return { records, nextCursor }; }