get-thread-subscription
Check subscription status for a GitHub notification thread to determine if you're receiving updates or have muted it.
Instructions
Get subscription status for a GitHub notification thread
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread_id | Yes | The ID of the notification thread to check subscription status |
Implementation Reference
- The main handler function that executes the tool logic: fetches GitHub notification thread subscription status, formats it, and handles errors including 404 for unsubscribed threads.export async function getThreadSubscriptionHandler(args: z.infer<typeof getThreadSubscriptionSchema>) { try { // Make request to GitHub API const subscription = await githubGet<ThreadSubscription>(`/notifications/threads/${args.thread_id}/subscription`); // Format the subscription for better readability const formattedSubscription = formatSubscription(subscription); return { content: [{ type: "text", text: `Subscription status for thread ${args.thread_id}:\n\n${formattedSubscription}` }] }; } catch (error) { if (error instanceof Error && error.message.includes("404")) { return { content: [{ type: "text", text: `You are not subscribed to thread ${args.thread_id}.` }] }; } return { isError: true, content: [{ type: "text", text: formatError(`Failed to fetch subscription for thread ${args.thread_id}`, error) }] }; } }
- Zod schema defining the input parameter: thread_id (string).export const getThreadSubscriptionSchema = z.object({ thread_id: z.string().describe("The ID of the notification thread to check subscription status") });
- src/tools/get-thread-subscription.ts:56-63 (registration)The registration function that adds the tool to the MCP server using server.tool() with name, description, schema, and handler.export function registerGetThreadSubscriptionTool(server: any) { server.tool( "get-thread-subscription", "Get subscription status for a GitHub notification thread", getThreadSubscriptionSchema.shape, getThreadSubscriptionHandler ); }
- src/server.ts:43-43 (registration)Invocation of the registration function in the main server startup.registerGetThreadSubscriptionTool(server);