list_projects
Retrieve GitHub projects with specified status filters to manage workflows and track progress in project management systems.
Instructions
List GitHub projects
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| limit | No |
Implementation Reference
- Core handler logic for list_projects tool: fetches all projects from repository, filters by status (active/closed/all), applies limit, handles errors.async listProjects(status: string = 'active', limit: number = 10): Promise<Project[]> { try { const projects = await this.projectRepo.findAll(); // Filter by status if needed let filteredProjects = projects; if (status !== 'all') { const resourceStatus = status === 'active' ? ResourceStatus.ACTIVE : ResourceStatus.CLOSED; filteredProjects = projects.filter(project => project.status === resourceStatus); } // Apply limit return filteredProjects.slice(0, limit); } catch (error) { throw this.mapErrorToMCPError(error); } }
- src/infrastructure/tools/ToolRegistry.ts:194-194 (registration)Registers the listProjectsTool in the central ToolRegistry singleton during initialization.this.registerTool(listProjectsTool);
- Defines the complete ToolDefinition for list_projects including name, description, Zod input schema (status: enum['active','closed','all'], limit?: number), and usage examples.export const listProjectsTool: ToolDefinition<ListProjectsArgs> = { name: "list_projects", description: "List GitHub projects", schema: listProjectsSchema as unknown as ToolSchema<ListProjectsArgs>, examples: [ { name: "List active projects", description: "List all active GitHub projects", args: { status: "active", limit: 5 } } ] };
- src/index.ts:262-263 (handler)MCP server request handler dispatches call_tool 'list_projects' to ProjectManagementService.listProjects after validation.case "list_projects": return await this.service.listProjects(args.status, args.limit);
- GitHubProjectRepository.findAll(): Executes GraphQL query to fetch up to 100 ProjectsV2 from repository/org, converts GitHub response to domain Project objects.async findAll(): Promise<Project[]> { const query = ` query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { projectsV2(first: 100) { nodes { id title shortDescription closed createdAt updatedAt } } } } `; const response = await this.graphql<ListProjectsResponse>(query, { owner: this.owner, repo: this.repo, }); return response.repository.projectsV2.nodes.map((project: GitHubProject) => ({ id: project.id, type: ResourceType.PROJECT, title: project.title, description: project.shortDescription || "", owner: this.owner, number: parseInt(project.id.split('_').pop() || '0'), url: `https://github.com/orgs/${this.owner}/projects/${parseInt(project.id.split('_').pop() || '0')}`, status: project.closed ? ResourceStatus.CLOSED : ResourceStatus.ACTIVE, visibility: "private", views: [], fields: [], createdAt: project.createdAt, updatedAt: project.updatedAt, closed: project.closed })); }