scan_project
Analyze project files to detect CSS/JS features and check compatibility across specified browser targets, identifying potential issues and providing remediation guidance.
Instructions
Analyze project files to detect CSS/JS features and check compatibility across browser targets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| excludeDirs | No | Directories to exclude from scanning | |
| maxDepth | No | Maximum directory depth to scan | |
| projectPath | No | Path to the project directory to scan (default: current directory) | . |
| targets | No | Browser targets to check (e.g., 'chrome-37', 'firefox-esr', 'safari-12') |
Implementation Reference
- src/enhanced-tools.js:13-55 (handler)Core handler function that executes the scan_project tool logic: extracts parameters, invokes project compatibility check, and formats results for MCP response.export async function handleScanProject(args) { const { projectPath = '.', targets = ['chrome-37'], maxDepth = 5, excludeDirs = ['node_modules', '.git', 'dist', 'build'] } = args; const scanOptions = { maxDepth, excludeDirs }; const result = await compatibilityChecker.checkProjectCompatibility( projectPath, { targets, scanOptions, includeRecommendations: true } ); // Format for better UX return { status: result.status || 'completed', project: { path: projectPath, scanned: `${result.projectScan?.totalFiles || 0} files`, jsFiles: result.projectScan?.jsFiles || 0, cssFiles: result.projectScan?.cssFiles || 0, featuresDetected: result.features?.length || 0 }, compatibility: { targets: Object.keys(result.compatibility || {}), overallScore: result.summary?.overallScore || 100, criticalIssues: result.summary?.criticalIssues?.length || 0, commonUnsupported: result.summary?.commonUnsupported || [] }, recommendations: result.recommendations || [], nextSteps: result.nextSteps || [], detailedResults: { features: result.features, targetResults: result.compatibility, summary: result.summary } }; }
- index.js:20-25 (schema)Input schema definition for the scan_project tool using Zod, specifying parameters like projectPath, targets, maxDepth, and excludeDirs.inputSchema: { projectPath: z.string().optional().default(".").describe("Path to the project directory to scan (default: current directory)"), targets: z.array(z.string()).optional().default(["chrome-37"]).describe("Browser targets to check (e.g., 'chrome-37', 'firefox-esr', 'safari-12')"), maxDepth: z.number().optional().default(5).describe("Maximum directory depth to scan"), excludeDirs: z.array(z.string()).optional().default(["node_modules", ".git", "dist", "build"]).describe("Directories to exclude from scanning") }
- index.js:15-50 (registration)MCP server registration of the scan_project tool, including title, description, input schema, and wrapper handler that calls handleScanProject.server.registerTool( "scan_project", { title: "Project Scanner", description: "Analyze project files to detect CSS/JS features and check compatibility across browser targets", inputSchema: { projectPath: z.string().optional().default(".").describe("Path to the project directory to scan (default: current directory)"), targets: z.array(z.string()).optional().default(["chrome-37"]).describe("Browser targets to check (e.g., 'chrome-37', 'firefox-esr', 'safari-12')"), maxDepth: z.number().optional().default(5).describe("Maximum directory depth to scan"), excludeDirs: z.array(z.string()).optional().default(["node_modules", ".git", "dist", "build"]).describe("Directories to exclude from scanning") } }, async (args) => { try { const result = await handleScanProject(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: "Try using 'scan_project' to automatically detect and check your project's compatibility." }, null, 2) }], isError: true }; } } );