list_issues
Fetch GitHub issues based on status, assignee, labels, milestone, and sorting criteria to streamline project tracking and management.
Instructions
List GitHub issues
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignee | No | ||
| direction | No | ||
| labels | No | ||
| limit | No | ||
| milestone | No | ||
| sort | No | ||
| status | Yes |
Implementation Reference
- src/index.ts:303-304 (handler)MCP tool handler that dispatches list_issues tool calls to the ProjectManagementService.listIssues method.case "list_issues": return await this.service.listIssues(args);
- ToolDefinition for list_issues including Zod input schema, description, and usage examples.export const listIssuesTool: ToolDefinition<ListIssuesArgs> = { name: "list_issues", description: "List GitHub issues", schema: listIssuesSchema as unknown as ToolSchema<ListIssuesArgs>, examples: [ { name: "List open issues for milestone", description: "List open issues assigned to a specific milestone", args: { status: "open", milestone: "1", sort: "updated", direction: "desc", limit: 10 } } ] };
- src/infrastructure/tools/ToolRegistry.ts:209-209 (registration)Registers the listIssuesTool in the central ToolRegistry singleton.this.registerTool(listIssuesTool);
- Core business logic for listing issues: applies filters (status, milestone, labels, assignee), sorting, and limits. Delegates to GitHubIssueRepository.findAll() or findByMilestone().async listIssues(options: { status?: string; milestone?: string; labels?: string[]; assignee?: string; sort?: string; direction?: string; limit?: number; } = {}): Promise<Issue[]> { try { // Set default values const { status = 'open', milestone, labels = [], assignee, sort = 'created', direction = 'desc', limit = 30 } = options; let issues: Issue[]; if (milestone) { // If milestone is specified, get issues for that milestone issues = await this.issueRepo.findByMilestone(milestone); } else { // Otherwise get all issues issues = await this.issueRepo.findAll(); } // Filter by status if (status !== 'all') { const resourceStatus = status === 'open' ? ResourceStatus.ACTIVE : ResourceStatus.CLOSED; issues = issues.filter(issue => issue.status === resourceStatus); } // Filter by labels if provided if (labels.length > 0) { issues = issues.filter(issue => labels.every(label => issue.labels.includes(label)) ); } // Filter by assignee if provided if (assignee) { issues = issues.filter(issue => issue.assignees.includes(assignee) ); } // Sort the issues issues.sort((a, b) => { let valueA, valueB; switch(sort) { case 'updated': valueA = a.updatedAt; valueB = b.updatedAt; break; case 'comments': // Since we don't have comment count in our model, default to created case 'created': default: valueA = a.createdAt; valueB = b.createdAt; } const comparison = valueA.localeCompare(valueB); return direction === 'desc' ? -comparison : comparison; }); // Apply limit return issues.slice(0, limit); } catch (error) { throw this.mapErrorToMCPError(error); } }
- GitHub GraphQL repository method that fetches all issues and maps to domain model. Used by service.listIssues.async findAll(): Promise<Issue[]> { const query = ` query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { issues(first: 100) { nodes { id number title body state createdAt updatedAt assignees(first: 100) { nodes { login } } labels(first: 100) { nodes { name } } milestone { id } } } } } `; const response = await this.graphql<ListIssuesResponse>(query, { owner: this.owner, repo: this.repo, }); return response.repository.issues.nodes.map(issue => this.mapGitHubIssueToIssue(issue) ); }