Skip to main content
Glama
raymondsambur

Automation Script Generator MCP Server

generate_feature_file

Create WDIO feature files with Gherkin syntax for test automation scenarios, specifying scenario titles, steps, tags, and output paths.

Instructions

Generate WDIO feature file with Gherkin syntax (Given, When, Then)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scenario_titleYesTitle of the test scenario
gherkin_syntaxYesGherkin syntax content for the feature
tagsNoTest ID tags for the scenario
output_pathYesPath where the feature file should be saved

Implementation Reference

  • The primary handler function for the 'generate_feature_file' tool. It destructures the input arguments, generates the feature file content using an internal helper, ensures the output directory exists, writes the file, and returns a success response with the generated content.
    async generateFeatureFile(args) { const { scenario_title, gherkin_syntax, tags = [], output_path } = args; try { const featureContent = this.buildFeatureFileContent(scenario_title, gherkin_syntax, tags); await fs.ensureDir(path.dirname(output_path)); await fs.writeFile(output_path, featureContent); return { content: [ { type: 'text', text: `Feature file generated successfully at: ${output_path}\n\nContent:\n${featureContent}`, }, ], }; } catch (error) { throw new Error(`Failed to generate feature file: ${error.message}`); }
  • The JSON Schema defining the input parameters and validation rules for the generate_feature_file tool, including required fields and constraints.
    inputSchema: { type: 'object', properties: { scenario_title: { type: 'string', description: 'Title of the test scenario', minLength: 1, }, gherkin_syntax: { type: 'string', description: 'Gherkin syntax content for the feature', minLength: 1, }, tags: { type: 'array', items: { type: 'string' }, description: 'Test ID tags for the scenario', }, output_path: { type: 'string', description: 'Path where the feature file should be saved', minLength: 1, }, }, required: ['scenario_title', 'gherkin_syntax', 'output_path'], additionalProperties: false,
  • index.js:173-202 (registration)
    The tool configuration object in the toolConfigs array, which registers the generate_feature_file tool with its name, description, and schema for the MCP server's listTools response.
    name: 'generate_feature_file', description: 'Generate WDIO feature file with Gherkin syntax (Given, When, Then)', inputSchema: { type: 'object', properties: { scenario_title: { type: 'string', description: 'Title of the test scenario', minLength: 1, }, gherkin_syntax: { type: 'string', description: 'Gherkin syntax content for the feature', minLength: 1, }, tags: { type: 'array', items: { type: 'string' }, description: 'Test ID tags for the scenario', }, output_path: { type: 'string', description: 'Path where the feature file should be saved', minLength: 1, }, }, required: ['scenario_title', 'gherkin_syntax', 'output_path'], additionalProperties: false, }, },
  • Helper method used by the handler to construct the Gherkin feature file content from scenario title, syntax, and tags.
    buildFeatureFileContent(scenario_title, gherkin_syntax, tags) { const tagString = tags.map(tag => `@${tag}`).join(' '); return `${tagString ? tagString + '\n' : ''}Feature: ${scenario_title} ${gherkin_syntax} `; }

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/raymondsambur/automation-script-generator'

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