mark-notifications-read
Mark GitHub notifications as read to clean up your notification center. Specify a timestamp to mark notifications from a specific time period.
Instructions
Mark GitHub notifications as read
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| last_read_at | No | ISO 8601 timestamp - marks notifications updated at or before this time as read. Default is current time. | |
| read | No | Whether to mark notifications as read or unread |
Implementation Reference
- The main handler function that implements the tool logic: prepares request body with parameters, calls GitHub API via githubPut to mark notifications as read/unread, handles response or error with formatted messages.export async function markNotificationsReadHandler(args: z.infer<typeof markNotificationsReadSchema>) { try { // Prepare request body const requestBody = { last_read_at: args.last_read_at, read: args.read }; // Make request to GitHub API const response = await githubPut<MarkNotificationsReadResponse>("/notifications", requestBody); // Check if notifications are processed asynchronously if (response.message) { return { content: [{ type: "text", text: `${response.message}` }] }; } // Default success message return { content: [{ type: "text", text: `Successfully marked notifications as ${args.read ? 'read' : 'unread'}.${ args.last_read_at ? ` Notifications updated on or before ${new Date(args.last_read_at).toLocaleString()} were affected.` : '' }` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: formatError("Failed to mark notifications as read", error) }] }; } }
- Zod schema defining input parameters for the tool: optional last_read_at timestamp and optional read boolean (default true).export const markNotificationsReadSchema = z.object({ last_read_at: z.string().optional().describe( "ISO 8601 timestamp - marks notifications updated at or before this time as read. Default is current time." ), read: z.boolean().optional().default(true).describe( "Whether to mark notifications as read or unread" ) });
- src/tools/mark-notifications-read.ts:70-77 (registration)Function that registers the tool with the MCP server, specifying name, description, input schema, and handler.export function registerMarkNotificationsReadTool(server: any) { server.tool( "mark-notifications-read", "Mark GitHub notifications as read", markNotificationsReadSchema.shape, markNotificationsReadHandler ); }
- src/server.ts:39-39 (registration)Call to register the mark-notifications-read tool during server initialization.registerMarkNotificationsReadTool(server);