Skip to main content
Glama

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
NameRequiredDescriptionDefault
jqlYesJQL query to search test cases (e.g., "project = PROJ AND labels = automation")
maxResultsNoMaximum number of results to return

Implementation Reference

  • 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), }, ], }; }
  • 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'], }, },
  • 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; }

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