Skip to main content
Glama

get_gist

Retrieve a specific GitHub gist by providing its ID. Use this tool to access and manage gist content efficiently within the mcp-github server.

Instructions

Get a specific gist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gist_idYesThe ID of the gist

Implementation Reference

  • Core handler function that performs the GitHub API request to fetch a specific gist by ID and parses the response using 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); }
  • src/index.ts:243-247 (registration)
    Registration of the 'get_gist' tool in the list returned by ListToolsRequestHandler.
    { name: "get_gist", description: "Get a specific gist", inputSchema: zodToJsonSchema(gists.GetGistSchema), },
  • MCP server request handler for 'get_gist' tool: parses arguments, calls gists.getGist, and formats response.
    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) }], }; }
  • Zod input schemas for get_gist: GetGistSchema (public) and _GetGistSchema (internal with github_pat). Used for validation and JsonSchema conversion.
    export const GetGistSchema = z.object({ gist_id: z.string().describe("The ID of the gist"), }); export const _GetGistSchema = GetGistSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
  • Output schema for parsing GitHub Gist API response in getGist.
    export const GistSchema = z.object({ url: z.string(), forks_url: z.string(), commits_url: z.string(), id: z.string(), node_id: z.string(), git_pull_url: z.string(), git_push_url: z.string(), html_url: z.string(), files: GistFileSchema, public: z.boolean(), created_at: z.string(), updated_at: z.string(), description: z.string().nullable(), comments: z.number(), user: GitHubIssueAssigneeSchema.nullable(), comments_url: z.string(), owner: GitHubIssueAssigneeSchema.nullable(), truncated: z.boolean().optional(), });

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