set-thread-subscription
Subscribe to a GitHub notification thread to receive updates or ignore notifications for specific conversations.
Instructions
Subscribe to a GitHub notification thread
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread_id | Yes | The ID of the notification thread to subscribe to | |
| ignored | No | If true, notifications will be ignored |
Implementation Reference
- The main handler function that executes the tool logic: updates GitHub notification thread subscription via API call.export async function setThreadSubscriptionHandler(args: z.infer<typeof setThreadSubscriptionSchema>) { try { // Prepare request body const requestBody = { ignored: args.ignored }; // Make request to GitHub API const subscription = await githubPut<ThreadSubscription>( `/notifications/threads/${args.thread_id}/subscription`, requestBody ); // Format the subscription for better readability const formattedSubscription = formatSubscription(subscription); const status = args.ignored ? "ignoring" : "subscribing to"; return { content: [{ type: "text", text: `Successfully updated subscription by ${status} thread ${args.thread_id}:\n\n${formattedSubscription}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: formatError(`Failed to update subscription for thread ${args.thread_id}`, error) }] }; } }
- Zod schema defining input parameters for the tool: thread_id (string) and ignored (optional boolean).export const setThreadSubscriptionSchema = z.object({ thread_id: z.string().describe("The ID of the notification thread to subscribe to"), ignored: z.boolean().optional().default(false).describe("If true, notifications will be ignored") });
- src/tools/set-thread-subscription.ts:57-64 (registration)Registration function that adds the tool to the MCP server using server.tool().export function registerSetThreadSubscriptionTool(server: any) { server.tool( "set-thread-subscription", "Subscribe to a GitHub notification thread", setThreadSubscriptionSchema.shape, setThreadSubscriptionHandler ); }
- src/server.ts:44-44 (registration)Call to the registration function during MCP server startup to enable the tool.registerSetThreadSubscriptionTool(server);