run_best_practices_audit
Audit web pages for performance, accessibility, and SEO best practices using Chromium on ARM64 devices to identify and resolve common issues.
Instructions
Run a best practices audit on the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:948-986 (handler)The main handler function that executes the 'run_best_practices_audit' tool. It ensures the Chromium instance is running, injects JavaScript via CDP to audit the page for best practices (HTTPS usage, mixed HTTP content, deprecated HTML tags, viewport meta tag presence), parses the results, and returns a formatted text response.async runBestPracticesAudit() { await this.ensureChromium(); const result = await this.sendCDPCommand('Runtime.evaluate', { expression: ` const results = []; if (location.protocol !== 'https:') { results.push('Page is not served over HTTPS'); } const httpResources = Array.from(document.querySelectorAll('[src], [href]')) .filter(el => (el.src || el.href)?.startsWith('http:')) .length; if (httpResources > 0) { results.push(\`Found \${httpResources} HTTP resources on HTTPS page\`); } const deprecatedTags = Array.from(document.querySelectorAll('font, center, big, small, tt')).length; if (deprecatedTags > 0) { results.push(\`Found \${deprecatedTags} deprecated HTML tags\`); } const viewport = document.querySelector('meta[name="viewport"]'); if (!viewport) { results.push('Missing viewport meta tag for mobile optimization'); } JSON.stringify(results.length > 0 ? results : ['Best practices checks passed']); `, returnByValue: true }); const bestPracticesResults = JSON.parse(result.result?.value || '[]'); return { content: [{ type: 'text', text: `Best Practices Audit Results:\\n${bestPracticesResults.join('\\n')}` }], }; }
- index.js:304-310 (registration)Registers the 'run_best_practices_audit' tool in the list of available tools returned by ListToolsRequestSchema, including its name, description, and input schema (empty object, no required parameters).name: 'run_best_practices_audit', description: 'Run a best practices audit on the current page', inputSchema: { type: 'object', properties: {}, }, },
- index.js:385-386 (handler)Dispatch case in the CallToolRequestSchema handler that routes calls to 'run_best_practices_audit' to the runBestPracticesAudit method.case 'run_best_practices_audit': return await this.runBestPracticesAudit();
- index.js:306-309 (schema)Input schema for the tool: an empty object (no properties or required fields).inputSchema: { type: 'object', properties: {}, },