Skip to main content
Glama

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
NameRequiredDescriptionDefault
assigneeNo
directionNo
labelsNo
limitNo
milestoneNo
sortNo
statusYes

Implementation Reference

  • 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 } } ] };
  • 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) ); }

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/kunwarVivek/mcp-github-project-manager'

If you have feedback or need assistance with the MCP directory API, please join our Discord server