Skip to main content
Glama

get_gist

Retrieve a specific GitHub gist by its ID to access code snippets, notes, or shared content stored on GitHub's gist platform.

Instructions

Get a specific gist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gist_idYesThe ID of the gist

Implementation Reference

  • The main handler function that fetches a specific GitHub gist by ID using the GitHub API and parses the response with GistSchema.
    export async function getGist(
      github_pat: string,
      gist_id: string
    ): Promise<z.infer<typeof GistSchema>> {
      const response = await githubRequest(
        github_pat,
        `https://api.github.com/gists/${gist_id}`
      );
      return GistSchema.parse(response);
    }
  • Input schema for the get_gist tool, defining the required gist_id parameter.
    export const GetGistSchema = z.object({
      gist_id: z.string().describe("The ID of the gist"),
    });
  • src/index.ts:244-247 (registration)
    Tool registration in the list of tools provided to the MCP server, including name, description, and input schema.
      name: "get_gist",
      description: "Get a specific gist",
      inputSchema: zodToJsonSchema(gists.GetGistSchema),
    },
  • src/index.ts:675-682 (registration)
    Dispatch handler in the switch statement that parses arguments, calls the getGist function, and formats the response for MCP.
    case "get_gist": {
      const args = gists._GetGistSchema.parse(params.arguments);
      const { github_pat, gist_id } = args;
      const result = await gists.getGist(github_pat, gist_id);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }

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/MissionSquad/mcp-github'

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