Skip to main content
Glama
mcollina

GitHub Notifications MCP Server

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
NameRequiredDescriptionDefault
thread_idYesThe ID of the notification thread to subscribe to
ignoredNoIf 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")
    });
  • 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);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcollina/mcp-github-notifications'

If you have feedback or need assistance with the MCP directory API, please join our Discord server