Skip to main content
Glama
mcollina

GitHub Notifications MCP Server

get-thread

Retrieve detailed information about a specific GitHub notification thread by providing its thread ID to manage notifications effectively.

Instructions

Get information about a GitHub notification thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thread_idYesThe ID of the notification thread to retrieve

Implementation Reference

  • The getThreadHandler function implements the core logic of the 'get-thread' tool: fetches the GitHub notification thread by ID, formats it, and returns the response or error.
    export async function getThreadHandler(args: z.infer<typeof getThreadSchema>) {
      try {
        // Make request to GitHub API
        const thread = await githubGet<NotificationResponse>(`/notifications/threads/${args.thread_id}`);
    
        // Format the thread for better readability
        const formattedThread = formatNotification(thread);
    
        return {
          content: [{
            type: "text",
            text: `Thread details:\n\n${formattedThread}`
          }]
        };
      } catch (error) {
        return {
          isError: true,
          content: [{
            type: "text",
            text: formatError(`Failed to fetch thread ${args.thread_id}`, error)
          }]
        };
      }
    }
  • Zod schema defining the input parameter 'thread_id' for the 'get-thread' tool.
    export const getThreadSchema = z.object({
      thread_id: z.string().describe("The ID of the notification thread to retrieve")
    });
  • The registerGetThreadTool function registers the 'get-thread' tool with the MCP server, specifying name, description, input schema, and handler.
    export function registerGetThreadTool(server: any) {
      server.tool(
        "get-thread",
        "Get information about a GitHub notification thread",
        getThreadSchema.shape,
        getThreadHandler
      );
    }
  • src/server.ts:40-40 (registration)
    Invocation of the registerGetThreadTool function during server initialization to register the tool.
    registerGetThreadTool(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