Skip to main content
Glama

create_test_plan

Create a new test plan in Xray Cloud to organize tests by project, summary, description, and test issue IDs for structured test management.

Instructions

Create a new test plan in Xray Cloud to organize tests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectKeyYesThe Jira project key (e.g., "PROJ")
summaryYesThe test plan summary/title
descriptionNoThe test plan description
testIssueIdsNoArray of test issue IDs to include in this plan

Implementation Reference

  • Core handler function that executes the GraphQL mutation to create a test plan in Xray Cloud.
    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 || []
      };
    }
  • MCP server handler case that constructs TestPlan from tool arguments and delegates to xrayClient.createTestPlan.
    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),
          },
        ],
      };
    }
  • Input schema definition for the create_test_plan tool, defining parameters like projectKey, summary, etc.
      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/index.ts:519-521 (registration)
    Registration of the tools list for ListToolsRequest, which includes the create_test_plan tool schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { 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/c4m3lblue-star/xray-mcp'

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