set-thread-subscription
Subscribe to GitHub notification threads to manage updates and control notification settings for specific discussions.
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 handler function that executes the core logic of the 'set-thread-subscription' tool, handling the GitHub API call to update thread subscription.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 the input parameters for the set-thread-subscription tool.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.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)Invocation of the registration function during server startup.registerSetThreadSubscriptionTool(server);