Skip to main content
Glama

create_gist

Generate and share code snippets or text files as GitHub gists. Specify public or private visibility, add descriptions, and include multiple files for organized sharing.

Instructions

Create a new gist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoDescription of the gist
filesYesFiles that make up this gist. The key is the filename.
publicYesWhether the gist is public

Implementation Reference

  • The core handler function that executes the tool logic by making a POST request to GitHub's gists API and parsing the response.
    export async function createGist( github_pat: string, description: string | undefined, isPublic: boolean, files: Record<string, { content: string }> ): Promise<z.infer<typeof GistSchema>> { const response = await githubRequest( github_pat, "https://api.github.com/gists", { method: "POST", body: { description, public: isPublic, files, }, } ); return GistSchema.parse(response); }
  • The public input schema definition for the create_gist tool, referenced in registration.
    export const CreateGistSchema = z.object({ description: z.string().optional().describe("Description of the gist"), public: z.boolean().describe("Whether the gist is public"), files: z.record( z.object({ content: z.string().describe("Content of the file"), }) ).describe("Files that make up this gist. The key is the filename."), });
  • src/index.ts:234-237 (registration)
    Tool registration in the list of tools returned by ListToolsRequestHandler.
    name: "create_gist", description: "Create a new gist", inputSchema: zodToJsonSchema(gists.CreateGistSchema), },
  • src/index.ts:657-664 (registration)
    Dispatch handler in CallToolRequestHandler that parses arguments and calls the createGist function.
    case "create_gist": { const args = gists._CreateGistSchema.parse(params.arguments); const { github_pat, description, public: isPublic, files } = args; const result = await gists.createGist(github_pat, description, isPublic, files); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
  • Internal extended schema used for argument parsing in the dispatch handler.
    export const _CreateGistSchema = CreateGistSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });

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