Skip to main content
Glama

get_test_case

Retrieve detailed information about a specific test case using its unique key, such as PROJ-123, to support test management and automation workflows.

Instructions

Get details of a specific test case by key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testKeyYesThe test case key (e.g., "PROJ-123")

Implementation Reference

  • Core handler function that executes the GraphQL query to retrieve detailed test case information from Xray Cloud by test key.
    async getTestCase(testKey: string): Promise<any> {
      const query = `
        query GetTest($jql: String!, $limit: Int!) {
          getTests(jql: $jql, limit: $limit) {
            total
            results {
              issueId
              projectId
              jira(fields: ["key", "summary", "description", "priority", "status", "labels"])
              testType {
                name
                kind
              }
              steps {
                id
                action
                data
                result
              }
              gherkin
              unstructured
            }
          }
        }
      `;
    
      const variables = {
        jql: `key = '${testKey}'`,
        limit: 1
      };
    
      const result = await this.graphqlRequest<{ getTests: any }>(query, variables);
    
      if (result.getTests.total === 0) {
        throw new Error(`Test case ${testKey} not found`);
      }
    
      return result.getTests.results[0];
    }
  • MCP server tool call handler that invokes the XrayClient.getTestCase method and formats the response.
    case 'get_test_case': {
      const result = await xrayClient.getTestCase(args.testKey as string);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Tool schema definition including input validation for testKey parameter.
    {
      name: 'get_test_case',
      description: 'Get details of a specific test case by key',
      inputSchema: {
        type: 'object',
        properties: {
          testKey: {
            type: 'string',
            description: 'The test case key (e.g., "PROJ-123")',
          },
        },
        required: ['testKey'],
      },
    },
  • src/index.ts:519-521 (registration)
    Registration of the tools list handler that exposes all tools including get_test_case to MCP clients.
    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