list_labels
Retrieve all GitHub labels for a project to organize and manage tasks efficiently. Use this tool within the mcp-github-project-manager server to streamline label tracking and project workflows.
Instructions
List all GitHub labels
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- Core handler function that executes the list_labels tool by querying GitHub's GraphQL API to fetch repository labels with optional limit.async listLabels(data: { limit?: number; }): Promise<Array<{ id: string; name: string; color: string; description: string }>> { try { const limit = data.limit || 100; const query = ` query($owner: String!, $repo: String!, $limit: Int!) { repository(owner: $owner, name: $repo) { labels(first: $limit) { nodes { id name color description } } } } `; interface ListLabelsResponse { repository: { labels: { nodes: Array<{ id: string; name: string; color: string; description: string; }> } } } const response = await this.factory.graphql<ListLabelsResponse>(query, { owner: this.factory.getConfig().owner, repo: this.factory.getConfig().repo, limit }); if (!response.repository?.labels?.nodes) { return []; } return response.repository.labels.nodes; } catch (error) { throw this.mapErrorToMCPError(error); } }
- ToolDefinition including Zod input schema, description, and examples for the list_labels tool.export const listLabelsTool: ToolDefinition<ListLabelsArgs> = { name: "list_labels", description: "List all GitHub labels", schema: listLabelsSchema as unknown as ToolSchema<ListLabelsArgs>, examples: [ { name: "List all labels", description: "Get all repository labels", args: { limit: 50 } } ] };
- src/infrastructure/tools/ToolRegistry.ts:265-266 (registration)Registers the listLabelsTool in the ToolRegistry singleton during initialization.this.registerTool(createLabelTool); this.registerTool(listLabelsTool);
- src/index.ts:387-388 (handler)MCP server dispatch handler that routes list_labels tool calls to ProjectManagementService.listLabels method.case "list_labels": return await this.service.listLabels(args);