Skip to main content
Glama

create_test_script

Generate or update test scripts for Zephyr Scale Cloud test cases using Gherkin or plain text formats to define testing procedures.

Instructions

Create or update a test script for a test case (removes existing test steps)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testCaseKeyYesTest case key (format: [A-Z]+-T[0-9]+)
textYesTest script content (Gherkin format for bdd type, plain text for plain type)
typeNoScript type (default: bdd)bdd

Implementation Reference

  • The main handler function for the 'create_test_script' tool. Validates input parameters (testCaseKey, text, optional type), prepares script data, calls the Zephyr client to create/update the test script, and returns a formatted success response or error.
    async function createTestScript(args) {
      try {
        const { testCaseKey, text, type } = 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]+');
        }
    
        if (!text) {
          throw new Error('text (script content) is required');
        }
    
        if (typeof text !== 'string' || text.trim().length === 0) {
          throw new Error('text must be a non-empty string');
        }
    
        const scriptData = {
          text: text.trim()
        };
    
        // Optional type field (defaults to bdd/Gherkin if not specified)
        if (type) {
          if (typeof type !== 'string' || !['bdd', 'plain'].includes(type.toLowerCase())) {
            throw new Error('type must be either "bdd" (Gherkin) or "plain"');
          }
          scriptData.type = type.toLowerCase();
        } else {
          scriptData.type = 'bdd'; // Default to bdd
        }
    
        const result = await client.createTestScript(testCaseKey, scriptData);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                message: `Test script ${scriptData.type === 'bdd' ? 'created/updated' : 'created/updated'} successfully for ${testCaseKey}`,
                testCaseKey,
                scriptType: scriptData.type,
                result,
                warning: 'If this test case had existing test steps, they have been implicitly removed as test scripts and steps are mutually exclusive',
                note: scriptData.type === 'bdd' ? 'Script should be in Gherkin format (Given/When/Then/And/But)' : 'Plain text script format'
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: formatError(error, `creating test script for ${args.testCaseKey}`)
            }
          ],
          isError: true
        };
      }
  • Input schema for the 'create_test_script' tool, defining required testCaseKey (with pattern validation), required text (non-empty string), and optional type enum ['bdd', 'plain'].
    inputSchema: {
      type: 'object',
      properties: {
        testCaseKey: {
          type: 'string',
          description: 'Test case key (format: [A-Z]+-T[0-9]+)',
          pattern: config.testCaseKeyPattern.source
        },
        text: {
          type: 'string',
          description: 'Test script content (Gherkin format for bdd type, plain text for plain type)',
          minLength: 1
        },
        type: {
          type: 'string',
          description: 'Script type (default: bdd)',
          enum: ['bdd', 'plain'],
          default: 'bdd'
        }
      },
      required: ['testCaseKey', 'text']
    },
  • Tool registration object defining name 'create_test_script', description, inputSchema, and reference to the handler function. This array is imported and spread into the main allTools list in src/index.js.
    {
      name: 'create_test_script',
      description: 'Create or update a test script for a test case (removes existing test steps)',
      inputSchema: {
        type: 'object',
        properties: {
          testCaseKey: {
            type: 'string',
            description: 'Test case key (format: [A-Z]+-T[0-9]+)',
            pattern: config.testCaseKeyPattern.source
          },
          text: {
            type: 'string',
            description: 'Test script content (Gherkin format for bdd type, plain text for plain type)',
            minLength: 1
          },
          type: {
            type: 'string',
            description: 'Script type (default: bdd)',
            enum: ['bdd', 'plain'],
            default: 'bdd'
          }
        },
        required: ['testCaseKey', 'text']
      },
      handler: createTestScript
    },
  • ZephyrClient helper method that performs the actual API POST request to create/update the test script for the given test case.
    async createTestScript(testCaseKey, scriptData) {
      return this.request('POST', `/testcases/${testCaseKey}/testscript`, scriptData);
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool 'removes existing test steps', indicating a destructive mutation, which is a critical behavioral trait. However, it lacks details on permissions, error handling, or response format, leaving gaps in transparency for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('Create or update a test script') and includes a key behavioral note ('removes existing test steps'). It avoids redundancy and is appropriately sized for the tool's complexity, though it could be slightly more structured with usage context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's mutation nature, lack of annotations, and no output schema, the description is moderately complete. It covers the destructive behavior and basic purpose but omits details on permissions, error cases, or return values, which are important for a tool that modifies data without structured output documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, providing clear details for all parameters (testCaseKey, text, type). The description does not add any additional semantic meaning beyond what the schema already explains, such as clarifying parameter interactions or constraints, so it meets the baseline but does not enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create or update a test script') and the target resource ('for a test case'), which is specific and actionable. However, it does not explicitly differentiate from sibling tools like 'create_bdd_test_script' or 'append_test_steps', which reduces clarity in distinguishing when to use this tool versus alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as 'create_bdd_test_script' or 'append_test_steps'. It mentions that it 'removes existing test steps', which hints at a destructive behavior, but does not specify scenarios or prerequisites for its use, leaving the agent without clear usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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