Skip to main content
Glama

append_test_steps

Add new test steps to existing test cases in Zephyr Scale Cloud for comprehensive test management.

Instructions

Append new test steps to a test case (max 100 steps per request)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testCaseKeyYesTest case key to append steps to (format: [A-Z]+-T[0-9]+)
stepsYesArray of test steps to append (max 100 steps)

Implementation Reference

  • Main MCP tool handler: validates testCaseKey and steps array, formats steps into API payload, calls ZephyrClient.appendTestSteps, handles errors, returns MCP-formatted response.
    async function appendTestSteps(args) {
      try {
        const { testCaseKey, steps } = 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 (!steps || !Array.isArray(steps)) {
          throw new Error('steps must be provided as an array');
        }
    
        if (steps.length === 0) {
          throw new Error('At least one step must be provided');
        }
    
        if (steps.length > 100) {
          throw new Error('Maximum 100 steps can be added per request');
        }
    
        // Validate each step and format according to TestStepsInput schema
        const formattedSteps = steps.map((step, index) => {
          if (!step.description) {
            throw new Error(`Step ${index + 1} is missing required field: description`);
          }
    
          const formattedStep = {
            inline: {
              description: step.description
            }
          };
    
          // Optional fields
          if (step.expectedResult !== undefined) {
            formattedStep.inline.expectedResult = step.expectedResult;
          }
    
          if (step.data !== undefined) {
            formattedStep.inline.testData = step.data;
          }
    
          if (step.attachments !== undefined) {
            formattedStep.inline.attachments = step.attachments;
          }
    
          return formattedStep;
        });
    
        // Format according to TestStepsInput schema
        const payload = {
          mode: 'OVERWRITE',
          items: formattedSteps
        };
    
        const result = await client.appendTestSteps(testCaseKey, payload);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                message: `Successfully added ${steps.length} test steps to ${testCaseKey}`,
                testCaseKey,
                stepsAdded: steps.length,
                result,
                warning: 'If this test case had a test script, it has been implicitly removed'
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: formatError(error, `appending test steps to ${args.testCaseKey}`)
            }
          ],
          isError: true
        };
      }
    }
  • Input schema for the append_test_steps tool, defining validation for testCaseKey (with pattern) and steps array (1-100 items, each with required description).
    inputSchema: {
      type: 'object',
      properties: {
        testCaseKey: {
          type: 'string',
          description: 'Test case key to append steps to (format: [A-Z]+-T[0-9]+)',
          pattern: config.testCaseKeyPattern.source
        },
        steps: {
          type: 'array',
          description: 'Array of test steps to append (max 100 steps)',
          items: {
            type: 'object',
            properties: {
              description: {
                type: 'string',
                description: 'Step description (required)',
                minLength: 1
              },
              expectedResult: {
                type: 'string',
                description: 'Expected result for this step'
              },
              data: {
                type: 'string',
                description: 'Test data for this step'
              },
              attachments: {
                type: 'array',
                description: 'Array of attachment objects',
                items: {
                  type: 'object'
                }
              }
            },
            required: ['description']
          },
          minItems: 1,
          maxItems: 100
        }
      },
      required: ['testCaseKey', 'steps']
    },
  • Tool registration object in testStepsTools array, including name, description, inputSchema, and handler reference.
    {
      name: 'append_test_steps',
      description: 'Append new test steps to a test case (max 100 steps per request)',
      inputSchema: {
        type: 'object',
        properties: {
          testCaseKey: {
            type: 'string',
            description: 'Test case key to append steps to (format: [A-Z]+-T[0-9]+)',
            pattern: config.testCaseKeyPattern.source
          },
          steps: {
            type: 'array',
            description: 'Array of test steps to append (max 100 steps)',
            items: {
              type: 'object',
              properties: {
                description: {
                  type: 'string',
                  description: 'Step description (required)',
                  minLength: 1
                },
                expectedResult: {
                  type: 'string',
                  description: 'Expected result for this step'
                },
                data: {
                  type: 'string',
                  description: 'Test data for this step'
                },
                attachments: {
                  type: 'array',
                  description: 'Array of attachment objects',
                  items: {
                    type: 'object'
                  }
                }
              },
              required: ['description']
            },
            minItems: 1,
            maxItems: 100
          }
        },
        required: ['testCaseKey', 'steps']
      },
      handler: appendTestSteps
    }
  • ZephyrClient helper method that performs the actual API POST request to append test steps.
    async appendTestSteps(testCaseKey, stepsData) {
      return this.request('POST', `/testcases/${testCaseKey}/teststeps`, stepsData);
    }

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