get_test_set
Retrieve comprehensive details for a specific test set using its unique key, including all associated tests for test management and analysis.
Instructions
Get details of a specific test set by key, including all tests
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| testSetKey | Yes | The test set key (e.g., "PROJ-890") |
Implementation Reference
- src/index.ts:814-824 (handler)MCP tool call handler that handles the execution of the 'get_test_set' tool by calling XrayClient.getTestSet with the provided testSetKey and returning the result as formatted JSON text content.case 'get_test_set': { const result = await xrayClient.getTestSet(args.testSetKey as string); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:413-426 (schema)Tool registration and input schema definition for the 'get_test_set' MCP tool. Defines the name, description, and required input parameter testSetKey.{ name: 'get_test_set', description: 'Get details of a specific test set by key, including all tests', inputSchema: { type: 'object', properties: { testSetKey: { type: 'string', description: 'The test set key (e.g., "PROJ-890")', }, }, required: ['testSetKey'], }, },
- src/xray-client.ts:830-867 (handler)Core handler function in XrayClient that implements the logic to retrieve a specific test set by its key using a GraphQL query with JQL filter, fetching detailed information including contained tests.async getTestSet(testSetKey: string): Promise<any> { const query = ` query GetTestSet($jql: String!, $limit: Int!) { getTestSets(jql: $jql, limit: $limit) { total results { issueId projectId jira(fields: ["key", "summary", "description", "status"]) tests(limit: 100) { total results { issueId jira(fields: ["key", "summary", "status"]) testType { name kind } } } } } } `; const variables = { jql: `key = '${testSetKey}'`, limit: 1 }; const result = await this.graphqlRequest<{ getTestSets: any }>(query, variables); if (result.getTestSets.total === 0) { throw new Error(`Test set ${testSetKey} not found`); } return result.getTestSets.results[0]; }
- src/xray-client.ts:182-213 (helper)Helper function used by getTestSet to execute the GraphQL query against Xray API, handling authentication and error management.private async graphqlRequest<T>(query: string, variables?: any): Promise<T> { const token = await this.authenticate(); try { const response = await this.graphqlClient.post<{ data: T; errors?: any[] }>( '/graphql', { query, variables }, { headers: { Authorization: `Bearer ${token}` } } ); if (response.data.errors && response.data.errors.length > 0) { throw new Error(`GraphQL errors: ${JSON.stringify(response.data.errors)}`); } return response.data.data; } catch (error) { if (axios.isAxiosError(error)) { const errorDetails = error.response?.data ? JSON.stringify(error.response.data) : error.message; throw new Error(`GraphQL request failed (${error.response?.status}): ${errorDetails}`); } throw error; } }