list_projects
Retrieve GitHub projects based on their status to manage and organize development workflows efficiently.
Instructions
List GitHub projects
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| limit | No |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"type": "string"
},
"status": {
"type": "string"
}
},
"required": [
"status"
],
"type": "object"
}
Implementation Reference
- Core handler function for the 'list_projects' tool. Fetches all projects from the GitHubProjectRepository, filters by status ('active', 'closed', or 'all'), applies the limit, and returns the list.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); } }
- Zod schema definition for 'list_projects' tool input validation, defining 'status' and 'limit' parameters.// Schema for list_projects tool export const listProjectsSchema = z.object({ status: z.enum(["active", "closed", "all"]).default("active"), limit: z.number().int().positive().default(10).optional(), }); export type ListProjectsArgs = z.infer<typeof listProjectsSchema>;
- src/infrastructure/tools/ToolRegistry.ts:142-144 (registration)Registration of the 'list_projects' tool in the central ToolRegistry during built-in tools initialization.this.registerTool(createProjectTool); this.registerTool(listProjectsTool); this.registerTool(getProjectTool);
- src/infrastructure/tools/ToolSchemas.ts:259-260 (registration)Tool definition object for 'list_projects' including name, description, schema reference, and usage examples, exported for registry.export const listProjectsTool: ToolDefinition<ListProjectsArgs> = { name: "list_projects",
- src/index.ts:243-244 (handler)Dispatch handler in main server that routes 'list_projects' tool calls to the ProjectManagementService.listProjects method.case "list_projects": return await this.service.listProjects(args.status, args.limit);