Skip to main content
Glama

Fix Generator

get_fixes

Get actionable remediation steps, polyfills, and alternatives for unsupported CSS/JS features to resolve browser compatibility issues.

Instructions

Get actionable remediation steps, polyfills, and alternatives for unsupported features

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featuresYesFeatures that need fixes (from compatibility check results)
priorityNoFilter fixes by priority levelall
includeExamplesNoInclude code examples in the response
includeCommandsNoInclude terminal commands for installation/setup

Implementation Reference

  • Main handler function for the get_fixes tool. Parses arguments, validates input, calls FixGenerator.generateFixes, and formats the response.
    export function handleGetFixes(args) {
      const { features, priority = 'all', includeExamples = true, includeCommands = true } = args;
    
      if (!features || features.length === 0) {
        return {
          error: true,
          message: 'No features specified for fixes',
          suggestion: 'Provide an array of feature names that need fixes (from compatibility check results)'
        };
      }
    
      const result = fixGenerator.generateFixes(features, {
        priority,
        includeExamples,
        includeCommands
      });
    
      return {
        features,
        fixes: result.fixes,
        summary: result.summary,
        quickStart: result.quickStart,
        instructions: {
          step1: 'Review the fixes for each feature below',
          step2: 'Run the provided installation commands',
          step3: 'Follow the configuration instructions', 
          step4: 'Use generate_configs tool for complete build setup'
        }
      };
    }
  • index.js:90-125 (registration)
    MCP server registration of the get_fixes tool, including input schema definition and error-handling wrapper around handleGetFixes.
    server.registerTool(
      "get_fixes",
      {
        title: "Fix Generator",
        description: "Get actionable remediation steps, polyfills, and alternatives for unsupported features",
        inputSchema: {
          features: z.array(z.string()).describe("Features that need fixes (from compatibility check results)"),
          priority: z.enum(["critical", "high", "medium", "low", "all"]).optional().default("all").describe("Filter fixes by priority level"),
          includeExamples: z.boolean().optional().default(true).describe("Include code examples in the response"),
          includeCommands: z.boolean().optional().default(true).describe("Include terminal commands for installation/setup")
        }
      },
      async (args) => {
        try {
          const result = handleGetFixes(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: "Provide an array of feature names that need fixes."
              }, null, 2)
            }],
            isError: true
          };
        }
      }
    );
  • Zod input schema defining parameters for the get_fixes tool: features (required array), priority, includeExamples, includeCommands.
      features: z.array(z.string()).describe("Features that need fixes (from compatibility check results)"),
      priority: z.enum(["critical", "high", "medium", "low", "all"]).optional().default("all").describe("Filter fixes by priority level"),
      includeExamples: z.boolean().optional().default(true).describe("Include code examples in the response"),
      includeCommands: z.boolean().optional().default(true).describe("Include terminal commands for installation/setup")
    }
  • Core generateFixes method in FixGenerator class that looks up fixes from the internal database, optionally generates commands and summaries for each feature.
    generateFixes(features, options = {}) {
      const { priority = 'all', includeExamples = true, includeCommands = true } = options;
      
      const fixes = features.map(feature => {
        const fixInfo = this.fixDatabase[feature];
        if (!fixInfo) {
          return {
            feature,
            status: 'unknown',
            message: `No fix information available for ${feature}`,
            suggestions: [
              'Check caniuse.com for manual compatibility info',
              'Search for polyfills or alternative implementations',
              'Consider progressive enhancement'
            ]
          };
        }
    
        const fix = {
          feature,
          priority: fixInfo.priority,
          alternatives: fixInfo.alternatives,
          polyfills: fixInfo.polyfills || [],
          buildSteps: fixInfo.buildSteps || [],
          documentation: fixInfo.documentation
        };
    
        if (includeExamples) {
          if (fixInfo.cssExample) fix.cssExample = fixInfo.cssExample;
          if (fixInfo.jsExample) fix.jsExample = fixInfo.jsExample;
        }
    
        if (includeCommands) {
          fix.commands = this._generateCommands(feature, fixInfo);
        }
    
        return fix;
      });
    
      return {
        fixes,
        summary: this._generateFixSummary(fixes),
        quickStart: this._generateQuickStart(fixes)
      };
    }
  • Constructor initializes FixGenerator with fixDatabase containing detailed fix information (priorities, alternatives, polyfills, build steps, examples) for various CSS/JS features.
      constructor() {
        this.fixDatabase = {
          // CSS Fixes
          'css-grid': {
            priority: 'critical',
            alternatives: ['flexbox', 'CSS tables', 'float layouts'],
            polyfills: ['CSS Grid Polyfill'],
            buildSteps: [
              'npm install postcss-grid-kiss --save-dev',
              'Add postcss-grid-kiss to PostCSS plugins'
            ],
            cssExample: `/* Instead of Grid */
    .container { display: grid; grid-template-columns: 1fr 2fr; }
    
    /* Use Flexbox */
    .container { display: flex; }
    .item1 { flex: 1; }
    .item2 { flex: 2; }`,
            documentation: 'https://css-tricks.com/snippets/css/complete-guide-grid/'
          },
    
          'flexbox': {
            priority: 'high',
            alternatives: ['CSS tables', 'inline-block', 'float layouts'],
            polyfills: ['flexibility.js', 'flexie'],
            buildSteps: [
              'npm install flexibility --save',
              'Add flexibility polyfill to your HTML'
            ],
            cssExample: `/* Add vendor prefixes */
    .container {
      display: -webkit-flex;
      display: flex;
      -webkit-justify-content: center;
      justify-content: center;
    }`,
            prefixes: ['-webkit-', '-moz-', '-ms-'],
            documentation: 'https://css-tricks.com/snippets/css/a-guide-to-flexbox/'
          },
    
          'css-variables': {
            priority: 'medium',
            alternatives: ['Sass variables', 'Less variables', 'PostCSS custom properties'],
            polyfills: ['css-vars-ponyfill'],
            buildSteps: [
              'npm install css-vars-ponyfill --save',
              'npm install postcss-custom-properties --save-dev'
            ],
            cssExample: `/* Instead of CSS Variables */
    :root { --main-color: blue; }
    .element { color: var(--main-color); }
    
    /* Use fixed values with Sass */
    $main-color: blue;
    .element { color: $main-color; }`,
            documentation: 'https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties'
          },
    
          'object-fit': {
            priority: 'medium',
            alternatives: ['background-size on wrapper divs'],
            polyfills: ['object-fit-images'],
            buildSteps: [
              'npm install object-fit-images --save',
              'Import and initialize polyfill in JS'
            ],
            cssExample: `/* Instead of object-fit */
    img { object-fit: cover; }
    
    /* Use background approach */
    .img-wrapper { 
      background-image: url(image.jpg);
      background-size: cover;
      background-position: center;
    }`,
            jsExample: `import objectFitImages from 'object-fit-images';
    objectFitImages();`,
            documentation: 'https://github.com/bfred-it/object-fit-images'
          },
    
          // JavaScript Fixes
          'arrow-functions': {
            priority: 'high',
            alternatives: ['function expressions', 'regular functions'],
            polyfills: [],
            buildSteps: [
              'npm install @babel/preset-env --save-dev',
              'Add "@babel/preset-env" to .babelrc presets'
            ],
            jsExample: `// Instead of arrow functions
    const add = (a, b) => a + b;
    
    // Use regular functions  
    const add = function(a, b) { return a + b; };`,
            babelConfig: {
              presets: [['@babel/preset-env', { targets: { chrome: '37' } }]]
            },
            documentation: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions'
          },
    
          'const': {
            priority: 'high',
            alternatives: ['var declarations'],
            polyfills: [],
            buildSteps: [
              'npm install @babel/preset-env --save-dev',
              'Configure Babel to transpile const/let'
            ],
            jsExample: `// Instead of const/let
    const value = 'hello';
    let counter = 0;
    
    // Use var (with careful scoping)
    var value = 'hello';
    var counter = 0;`,
            documentation: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const'
          },
    
          'template-literals': {
            priority: 'medium',
            alternatives: ['string concatenation'],
            polyfills: [],
            buildSteps: [
              'npm install @babel/preset-env --save-dev',
              'Enable template literal transformation'
            ],
            jsExample: `// Instead of template literals
    const message = \`Hello \${name}!\`;
    
    // Use concatenation
    const message = 'Hello ' + name + '!';`,
            documentation: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals'
          },
    
          'promises': {
            priority: 'critical',
            alternatives: ['callbacks', 'async libraries'],
            polyfills: ['es6-promise', 'core-js'],
            buildSteps: [
              'npm install es6-promise --save',
              'Import polyfill at app entry point'
            ],
            jsExample: `// Import Promise polyfill
    import 'es6-promise/auto';
    
    // Or use callbacks
    function fetchData(callback) {
      // async operation
      callback(null, data);
    }`,
            documentation: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'
          }
        };
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the types of outputs (remediation steps, polyfills, alternatives) but doesn't disclose behavioral traits like whether this is a read-only operation, potential rate limits, authentication needs, or what happens if features are invalid. For a tool with no annotation coverage, this is insufficient.

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 words. Every part earns its place by specifying what is retrieved and for what purpose.

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 no annotations and no output schema, the description is minimally complete for a tool that likely returns informational content. It covers the purpose but lacks details on behavioral aspects and output format, which are important for an agent to use it correctly without structured output guidance.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any meaning beyond what the schema provides about parameters like 'features', 'priority', etc. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the verb 'Get' and specifies the resources: 'actionable remediation steps, polyfills, and alternatives for unsupported features'. It distinguishes from siblings like 'check_compatibility' (which likely identifies issues) by focusing on generating solutions rather than detecting problems.

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

Usage Guidelines3/5

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

The description implies usage after compatibility issues are identified (via 'from compatibility check results' in the schema), suggesting it follows 'check_compatibility'. However, it doesn't explicitly state when to use this tool versus alternatives like 'generate_configs' or 'manage_config', leaving some ambiguity about workflow 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/Amirmahdi-Kaheh/caniuse-mcp'

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