Skip to main content
Glama

get_test_execution

Retrieve detailed test execution results by key to analyze test runs and track testing progress within Xray Cloud.

Instructions

Get details of a specific test execution by key, including all test runs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testExecutionKeyYesThe test execution key (e.g., "PROJ-456")

Implementation Reference

  • MCP tool handler case for 'get_test_execution': extracts testExecutionKey from args, calls xrayClient.getTestExecution, and returns JSON-formatted result as text content.
    case 'get_test_execution': {
      const result = await xrayClient.getTestExecution(args.testExecutionKey as string);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Input schema defining the required 'testExecutionKey' string parameter for the get_test_execution tool.
    inputSchema: {
      type: 'object',
      properties: {
        testExecutionKey: {
          type: 'string',
          description: 'The test execution key (e.g., "PROJ-456")',
        },
      },
      required: ['testExecutionKey'],
    },
  • src/index.ts:196-209 (registration)
    Tool registration object in the 'tools' array, including name, description, and inputSchema, used by ListToolsRequestHandler.
    {
      name: 'get_test_execution',
      description: 'Get details of a specific test execution by key, including all test runs',
      inputSchema: {
        type: 'object',
        properties: {
          testExecutionKey: {
            type: 'string',
            description: 'The test execution key (e.g., "PROJ-456")',
          },
        },
        required: ['testExecutionKey'],
      },
    },
  • XrayClient method implementing the core logic: GraphQL query to fetch specific test execution by key, including test runs details, with error if not found.
    async getTestExecution(testExecutionKey: string): Promise<any> {
      const query = `
        query GetTestExecution($jql: String!, $limit: Int!) {
          getTestExecutions(jql: $jql, limit: $limit) {
            total
            results {
              issueId
              projectId
              jira(fields: ["key", "summary", "description", "status"])
              testRuns(limit: 100) {
                results {
                  id
                  status {
                    name
                    description
                  }
                  test {
                    issueId
                    jira(fields: ["key", "summary"])
                  }
                  startedOn
                  finishedOn
                  executedBy
                }
              }
            }
          }
        }
      `;
    
      const variables = {
        jql: `key = '${testExecutionKey}'`,
        limit: 1
      };
    
      const result = await this.graphqlRequest<{ getTestExecutions: any }>(query, variables);
    
      if (result.getTestExecutions.total === 0) {
        throw new Error(`Test execution ${testExecutionKey} not found`);
      }
    
      return result.getTestExecutions.results[0];
    }

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