Skip to main content
Glama

check_compatibility

Check CSS and JavaScript features or files against specified browser targets to identify compatibility issues and receive remediation guidance.

Instructions

Check specific features or files against multiple browser targets with detailed analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featuresNoSpecific caniuse feature names to check (e.g., 'flexbox', 'css-grid')
filesNoSpecific file paths to analyze for features
targetsNoBrowser targets (chrome-37, firefox-esr, safari-12, ie-11, edge-legacy)

Implementation Reference

  • Core handler function that implements the logic for the check_compatibility tool. Parses arguments, optionally scans files for features using ProjectScanner, checks feature compatibility using EnhancedCompatibilityChecker, formats and returns results with recommendations.
    export async function handleCheckCompatibility(args) { const { features, files, targets = ['chrome-37'] } = args; let featuresToCheck = features || []; // If files are provided, scan them for features if (files && files.length > 0) { const scanResults = await projectScanner.scanSpecificFiles(files); const detectedFeatures = [...new Set(scanResults.flatMap(r => r.features))]; featuresToCheck = [...new Set([...featuresToCheck, ...detectedFeatures])]; } if (featuresToCheck.length === 0) { return { status: 'no-features', message: 'No features specified or detected in files', suggestion: 'Either provide specific features to check, or use scan_project to auto-detect features', availableTargets: compatibilityChecker.getSupportedBrowserTargets() }; } const result = await compatibilityChecker.checkSpecificFeatures(featuresToCheck, { targets }); return { features: featuresToCheck, targets, compatibility: result.compatibility, summary: { overallScore: result.summary.overallScore, byTarget: result.summary.targets, unsupportedFeatures: result.summary.commonUnsupported }, recommendations: result.summary.commonUnsupported.length > 0 ? [`Use get_fixes tool with features: ${result.summary.commonUnsupported.slice(0, 5).join(', ')}`] : ['All features are supported in the specified targets'], detailedResults: result }; }
  • index.js:52-87 (registration)
    MCP tool registration for 'check_compatibility', including title, description, Zod input schema for features/files/targets, and wrapper handler that invokes the core handleCheckCompatibility function and formats MCP response.
    // Register check_compatibility tool server.registerTool( "check_compatibility", { title: "Compatibility Checker", description: "Check specific features or files against multiple browser targets with detailed analysis", inputSchema: { features: z.array(z.string()).optional().describe("Specific caniuse feature names to check (e.g., 'flexbox', 'css-grid')"), files: z.array(z.string()).optional().describe("Specific file paths to analyze for features"), targets: z.array(z.string()).optional().default(["chrome-37"]).describe("Browser targets (chrome-37, firefox-esr, safari-12, ie-11, edge-legacy)") } }, async (args) => { try { const result = await handleCheckCompatibility(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 the input parameters and try again. Use 'scan_project' first to detect features automatically." }, null, 2) }], isError: true }; } } );
  • Input schema definition using Zod for the check_compatibility tool, defining optional arrays for features, files, and targets with descriptions.
    title: "Compatibility Checker", description: "Check specific features or files against multiple browser targets with detailed analysis", inputSchema: { features: z.array(z.string()).optional().describe("Specific caniuse feature names to check (e.g., 'flexbox', 'css-grid')"), files: z.array(z.string()).optional().describe("Specific file paths to analyze for features"), targets: z.array(z.string()).optional().default(["chrome-37"]).describe("Browser targets (chrome-37, firefox-esr, safari-12, ie-11, edge-legacy)") } },

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