Skip to main content
Glama

list_projects

Retrieve GitHub projects based on their status to manage and organize development workflows efficiently.

Instructions

List GitHub projects

Input Schema

NameRequiredDescriptionDefault
statusYes
limitNo

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>;
  • Registration of the 'list_projects' tool in the central ToolRegistry during built-in tools initialization.
    this.registerTool(createProjectTool); this.registerTool(listProjectsTool); this.registerTool(getProjectTool);
  • 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",
  • 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);

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/HarshKumarSharma/MCP'

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