list_issues
Retrieve and filter issues from GitHub repositories by state, labels, date, and sorting criteria to manage project tasks effectively.
Instructions
List issues in a GitHub repository with filtering options
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | ||
| repo | Yes | ||
| direction | No | ||
| labels | No | ||
| page | No | ||
| per_page | No | ||
| since | No | ||
| sort | No | ||
| state | No |
Implementation Reference
- operations/issues.ts:85-103 (handler)Core handler function that builds the GitHub API URL with query parameters and fetches the list of issues.export async function listIssues( owner: string, repo: string, options: Omit<z.infer<typeof ListIssuesOptionsSchema>, "owner" | "repo"> ) { const urlParams: Record<string, string | undefined> = { direction: options.direction, labels: options.labels?.join(","), page: options.page?.toString(), per_page: options.per_page?.toString(), since: options.since, sort: options.sort, state: options.state }; return githubRequest( buildUrl(`https://api.github.com/repos/${owner}/${repo}/issues`, urlParams) ); }
- operations/issues.ts:31-41 (schema)Zod schema defining the input options for the list_issues tool, including owner, repo, and various filters.export const ListIssuesOptionsSchema = z.object({ owner: z.string(), repo: z.string(), direction: z.enum(["asc", "desc"]).optional(), labels: z.array(z.string()).optional(), page: z.number().optional(), per_page: z.number().optional(), since: z.string().optional(), sort: z.enum(["created", "updated", "comments"]).optional(), state: z.enum(["open", "closed", "all"]).optional(), });
- index.ts:123-127 (registration)Tool registration in the listTools response, specifying name, description, and input schema.{ name: "list_issues", description: "List issues in a GitHub repository with filtering options", inputSchema: zodToJsonSchema(issues.ListIssuesOptionsSchema) },
- index.ts:308-315 (handler)Dispatch handler in the main CallToolRequestSchema switch that parses arguments and delegates to the issues.listIssues function.case "list_issues": { const args = issues.ListIssuesOptionsSchema.parse(request.params.arguments); const { owner, repo, ...options } = args; const result = await issues.listIssues(owner, repo, options); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }