Skip to main content
Glama

create_test_case

Create new test cases in Xray Cloud for manual, Cucumber, or generic testing with project keys, summaries, descriptions, and labels.

Instructions

Create a new test case in Xray Cloud

Input Schema

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

Implementation Reference

  • Core handler function implementing the create_test_case tool logic by executing GraphQL mutation to create a test case 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}`
      };
    }
  • src/index.ts:29-65 (registration)
    MCP tool registration defining the 'create_test_case' tool with name, description, and input schema.
    {
      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'],
      },
    },
  • 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;
    }
  • TypeScript interface defining the TestCaseResponse output structure returned by the handler.
    export interface TestCaseResponse {
      id: string;
      key: string;
      self: string;
    }
  • Dispatch helper in MCP server that constructs TestCase from tool arguments and calls the 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),
          },
        ],
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Create' which implies a write/mutation operation, but doesn't mention permissions required, whether the creation is idempotent, error handling, or what happens on success (e.g., returns a test case ID). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain behavioral aspects like permissions, side effects, or return values, which are critical for safe and effective use. The high schema coverage helps with parameters, but overall context is lacking for a creation operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, meaning all parameters are documented in the input schema. The description adds no additional parameter information beyond what's in the schema, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new test case') and resource ('in Xray Cloud'), which is specific and unambiguous. However, it doesn't differentiate this tool from its sibling 'update_test_case' or explain when to create versus update, missing the sibling distinction needed for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'update_test_case' or other creation tools (e.g., 'create_test_plan'). There's no mention of prerequisites, such as needing an existing project, or exclusions, leaving the agent to infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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