create_test_plan
Create a new test plan in Xray Cloud to organize and group test cases for structured testing workflows and project management.
Instructions
Create a new test plan in Xray Cloud to organize tests
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | The test plan description | |
| projectKey | Yes | The Jira project key (e.g., "PROJ") | |
| summary | Yes | The test plan summary/title | |
| testIssueIds | No | Array of test issue IDs to include in this plan |
Implementation Reference
- src/index.ts:704-721 (handler)MCP server handler for the 'create_test_plan' tool. Parses input arguments, constructs a TestPlan object, calls xrayClient.createTestPlan(), and returns the JSON-formatted result.case 'create_test_plan': { const testPlan: TestPlan = { projectKey: args.projectKey as string, summary: args.summary as string, description: args.description as string | undefined, testIssueIds: args.testIssueIds as string[] | undefined, }; const result = await xrayClient.createTestPlan(testPlan); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:268-293 (registration)Registration of the 'create_test_plan' tool in the tools list, including name, description, and input schema. Returned by ListToolsRequestHandler.{ name: 'create_test_plan', description: 'Create a new test plan in Xray Cloud to organize tests', inputSchema: { type: 'object', properties: { projectKey: { type: 'string', description: 'The Jira project key (e.g., "PROJ")', }, summary: { type: 'string', description: 'The test plan summary/title', }, description: { type: 'string', description: 'The test plan description', }, testIssueIds: { type: 'array', items: { type: 'string' }, description: 'Array of test issue IDs to include in this plan', }, }, required: ['projectKey', 'summary'], },
- src/xray-client.ts:64-69 (schema)TypeScript interface definition for TestPlan input used by the createTestPlan method.export interface TestPlan { summary: string; projectKey: string; testIssueIds?: string[]; description?: string; }
- src/xray-client.ts:587-637 (helper)Core implementation of createTestPlan in XrayClient class. Constructs GraphQL mutation to create test plan in Xray Cloud, handles Jira fields and testIssueIds, executes via graphqlRequest, and returns formatted response.async createTestPlan(testPlan: TestPlan): Promise<TestPlanResponse> { const mutation = ` mutation CreateTestPlan($jira: JSON!, $testIssueIds: [String]) { createTestPlan(jira: $jira, testIssueIds: $testIssueIds) { testPlan { issueId jira(fields: ["key", "summary"]) tests(limit: 100) { results { issueId jira(fields: ["key", "summary"]) } } } warnings } } `; const jiraFields: any = { fields: { project: { key: testPlan.projectKey }, summary: testPlan.summary, issuetype: { name: 'Test Plan' } } }; if (testPlan.description) { jiraFields.fields.description = testPlan.description; } const variables: any = { jira: jiraFields }; if (testPlan.testIssueIds && testPlan.testIssueIds.length > 0) { variables.testIssueIds = testPlan.testIssueIds; } const result = await this.graphqlRequest<{ createTestPlan: any }>(mutation, variables); return { issueId: result.createTestPlan.testPlan.issueId, key: result.createTestPlan.testPlan.jira.key, tests: result.createTestPlan.testPlan.tests?.results || [] }; }