Skip to main content
Glama

get_test_plan

Retrieve detailed information about a specific test plan, including all associated tests, to support test management and tracking in Xray Cloud.

Instructions

Get details of a specific test plan by key, including all tests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testPlanKeyYesThe test plan key (e.g., "PROJ-789")

Implementation Reference

  • src/index.ts:295-308 (registration)
    Registration of the 'get_test_plan' tool including its name, description, and input schema requiring 'testPlanKey'.
    {
      name: 'get_test_plan',
      description: 'Get details of a specific test plan by key, including all tests',
      inputSchema: {
        type: 'object',
        properties: {
          testPlanKey: {
            type: 'string',
            description: 'The test plan key (e.g., "PROJ-789")',
          },
        },
        required: ['testPlanKey'],
      },
    },
  • MCP server handler for 'get_test_plan' tool: extracts testPlanKey, calls xrayClient.getTestPlan, and returns JSON-formatted result.
    case 'get_test_plan': {
      const result = await xrayClient.getTestPlan(args.testPlanKey as string);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Core implementation of getTestPlan: executes GraphQL query to fetch test plan details by key using JQL, handles not found error, returns the result.
    async getTestPlan(testPlanKey: string): Promise<any> {
      const query = `
        query GetTestPlan($jql: String!, $limit: Int!) {
          getTestPlans(jql: $jql, limit: $limit) {
            total
            results {
              issueId
              projectId
              jira(fields: ["key", "summary", "description", "status"])
              tests(limit: 100) {
                total
                results {
                  issueId
                  jira(fields: ["key", "summary", "status"])
                  testType {
                    name
                    kind
                  }
                }
              }
            }
          }
        }
      `;
    
      const variables = {
        jql: `key = '${testPlanKey}'`,
        limit: 1
      };
    
      const result = await this.graphqlRequest<{ getTestPlans: any }>(query, variables);
    
      if (result.getTestPlans.total === 0) {
        throw new Error(`Test plan ${testPlanKey} not found`);
      }
    
      return result.getTestPlans.results[0];
    }
  • TypeScript interface defining the TestPlan structure used in the tool.
    export interface TestPlan {
      summary: string;
      projectKey: string;
      testIssueIds?: string[];
      description?: string;
    }

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/c4m3lblue-star/xray-mcp'

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