Skip to main content
Glama

get_test_script

Retrieve Gherkin-format test scripts for specific test cases in Zephyr Scale Cloud to support test execution and management.

Instructions

Get the test script (Gherkin format) for a test case

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testCaseKeyYesTest case key (format: [A-Z]+-T[0-9]+)

Implementation Reference

  • Handler function that validates the testCaseKey input, fetches the test script using ZephyrClient, formats the response in MCP content format, and handles errors.
    async function getTestScript(args) {
      try {
        const { testCaseKey } = args;
    
        if (!testCaseKey) {
          throw new Error('testCaseKey is required');
        }
    
        if (!config.testCaseKeyPattern.test(testCaseKey)) {
          throw new Error('Invalid testCaseKey format. Must match pattern: [A-Z]+-T[0-9]+');
        }
    
        const script = await client.getTestScript(testCaseKey);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                testCaseKey,
                testScript: script,
                note: 'Test script is returned in Gherkin format (BDD style)'
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: formatError(error, `fetching test script for ${args.testCaseKey}`)
            }
          ],
          isError: true
        };
      }
    }
  • Registration of the 'get_test_script' tool in the testScriptTools array, including name, description, inputSchema, and handler reference.
    {
      name: 'get_test_script',
      description: 'Get the test script (Gherkin format) for a test case',
      inputSchema: {
        type: 'object',
        properties: {
          testCaseKey: {
            type: 'string',
            description: 'Test case key (format: [A-Z]+-T[0-9]+)',
            pattern: config.testCaseKeyPattern.source
          }
        },
        required: ['testCaseKey']
      },
      handler: getTestScript
    },
  • Input schema for the 'get_test_script' tool defining the required testCaseKey parameter with pattern validation.
    inputSchema: {
      type: 'object',
      properties: {
        testCaseKey: {
          type: 'string',
          description: 'Test case key (format: [A-Z]+-T[0-9]+)',
          pattern: config.testCaseKeyPattern.source
        }
      },
      required: ['testCaseKey']
    },
  • Helper method in ZephyrClient class that makes the API request to retrieve the test script for a given test case key.
    async getTestScript(testCaseKey) {
      return this.request('GET', `/testcases/${testCaseKey}/testscript`);
    }

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/donyfs/mcp-zephyr'

If you have feedback or need assistance with the MCP directory API, please join our Discord server