list_gists
Retrieve and manage your GitHub gists to view code snippets, notes, and files. Filter by update time and paginate results for organized access.
Instructions
List gists for the authenticated user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| since | No | Only gists updated at or after this time are returned | |
| per_page | No | Results per page (max 100) | |
| page | No | Page number of the results |
Implementation Reference
- src/operations/gists.ts:94-110 (handler)The main handler function that lists gists for the authenticated user by making a GitHub API request to /gists with optional query parameters.export async function listGists( github_pat: string, options: { since?: string; per_page?: number; page?: number; } = {} ): Promise<z.infer<typeof GistSchema>[]> { const url = new URL("https://api.github.com/gists"); if (options.since) url.searchParams.append("since", options.since); if (options.per_page) url.searchParams.append("per_page", options.per_page.toString()); if (options.page) url.searchParams.append("page", options.page.toString()); const response = await githubRequest(github_pat, url.toString()); return z.array(GistSchema).parse(response); }
- src/operations/gists.ts:54-58 (schema)Zod schema defining the input parameters for the list_gists tool (since, per_page, page).export const ListGistsSchema = z.object({ since: z.string().optional().describe("Only gists updated at or after this time are returned"), per_page: z.number().optional().describe("Results per page (max 100)"), page: z.number().optional().describe("Page number of the results"), });
- src/index.ts:238-242 (registration)Tool registration in the listTools handler, defining name, description, and input schema.{ name: "list_gists", description: "List gists for the authenticated user", inputSchema: zodToJsonSchema(gists.ListGistsSchema), },
- src/index.ts:666-673 (registration)Dispatcher case in the callTool handler that parses arguments, calls the listGists function, and formats the response.case "list_gists": { const args = gists._ListGistsSchema.parse(params.arguments); const { github_pat, ...options } = args; const result = await gists.listGists(github_pat, options); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }