Skip to main content
Glama

list_labels

Retrieve all GitHub labels to organize issues and pull requests, enabling efficient project management and categorization within repositories.

Instructions

List all GitHub labels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • Core handler function that executes the list_labels tool by querying the GitHub 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);
      }
    }
  • Zod schema definition for list_labels tool input validation, defining optional limit parameter.
    // Schema for list_labels tool
    export const listLabelsSchema = z.object({
      limit: z.number().int().positive().default(100).optional(),
    });
    
    export type ListLabelsArgs = z.infer<typeof listLabelsSchema>;
  • Registers the listLabelsTool in the central ToolRegistry singleton.
    this.registerTool(listLabelsTool);
  • src/index.ts:317-318 (registration)
    MCP server request handler dispatches call_tool requests for list_labels to the ProjectManagementService.listLabels method.
    case "list_labels":
      return await this.service.listLabels(args);
  • ToolDefinition export including name, description, schema reference, 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
          }
        }
      ]
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states it lists labels but doesn't disclose behavioral traits like pagination, rate limits, authentication needs, or what 'all' entails (e.g., across repos or orgs). This is a significant gap for a list operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded and appropriately sized for a simple tool, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one optional parameter) but lack of annotations and output schema, the description is incomplete. It doesn't explain return values, error handling, or scope, leaving gaps for an AI agent to use it correctly in context with siblings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one parameter ('limit') with 0% description coverage. The description adds no information about parameters, so it doesn't compensate for the schema gap. However, with only one parameter, the baseline is moderate, but the lack of any param info keeps it at a minimal viable level.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all GitHub labels'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'create_label' or other list tools, but it's specific enough to know what it does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'list_issues' and 'list_milestones', there's no indication of context or prerequisites for listing labels specifically.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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