Skip to main content
Glama

list_labels

Retrieve all GitHub labels to organize and categorize issues and pull requests for better project management.

Instructions

List all GitHub labels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • Core handler function that executes the list_labels tool logic by querying GitHub's GraphQL API for repository labels.
    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 validation, description, and usage examples for list_labels.
    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 } } ] };
  • Registers the listLabelsTool in the ToolRegistry singleton during initialization.
    this.registerTool(createLabelTool); this.registerTool(listLabelsTool);
  • MCP tool dispatch handler that routes list_labels calls to ProjectManagementService.listLabels.
    case "create_label": return await this.service.createLabel(args); case "list_labels": return await this.service.listLabels(args);

Other Tools

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