Skip to main content
Glama
mcollina

GitHub Notifications MCP Server

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
NameRequiredDescriptionDefault
thread_idYesThe 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")
    });
  • 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);

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