list_issues
Retrieve and filter GitHub repository issues by owner, repo, state, labels, sort, and pagination for streamlined issue tracking and management.
Instructions
List issues in a GitHub repository with filtering options
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| direction | No | ||
| labels | No | ||
| owner | Yes | ||
| page | No | ||
| per_page | No | ||
| repo | Yes | ||
| since | No | ||
| sort | No | ||
| state | No |
Implementation Reference
- index.ts:120-124 (registration)Registration of the 'list_issues' tool in the ListTools response, including name, description, and input schema reference.{ name: "list_issues", description: "List issues in a GitHub repository with filtering options", inputSchema: zodToJsonSchema(issues.ListIssuesOptionsSchema) },
- index.ts:441-448 (handler)MCP tool handler for 'list_issues': validates input with schema, calls the listIssues helper, and formats response as text content.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) }], }; }
- operations/issues.ts:32-42 (schema)Zod schema defining the input parameters for the list_issues tool, including owner, repo, and various filtering options.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(), });
- operations/issues.ts:93-111 (helper)Helper function that builds the GitHub API URL for listing issues with query parameters from options and performs the HTTP request.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) ); }