Skip to main content
Glama
uarlouski

TestRail MCP Server

get_statuses

Retrieve all available test statuses with IDs and names for use with add_result and get_tests.

Instructions

Get all available test statuses (e.g. Passed, Failed, Blocked). Returns status IDs and names that can be used with add_result and get_tests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the get_statuses tool logic. Calls client.getStatuses() and maps results through StatusSchema validation.
    handler: async (args: any, client: TestRailClient) => {
        const statuses = await client.getStatuses();
        return {
            statuses: statuses.map(s => StatusSchema.parse(s)),
        };
    },
  • Zod schema defining the status object shape with 'id', 'name', and 'label' fields.
    export const StatusSchema = z.object({
        id: z.number(),
        name: z.string(),
        label: z.string(),
    });
  • src/index.ts:17-69 (registration)
    Import of the getStatusesTool definition.
    import { getStatusesTool } from "./tools/get_statuses.js";
    import { getPrioritiesTool } from "./tools/get_priorities.js";
    import { getTestsTool } from "./tools/get_tests.js";
    import { addResultsTool } from "./tools/add_results.js";
    import { addAttachmentToRunTool } from "./tools/add_attachment_to_run.js";
    import { addResultsForCasesTool } from "./tools/add_results_for_cases.js";
    import { getLabelsTool } from "./tools/get_labels.js";
    import { getSharedStepsTool } from "./tools/shared_steps/get_shared_steps.js";
    import { getSharedStepTool } from "./tools/shared_steps/get_shared_step.js";
    import { getSharedStepHistoryTool } from "./tools/shared_steps/get_shared_step_history.js";
    import { addSharedStepTool } from "./tools/shared_steps/add_shared_step.js";
    import { updateSharedStepTool } from "./tools/shared_steps/update_shared_step.js";
    import { deleteSharedStepTool } from "./tools/shared_steps/delete_shared_step.js";
    import { removeNullish } from "./utils/sanitizer.js";
    import z from "zod";
    
    const EnvSchema = z.object({
        TESTRAIL_INSTANCE_URL: z.url('Must be a valid TestRail URL'),
        TESTRAIL_USERNAME: z.email('Must be a valid email address'),
        TESTRAIL_API_KEY: z.string().min(1, 'API key is required'),
        TESTRAIL_ENABLE_SHARED_STEPS: z.string().optional().transform(val => val === 'true')
    });
    
    const parseResult = EnvSchema.safeParse(process.env);
    
    if (!parseResult.success) {
        console.error(
            "Invalid TestRail environment configuration:",
            JSON.stringify(z.treeifyError(parseResult.error), null, 2));
        process.exit(1);
    }
    
    const { TESTRAIL_INSTANCE_URL, TESTRAIL_USERNAME, TESTRAIL_API_KEY, TESTRAIL_ENABLE_SHARED_STEPS } = parseResult.data;
    
    const server = new McpServer({
        name: "TestRail MCP Server",
        version: "1.9.0",
    });
    
    const client = new TestRailClient(TESTRAIL_INSTANCE_URL, TESTRAIL_USERNAME, TESTRAIL_API_KEY);
    
    const tools = [
        getProjectsTool,
        getCaseTool,
        getCasesTool,
        getCaseFieldsTool,
        getTemplatesTool,
        getSectionsTool,
        updateCaseTool,
        updateCasesTool,
        addCaseTool,
        addRunTool,
        getStatusesTool,
  • src/index.ts:69-69 (registration)
    Tool added to the tools array for registration with the MCP server.
    getStatusesTool,
  • src/index.ts:88-115 (registration)
    Generic MCP server registration loop that registers each tool (including get_statuses) by name, description, and input schema.
        server.registerTool(
            tool.name,
            {
                description: tool.description,
                inputSchema: tool.parameters,
            },
            async (args: any) => {
                try {
                    const output: Record<string, any> = await tool.handler(args, client);
                    const sanitized = removeNullish(output);
    
                    return {
                        content: [
                            {
                                type: "text" as const,
                                text: JSON.stringify(sanitized),
                            },
                        ],
                    } as any;
                } catch (error: any) {
                    return {
                        content: [{ type: "text", text: `Error: ${error.message}` }],
                        isError: true,
                    };
                }
            }
        );
    }
Behavior4/5

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

Discloses that the tool returns status IDs and names, and implies a read-only operation (get). Without annotations, this is sufficient for a simple query tool; no hidden side effects are likely.

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?

Single, well-structured sentence that conveys purpose, examples, return info, and usage hints without redundancy.

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?

For a parameterless tool with no output schema, the description fully covers what the tool does, what it returns, and how to use the results, making it self-contained.

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?

No parameters exist in schema, so baseline is 4. Description adds value by explaining that the output is usable with other tools, going beyond just 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?

Clearly states the tool retrieves all available test statuses with examples (Passed, Failed, Blocked) and specifies return values (IDs and names). Distinguishes from sibling tools like get_tests, which return test data, not statuses.

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?

Explicitly states that returned IDs and names can be used with add_result and get_tests, providing clear context for when to invoke this tool. Does not explicitly exclude alternatives, but the usage hint is effective.

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