Skip to main content
Glama

create_test_set

Group related tests in Xray Cloud by creating a new test set with project key, summary, description, and test issue IDs.

Instructions

Create a new test set in Xray Cloud to group related tests

Input Schema

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

Implementation Reference

  • MCP server tool handler for 'create_test_set': constructs TestSet object from input arguments and delegates to XrayClient.createTestSet, returning JSON response.
    case 'create_test_set': {
      const testSet: TestSet = {
        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.createTestSet(testSet);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:387-412 (registration)
    Tool registration in the tools list: defines name, description, and input schema for 'create_test_set', used for MCP listTools.
      name: 'create_test_set',
      description: 'Create a new test set in Xray Cloud to group related tests',
      inputSchema: {
        type: 'object',
        properties: {
          projectKey: {
            type: 'string',
            description: 'The Jira project key (e.g., "PROJ")',
          },
          summary: {
            type: 'string',
            description: 'The test set summary/title',
          },
          description: {
            type: 'string',
            description: 'The test set description',
          },
          testIssueIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of test issue IDs to include in this set',
          },
        },
        required: ['projectKey', 'summary'],
      },
    },
  • Core implementation of createTestSet in XrayClient: builds GraphQL mutation to create test set in Xray Cloud, handles Jira fields and testIssueIds, executes via graphqlRequest and returns TestSetResponse.
    async createTestSet(testSet: TestSet): Promise<TestSetResponse> {
      const mutation = `
        mutation CreateTestSet($jira: JSON!, $testIssueIds: [String]) {
          createTestSet(jira: $jira, testIssueIds: $testIssueIds) {
            testSet {
              issueId
              jira(fields: ["key", "summary"])
              tests(limit: 100) {
                results {
                  issueId
                  jira(fields: ["key", "summary"])
                }
              }
            }
            warnings
          }
        }
      `;
    
      const jiraFields: any = {
        fields: {
          project: {
            key: testSet.projectKey
          },
          summary: testSet.summary,
          issuetype: {
            name: 'Test Set'
          }
        }
      };
    
      if (testSet.description) {
        jiraFields.fields.description = testSet.description;
      }
    
      const variables: any = {
        jira: jiraFields
      };
    
      if (testSet.testIssueIds && testSet.testIssueIds.length > 0) {
        variables.testIssueIds = testSet.testIssueIds;
      }
    
      const result = await this.graphqlRequest<{ createTestSet: any }>(mutation, variables);
    
      return {
        issueId: result.createTestSet.testSet.issueId,
        key: result.createTestSet.testSet.jira.key,
        tests: result.createTestSet.testSet.tests?.results || []
      };
    }
  • TypeScript interface defining the TestSet input type used by createTestSet.
    export interface TestSet {
      summary: string;
      projectKey: string;
      testIssueIds?: string[];
      description?: string;
    }
  • TypeScript interface defining the TestSetResponse return type from createTestSet.
    export interface TestSetResponse {
      issueId: string;
      key: string;
      tests?: any[];
    }

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