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
| Name | Required | Description | Default |
|---|---|---|---|
| testPlanKey | Yes | The 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'], }, },
- src/index.ts:723-733 (handler)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), }, ], }; }
- src/xray-client.ts:642-679 (handler)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]; }
- src/xray-client.ts:64-69 (schema)TypeScript interface defining the TestPlan structure used in the tool.export interface TestPlan { summary: string; projectKey: string; testIssueIds?: string[]; description?: string; }