search_test_cases
Search for test cases in Xray using JQL queries to find specific tests based on criteria like project, labels, or status.
Instructions
Search for test cases using JQL (Jira Query Language)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jql | Yes | JQL query to search test cases (e.g., "project = PROJ AND labels = automation") | |
| maxResults | No | Maximum number of results to return |
Implementation Reference
- src/index.ts:596-609 (handler)MCP tool handler that processes the 'search_test_cases' tool call, extracts JQL and maxResults arguments, invokes the Xray client method, and formats the result as MCP content.case 'search_test_cases': { const result = await xrayClient.searchTestCases( args.jql as string, args.maxResults as number | undefined ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:128-142 (schema)Input schema for the 'search_test_cases' tool defining the expected parameters: required 'jql' string and optional 'maxResults' number.inputSchema: { type: 'object', properties: { jql: { type: 'string', description: 'JQL query to search test cases (e.g., "project = PROJ AND labels = automation")', }, maxResults: { type: 'number', description: 'Maximum number of results to return', default: 50, }, }, required: ['jql'], },
- src/index.ts:125-143 (registration)Tool registration in the tools array returned by ListToolsRequestHandler, including name, description, and schema.{ name: 'search_test_cases', description: 'Search for test cases using JQL (Jira Query Language)', inputSchema: { type: 'object', properties: { jql: { type: 'string', description: 'JQL query to search test cases (e.g., "project = PROJ AND labels = automation")', }, maxResults: { type: 'number', description: 'Maximum number of results to return', default: 50, }, }, required: ['jql'], }, },
- src/xray-client.ts:365-392 (helper)Main helper function in XrayClient that executes GraphQL query to Xray Cloud API's getTests using the provided JQL and limit, returning search results.async searchTestCases(jql: string, maxResults: number = 50): Promise<any> { const query = ` query SearchTests($jql: String!, $limit: Int!) { getTests(jql: $jql, limit: $limit) { total start limit results { issueId projectId jira(fields: ["key", "summary", "description", "priority", "status", "labels"]) testType { name kind } } } } `; const variables = { jql, limit: maxResults }; const result = await this.graphqlRequest<{ getTests: any }>(query, variables); return result.getTests; }