Skip to main content
Glama
uarlouski

TestRail MCP Server

get_labels

Fetch all test case labels for a project, returning their IDs and titles for use when creating or updating test cases.

Instructions

Get all available test case labels (sometimes called tags) for a project. Returns label IDs and titles that can be used when creating or updating test cases.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe ID of the project to retrieve labels for

Implementation Reference

  • The get_labels tool definition containing the handler function that calls client.getLabels(project_id) and maps results through LabelSchema
    export const getLabelsTool: ToolDefinition<typeof parameters, TestRailClient> = {
        name: "get_labels",
        description: "Get all available test case labels (sometimes called tags) for a project. Returns label IDs and titles that can be used when creating or updating test cases.",
        parameters,
        handler: async ({ project_id }, client) => {
            const labels = await client.getLabels(project_id);
            return {
                labels: labels.map(l => LabelSchema.parse(l)),
            };
        },
    };
  • src/index.ts:75-75 (registration)
    Registration of getLabelsTool in the tools array used by the MCP server
    getLabelsTool,
  • Input parameter schema: project_id (number)
    const parameters = {
        project_id: z.number().describe("The ID of the project to retrieve labels for"),
    };
  • LabelSchema Zod definition with id (number) and title (string), and Label type
    export const LabelSchema = z.object({
        id: z.number(),
        title: z.string(),
    });
    
    export type Label = z.infer<typeof LabelSchema>
  • Client method getLabels that calls the TestRail API endpoint /api/v2/get_labels/{projectId} and paginates results
    async getLabels(projectId: number): Promise<Label[]> {
        const url = `${API_BASE_V2}/get_labels/${projectId}`;
        return this.paginateAll<Label>(url, 'labels');
    }
Behavior4/5

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

No annotations provided, but the description discloses the read-only nature (returns label IDs and titles) and intended usage. While additional details like auth or rate limits are missing, the core behavior is transparent for a simple retrieval tool.

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?

Two sentences efficiently convey the tool's action, result, and usage context. No redundant or extra information, making it concise and well-structured.

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

Completeness5/5

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

Given one parameter and no output schema, the description fully covers what the tool does, what it returns, and when it's useful. No gaps in information for this simple retrieval tool.

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

Parameters4/5

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

Schema coverage is 100% with a clear description of project_id. The description adds value by explaining the purpose of labels in creating/updating test cases, enhancing semantic understanding beyond the schema.

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

Purpose5/5

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

The description clearly states the verb 'Get' and the resource 'labels' (with alias 'tags'), specifies scope 'for a project', and distinguishes from sibling tools which focus on cases, runs, results, etc.

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

Usage Guidelines4/5

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

The description implies use when creating or updating test cases, providing clear context. However, it lacks explicit when-not-to-use or alternative tool guidance, which is acceptable given the tool's singular purpose.

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/uarlouski/testrail-mcp-server'

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