Skip to main content
Glama

Config Generator

generate_configs

Generate build configurations and CI/CD workflows for browser compatibility based on specified targets and project frameworks.

Instructions

Generate complete build configurations, CI/CD setups, and workflow files for browser compatibility

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
configTypeNoType of configuration to generateall
targetNoPrimary browser target for configurationchrome-37
includePolyfillsNoInclude polyfill configurations
projectTypeNoProject framework typereact

Implementation Reference

  • The primary handler function that executes the generate_configs tool logic. Parses input arguments, delegates config generation to FixGenerator, adds installation instructions, and formats the response.
    export function handleGenerateConfigs(args) {
      const {
        configType = 'all',
        target = 'chrome-37', 
        includePolyfills = true,
        projectType = 'react'
      } = args;
    
      const result = fixGenerator.generateWorkflowConfig(configType, {
        target,
        includePolyfills,
        projectType
      });
    
      // Add installation instructions
      const installInstructions = [];
      
      if (configType === 'all' || configType === 'babel') {
        const babelConfig = configType === 'all' ? result.babel : result;
        if (babelConfig.installCommand) {
          installInstructions.push({
            step: 'Install Babel dependencies',
            command: babelConfig.installCommand
          });
        }
      }
    
      if (configType === 'all' || configType === 'postcss') {
        const postcssConfig = configType === 'all' ? result.postcss : result;
        if (postcssConfig.installCommand) {
          installInstructions.push({
            step: 'Install PostCSS dependencies', 
            command: postcssConfig.installCommand
          });
        }
      }
    
      return {
        configType,
        target,
        projectType,
        configs: result,
        installation: installInstructions,
        instructions: [
          '1. Run the installation commands above',
          '2. Create the configuration files with the provided content',
          '3. Update your package.json scripts if needed',
          '4. Test your build process',
          '5. Run compatibility checks again to verify fixes'
        ],
        nextSteps: [
          'Test the build configuration with your project',
          'Run scan_project again to verify compatibility improvements',
          'Set up CI/CD integration if not already done'
        ]
      };
    }
  • index.js:128-163 (registration)
    Registers the generate_configs tool with the MCP server, including title, description, input schema validation using Zod, and the handler callback.
    server.registerTool(
      "generate_configs",
      {
        title: "Config Generator",
        description: "Generate complete build configurations, CI/CD setups, and workflow files for browser compatibility",
        inputSchema: {
          configType: z.enum(["babel", "postcss", "webpack", "package-json", "ci", "git-hooks", "all"]).optional().default("all").describe("Type of configuration to generate"),
          target: z.string().optional().default("chrome-37").describe("Primary browser target for configuration"),
          includePolyfills: z.boolean().optional().default(true).describe("Include polyfill configurations"),
          projectType: z.enum(["react", "vanilla-js", "vue", "angular"]).optional().default("react").describe("Project framework type")
        }
      },
      async (args) => {
        try {
          const result = handleGenerateConfigs(args);
          return {
            content: [{
              type: "text",
              text: JSON.stringify(result, null, 2)
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                error: true,
                message: error.message,
                suggestion: "Check configuration parameters and try again."
              }, null, 2)
            }],
            isError: true
          };
        }
      }
    );
  • Key helper method in FixGenerator class that orchestrates the generation of various configuration types (Babel, PostCSS, Webpack, etc.) based on the requested configType, delegating to specific generators.
    generateWorkflowConfig(type, options = {}) {
      const { target = 'chrome-37', includePolyfills = true, includeDevDeps = true } = options;
      
      switch (type) {
        case 'babel':
          return this._generateBabelConfig(target, includePolyfills);
        case 'postcss':
          return this._generatePostCSSConfig(target);
        case 'webpack':
          return this._generateWebpackConfig(target);
        case 'package-json':
          return this._generatePackageJsonConfig(includeDevDeps);
        case 'ci':
          return this._generateCIConfig();
        case 'git-hooks':
          return this._generateGitHooks();
        case 'all':
          return {
            babel: this._generateBabelConfig(target, includePolyfills),
            postcss: this._generatePostCSSConfig(target),
            webpack: this._generateWebpackConfig(target),
            packageJson: this._generatePackageJsonConfig(includeDevDeps),
            ci: this._generateCIConfig(),
            gitHooks: this._generateGitHooks()
          };
        default:
          throw new Error(`Unknown config type: ${type}`);
      }
    }
  • Specific helper method for generating Babel configuration tailored for the target browser, including presets, plugins, required packages, and installation command.
    _generateBabelConfig(target, includePolyfills) {
      const targetVersion = target === 'chrome-37' ? '37' : '60';
      return {
        filename: '.babelrc',
        content: JSON.stringify({
          presets: [
            ['@babel/preset-env', {
              targets: { chrome: targetVersion },
              useBuiltIns: includePolyfills ? 'usage' : false,
              corejs: includePolyfills ? 3 : undefined
            }],
            '@babel/preset-react'
          ],
          plugins: [
            '@babel/plugin-proposal-class-properties',
            '@babel/plugin-transform-runtime'
          ]
        }, null, 2),
        packages: [
          '@babel/core',
          '@babel/preset-env',
          '@babel/preset-react', 
          '@babel/plugin-proposal-class-properties',
          '@babel/plugin-transform-runtime',
          ...(includePolyfills ? ['core-js@3'] : [])
        ],
        installCommand: `npm install ${[
          '@babel/core',
          '@babel/preset-env',
          '@babel/preset-react',
          '@babel/plugin-proposal-class-properties',
          '@babel/plugin-transform-runtime'
        ].join(' ')} --save-dev`
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'generates' configurations, implying a creation/write operation, but doesn't disclose critical traits like whether this overwrites existing files, requires specific permissions, has side effects, or handles errors. For a tool with no annotations and potential file system impacts, this is a significant gap.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. Every word contributes to understanding the tool's function, and there is no redundancy or wasted phrasing.

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

Completeness2/5

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

Given the tool's complexity (generating multiple configuration types with 4 parameters) and the absence of both annotations and an output schema, the description is incomplete. It doesn't address behavioral risks, output format, or integration context, leaving significant gaps for an AI agent to infer safe and correct usage.

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, with all parameters well-documented in the schema itself (e.g., 'configType' with enum values, 'target' as browser target). The description adds no additional parameter semantics beyond what the schema provides, such as explaining interactions between parameters or usage examples. With high schema coverage, the baseline score of 3 is appropriate.

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 tool's purpose: 'Generate complete build configurations, CI/CD setups, and workflow files for browser compatibility.' It specifies the verb 'generate' and the resources (configurations, setups, files) with a clear scope (browser compatibility). However, it doesn't explicitly differentiate from sibling tools like 'manage_config' or 'scan_project', which likely have overlapping domains.

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. It doesn't mention sibling tools like 'check_compatibility' or 'manage_config', nor does it specify prerequisites, exclusions, or contextual triggers. Usage is implied by the purpose but not explicitly stated.

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/Amirmahdi-Kaheh/caniuse-mcp'

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