Skip to main content
Glama

list_labels

Retrieve all labels from a GitLab project to organize and categorize issues, merge requests, and other project items.

Instructions

List all labels in a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
pageNo
per_pageNo

Implementation Reference

  • The actual implementation of the listLabels function, which calls the GitLab API to retrieve labels for a project.
    export async function listLabels(projectId: string, page: number = 1, perPage: number = 20): Promise<GitLabLabelResponse[]> {
      if (!projectId?.trim()) {
        throw new Error("Project ID is required");
      }
      if (page < 1) {
        throw new Error("Page number must be 1 or greater");
      }
      if (perPage < 1 || perPage > 100) {
        throw new Error("Per page must be between 1 and 100");
      }
    
      const endpoint = `/projects/${encodeProjectId(projectId)}/labels`;
      const params = buildSearchParams({
        page: page.toString(),
        per_page: perPage.toString()
      });
    
      const labels = await gitlabGet<GitLabLabelResponse[]>(endpoint, params);
      return z.array(GitLabLabelSchema).parse(labels);
    }
  • Zod schema definition for input validation of the list_labels tool.
    export const ListLabelsSchema = z.object({
      project_id: z.string(),
      page: z.number().optional(),
      per_page: z.number().optional()
    });
  • src/server.ts:300-304 (registration)
    Registration and invocation logic for the list_labels tool within the MCP server's request handler.
    case "list_labels": {
      const args = ListLabelsSchema.parse(request.params.arguments);
      const labels = await api.listLabels(args.project_id, args.page, args.per_page);
      return { content: [{ type: "text", text: JSON.stringify(labels, null, 2) }] };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a list operation, implying it's read-only, but doesn't mention pagination behavior (despite page/per_page parameters), rate limits, authentication requirements, or what the return format looks like. This leaves significant gaps for a tool with pagination parameters.

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 that gets straight to the point with zero wasted words. It's appropriately sized for a simple list operation and front-loads the essential information.

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?

For a tool with 3 parameters (including pagination), no annotations, and no output schema, the description is inadequate. It doesn't explain the pagination behavior, return format, or how labels are structured. The agent would need to guess about important operational aspects despite the tool's relative simplicity.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but provides no parameter information. It doesn't explain what project_id should be (numeric ID vs path), what page and per_page do, default values, or constraints. The description adds no meaning beyond what the bare schema provides.

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 action ('List all labels') and resource ('in a GitLab project'), making the purpose immediately understandable. However, it doesn't differentiate this tool from other list tools (like list_issues, list_merge_requests) beyond the resource type, which prevents a perfect score.

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?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention prerequisites, when this tool is appropriate versus other label-related tools (like create_label, update_label, delete_label), or any context about filtering or sorting options.

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/TheRealChrisThomas/gitlab-mcp-server'

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