get_fixes
Provides remediation steps, polyfills, and alternatives for unsupported CSS/JS features to resolve browser compatibility issues in development projects.
Instructions
Get actionable remediation steps, polyfills, and alternatives for unsupported features
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| features | Yes | Features that need fixes (from compatibility check results) | |
| includeCommands | No | Include terminal commands for installation/setup | |
| includeExamples | No | Include code examples in the response | |
| priority | No | Filter fixes by priority level | all |
Implementation Reference
- src/enhanced-tools.js:96-125 (handler)Handler function that processes input arguments, validates features array, calls FixGenerator.generateFixes, and formats the response with instructions.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:89-125 (registration)Registers the get_fixes tool with the MCP server, defining its title, description, Zod input schema, and async wrapper that calls handleGetFixes and handles errors.// Register get_fixes tool 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 }; } } );
- index.js:95-100 (schema)Zod input schema defining parameters: features (array of strings), priority (enum with default 'all'), includeExamples (boolean default true), includeCommands (boolean default true).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") }
- src/fix-generator.js:201-245 (helper)Core helper method in FixGenerator class that generates fixes for given features by looking up a predefined fixDatabase, optionally including examples and commands, and computing summary/quickStart.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) }; }