Skip to main content
Glama

create_test_case

Create new test cases in Xray Cloud with project key, summary, description, test type, labels, and priority to manage testing workflows.

Instructions

Create a new test case in Xray Cloud

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoThe test case description
labelsNoLabels to attach to the test case
priorityNoPriority of the test case (e.g., "High", "Medium", "Low")
projectKeyYesThe Jira project key (e.g., "PROJ")
summaryYesThe test case summary/title
testTypeNoThe type of test caseManual

Implementation Reference

  • Core implementation of createTestCase tool: executes GraphQL mutation to create test in Xray Cloud.
    async createTestCase(testCase: TestCase): Promise<TestCaseResponse> { const mutation = ` mutation CreateTest($jira: JSON!, $testType: UpdateTestTypeInput, $unstructured: String) { createTest(jira: $jira, testType: $testType, unstructured: $unstructured) { test { issueId jira(fields: ["key"]) } warnings } } `; const jiraFields: any = { fields: { project: { key: testCase.projectKey }, summary: testCase.summary, issuetype: { name: 'Test' } } }; if (testCase.description) { jiraFields.fields.description = testCase.description; } if (testCase.labels && testCase.labels.length > 0) { jiraFields.fields.labels = testCase.labels; } if (testCase.priority) { jiraFields.fields.priority = { name: testCase.priority }; } const variables: any = { jira: jiraFields, unstructured: testCase.description || '' }; if (testCase.testType) { variables.testType = { name: testCase.testType }; } const result = await this.graphqlRequest<{ createTest: any }>(mutation, variables); return { id: result.createTest.test.issueId, key: result.createTest.test.jira.key, self: `https://your-jira-instance.atlassian.net/browse/${result.createTest.test.jira.key}` }; }
  • TypeScript interface defining the TestCase input structure used by the handler.
    export interface TestCase { id?: string; key?: string; summary: string; description?: string; testType?: 'Manual' | 'Cucumber' | 'Generic'; projectKey: string; labels?: string[]; components?: string[]; priority?: string; status?: string; }
  • MCP tool input schema for create_test_case validation.
    inputSchema: { type: 'object', properties: { projectKey: { type: 'string', description: 'The Jira project key (e.g., "PROJ")', }, summary: { type: 'string', description: 'The test case summary/title', }, description: { type: 'string', description: 'The test case description', }, testType: { type: 'string', enum: ['Manual', 'Cucumber', 'Generic'], description: 'The type of test case', default: 'Manual', }, labels: { type: 'array', items: { type: 'string' }, description: 'Labels to attach to the test case', }, priority: { type: 'string', description: 'Priority of the test case (e.g., "High", "Medium", "Low")', }, }, required: ['projectKey', 'summary'], },
  • src/index.ts:29-65 (registration)
    Tool registration in the tools array returned by listTools.
    { name: 'create_test_case', description: 'Create a new test case in Xray Cloud', inputSchema: { type: 'object', properties: { projectKey: { type: 'string', description: 'The Jira project key (e.g., "PROJ")', }, summary: { type: 'string', description: 'The test case summary/title', }, description: { type: 'string', description: 'The test case description', }, testType: { type: 'string', enum: ['Manual', 'Cucumber', 'Generic'], description: 'The type of test case', default: 'Manual', }, labels: { type: 'array', items: { type: 'string' }, description: 'Labels to attach to the test case', }, priority: { type: 'string', description: 'Priority of the test case (e.g., "High", "Medium", "Low")', }, }, required: ['projectKey', 'summary'], }, },
  • MCP callTool dispatcher case that invokes the Xray client handler.
    case 'create_test_case': { const testCase: TestCase = { projectKey: args.projectKey as string, summary: args.summary as string, description: args.description as string | undefined, testType: args.testType as 'Manual' | 'Cucumber' | 'Generic' | undefined, labels: args.labels as string[] | undefined, priority: args.priority as string | undefined, }; const result = await xrayClient.createTestCase(testCase); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }

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