Skip to main content
Glama
Derrbal

TestRail MCP Server

by Derrbal

Get TestRail Suite

get_suite

Retrieve detailed information about a specific TestRail test suite using its unique identifier to access test case data and suite configurations.

Instructions

Get details for a specific TestRail test suite by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
suite_idYesTestRail suite ID

Implementation Reference

  • MCP tool handler function for 'get_suite': validates input, calls testrailService.getSuite(suite_id), formats response as JSON text content or error message.
    async ({ suite_id }) => {
      logger.debug(`Get suite tool called with suite_id: ${suite_id}`);
      try {
        const result = await getSuite(suite_id);
        logger.debug(`Get suite tool completed successfully for suite_id: ${suite_id}`);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (err) {
        logger.error({ err }, `Get suite tool failed for suite_id: ${suite_id}`);
        const e = err as { type?: string; status?: number; message?: string };
        let message = 'Unexpected error';
        if (e?.type === 'auth') message = 'Authentication failed: check TESTRAIL_USER/API_KEY';
        else if (e?.type === 'not_found') message = `Suite ${suite_id} not found`;
        else if (e?.type === 'rate_limited') message = 'Rate limited by TestRail; try again later';
        else if (e?.type === 'server') message = 'TestRail server error';
        else if (e?.type === 'network') message = 'Network error contacting TestRail';
        else if (e?.message) message = e.message;
    
        return {
          content: [
            { type: 'text', text: message },
          ],
          isError: true,
        };
      }
    },
  • Zod input schema defining the required 'suite_id' parameter as a positive integer.
    inputSchema: {
      suite_id: z.number().int().positive().describe('TestRail suite ID'),
    },
  • src/server.ts:322-363 (registration)
    Registration of the 'get_suite' MCP tool with title, description, input schema, and handler function.
    server.registerTool(
      'get_suite',
      {
        title: 'Get TestRail Suite',
        description: 'Get details for a specific TestRail test suite by ID.',
        inputSchema: {
          suite_id: z.number().int().positive().describe('TestRail suite ID'),
        },
      },
      async ({ suite_id }) => {
        logger.debug(`Get suite tool called with suite_id: ${suite_id}`);
        try {
          const result = await getSuite(suite_id);
          logger.debug(`Get suite tool completed successfully for suite_id: ${suite_id}`);
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        } catch (err) {
          logger.error({ err }, `Get suite tool failed for suite_id: ${suite_id}`);
          const e = err as { type?: string; status?: number; message?: string };
          let message = 'Unexpected error';
          if (e?.type === 'auth') message = 'Authentication failed: check TESTRAIL_USER/API_KEY';
          else if (e?.type === 'not_found') message = `Suite ${suite_id} not found`;
          else if (e?.type === 'rate_limited') message = 'Rate limited by TestRail; try again later';
          else if (e?.type === 'server') message = 'TestRail server error';
          else if (e?.type === 'network') message = 'Network error contacting TestRail';
          else if (e?.message) message = e.message;
    
          return {
            content: [
              { type: 'text', text: message },
            ],
            isError: true,
          };
        }
      },
    );
  • Service layer function getSuite that fetches raw suite data from client and normalizes it into SuiteSummary, extracting custom fields.
    export async function getSuite(suiteId: number): Promise<SuiteSummary> {
      const suite: TestRailSuiteDto = await testRailClient.getSuite(suiteId);
      
      const {
        id,
        name,
        description,
        project_id,
        url,
        is_baseline,
        is_master,
        is_completed,
        completed_on,
        created_on,
        created_by,
        updated_on,
        updated_by,
        ...rest
      } = suite;
    
      const custom: Record<string, unknown> = {};
      for (const [key, value] of Object.entries(rest)) {
        if (key.startsWith('custom_')) custom[key] = value;
      }
    
      return {
        id,
        name,
        description,
        project_id,
        url,
        is_baseline,
        is_master,
        is_completed,
        completed_on,
        created_on,
        created_by,
        updated_on,
        updated_by,
        custom: Object.keys(custom).length ? custom : undefined,
      };
    }
  • Low-level HTTP client method that calls TestRail API /get_suite/{suiteId} endpoint, handles errors and retries.
    async getSuite(suiteId: number): Promise<TestRailSuiteDto> {
      try {
        const res = await this.http.get(`/get_suite/${suiteId}`);
        logger.info({ 
          status: res.status, 
          dataType: typeof res.data,
          suiteId 
        }, 'TestRail getSuite response info');
        
        if (res.status >= 200 && res.status < 300) {
          return res.data as TestRailSuiteDto;
        }
        throw Object.assign(new Error(`HTTP ${res.status}`), { response: res });
      } catch (err) {
        const normalized = this.normalizeError(err);
        const safeDetails = this.getSafeErrorDetails(err);
        logger.error({ err: normalized, details: safeDetails, suiteId }, 'TestRail getSuite failed');
        throw normalized;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'gets details' but doesn't specify what details are returned (e.g., suite name, description, project association), whether it's a read-only operation, or any error handling (e.g., for invalid IDs). This leaves significant gaps in understanding the tool's behavior.

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, clear sentence that efficiently conveys the core purpose without unnecessary words. It's front-loaded and wastes no space, making it easy for an agent 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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'details' are returned, which is critical for a tool with no structured output documentation. For a simple read operation, more context on the response format would help the agent use it effectively.

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 description mentions 'by ID', which aligns with the single parameter 'suite_id' in the input schema. Since schema description coverage is 100%, the schema already documents the parameter as 'TestRail suite ID' with type and constraints. The description adds minimal value beyond this, meeting the baseline for high schema coverage.

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 ('Get details') and resource ('TestRail test suite by ID'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_suites' (plural) or 'get_case' which suggests this is for a single suite, but this distinction isn't explicitly stated.

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 like 'get_suites' (for listing multiple suites) or other 'get_' tools for different resources. It lacks context about prerequisites, such as needing a valid suite ID, or exclusions, leaving the agent to infer usage from the tool name alone.

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

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