Skip to main content
Glama
Derrbal

TestRail MCP Server

by Derrbal

Get TestRail Projects

get_projects

Retrieve all projects from TestRail test management system to view available testing initiatives and organize test planning workflows.

Instructions

List all TestRail projects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'get_projects': calls service getProjects(), returns JSON-stringified list of projects or error message.
    async () => {
      logger.debug('Get projects tool called');
      try {
        const result = await getProjects();
        logger.debug(`Get projects tool completed successfully. Found ${result.length} projects`);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (err) {
        logger.error({ err }, 'Get projects tool failed');
        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 === '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,
        };
      }
    },
  • src/server.ts:190-228 (registration)
    Registers the 'get_projects' tool on the MCP server with empty input schema (no parameters) and associated handler.
    server.registerTool(
      'get_projects',
      {
        title: 'Get TestRail Projects',
        description: 'List all TestRail projects.',
        inputSchema: {}, // No parameters required
      },
      async () => {
        logger.debug('Get projects tool called');
        try {
          const result = await getProjects();
          logger.debug(`Get projects tool completed successfully. Found ${result.length} projects`);
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        } catch (err) {
          logger.error({ err }, 'Get projects tool failed');
          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 === '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,
          };
        }
      },
    );
  • TypeScript interface defining the normalized ProjectSummary structure used in tool output.
    export interface ProjectSummary {
      id: number;
      name: string;
      announcement?: string;
      show_announcement?: boolean;
      is_completed: boolean;
      completed_on?: number | null;
      suite_mode: number;
      url: string;
      created_on?: number;
      created_by?: number;
      custom?: Record<string, unknown> | undefined;
    }
  • Helper function that fetches raw TestRail projects via client and normalizes response by isolating custom fields.
    export async function getProjects(): Promise<ProjectSummary[]> {
      const projects: TestRailProjectDto[] = await testRailClient.getProjects();
      
      return projects.map((project) => {
        const {
          id,
          name,
          announcement,
          show_announcement,
          is_completed,
          completed_on,
          suite_mode,
          url,
          created_on,
          created_by,
          ...rest
        } = project;
    
        const custom: Record<string, unknown> = {};
        for (const [key, value] of Object.entries(rest)) {
          if (key.startsWith('custom_')) custom[key] = value;
        }
    
        return {
          id,
          name,
          announcement,
          show_announcement,
          is_completed,
          completed_on,
          suite_mode,
          url,
          created_on,
          created_by,
          custom: Object.keys(custom).length ? custom : undefined,
        };
      });
    }
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose whether this is paginated, requires authentication, has rate limits, returns structured data, or what happens with large project sets—critical 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—front-loaded and to the point. Every word contributes directly to stating the tool's purpose without redundancy or fluff.

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 no annotations, no output schema, and a simple list operation, the description is incomplete. It lacks details on return format, pagination, error handling, or how it fits with siblings like 'get_project', leaving gaps for an agent to use it effectively in context.

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?

The tool has 0 parameters with 100% schema coverage, so no parameter documentation is needed. The description doesn't add parameter info, which is appropriate, but it also doesn't imply any hidden parameters or constraints, keeping it straightforward.

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 ('TestRail projects'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_project' (singular) or explain scope beyond 'all', missing full sibling distinction.

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 on when to use this tool versus alternatives like 'get_project' (singular) or 'get_cases' (which might be project-specific). The description implies a broad listing but offers no context about prerequisites, filtering, or comparison to siblings.

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