add_tests_to_test_plan
Add multiple test cases to an existing test plan in Xray Cloud by specifying test plan and test issue IDs for test management automation.
Instructions
Add tests to an existing test plan
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| testPlanIssueId | Yes | The test plan issue ID (not key) | |
| testIssueIds | Yes | Array of test issue IDs to add |
Implementation Reference
- src/index.ts:765-778 (handler)MCP tool handler implementation for 'add_tests_to_test_plan'. Extracts arguments from request, calls XrayClient.addTestsToTestPlan, and returns the JSON-stringified result as text content.case 'add_tests_to_test_plan': { const result = await xrayClient.addTestsToTestPlan( args.testPlanIssueId as string, args.testIssueIds as string[] ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:350-364 (schema)Input schema defining parameters for the add_tests_to_test_plan tool: testPlanIssueId (string) and testIssueIds (array of strings).inputSchema: { type: 'object', properties: { testPlanIssueId: { type: 'string', description: 'The test plan issue ID (not key)', }, testIssueIds: { type: 'array', items: { type: 'string' }, description: 'Array of test issue IDs to add', }, }, required: ['testPlanIssueId', 'testIssueIds'], },
- src/index.ts:347-365 (registration)Registration of the 'add_tests_to_test_plan' tool in the tools array, including name, description, and input schema. Used by the MCP server for tool listing.{ name: 'add_tests_to_test_plan', description: 'Add tests to an existing test plan', inputSchema: { type: 'object', properties: { testPlanIssueId: { type: 'string', description: 'The test plan issue ID (not key)', }, testIssueIds: { type: 'array', items: { type: 'string' }, description: 'Array of test issue IDs to add', }, }, required: ['testPlanIssueId', 'testIssueIds'], }, },
- src/xray-client.ts:727-744 (helper)Supporting method in XrayClient class that executes the GraphQL mutation to add tests to a test plan and returns the result.async addTestsToTestPlan(testPlanIssueId: string, testIssueIds: string[]): Promise<any> { const mutation = ` mutation AddTestsToTestPlan($issueId: String!, $testIssueIds: [String]!) { addTestsToTestPlan(issueId: $issueId, testIssueIds: $testIssueIds) { addedTests warning } } `; const variables = { issueId: testPlanIssueId, testIssueIds }; const result = await this.graphqlRequest<{ addTestsToTestPlan: any }>(mutation, variables); return result.addTestsToTestPlan; }