run_nextjs_audit
Execute a Next.js-specific audit on the current webpage to identify performance, SEO, and accessibility issues. Optimize Next.js applications using Chromium ARM64 Browser for ARM64 devices like Raspberry Pi.
Instructions
Run a Next.js specific audit on the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:988-1027 (handler)The core handler function for the 'run_nextjs_audit' tool. It ensures Chromium is running, evaluates JavaScript in the browser context to perform Next.js-specific checks (e.g., presence of __NEXT_DATA__, image optimization, Link component usage, Head component), parses the results, and returns a formatted text response.async runNextJSAudit() { await this.ensureChromium(); const result = await this.sendCDPCommand('Runtime.evaluate', { expression: ` const results = []; const nextData = document.querySelector('#__NEXT_DATA__'); if (!nextData) { results.push('This does not appear to be a Next.js application'); JSON.stringify(results); } else { const nextImages = document.querySelectorAll('img[data-nimg]'); const regularImages = document.querySelectorAll('img:not([data-nimg])'); if (regularImages.length > 0 && nextImages.length === 0) { results.push(\`Consider using Next.js Image component for \${regularImages.length} images\`); } const internalLinks = Array.from(document.querySelectorAll('a[href^="/"]')).length; if (internalLinks > 0) { results.push(\`Found \${internalLinks} internal links - ensure Next.js Link component is used\`); } const headTags = document.querySelectorAll('meta, title, link[rel="stylesheet"]'); if (headTags.length < 3) { results.push('Consider using Next.js Head component for better SEO'); } JSON.stringify(results.length > 0 ? results : ['Next.js specific checks passed']); } `, returnByValue: true }); const nextjsResults = JSON.parse(result.result?.value || '[]'); return { content: [{ type: 'text', text: `Next.js Audit Results:\\n${nextjsResults.join('\\n')}` }], }; }
- index.js:312-318 (registration)Tool registration in the ListTools response, defining the name, description, and empty input schema (no parameters required).name: 'run_nextjs_audit', description: 'Run a Next.js specific audit on the current page', inputSchema: { type: 'object', properties: {}, }, },
- index.js:314-317 (schema)Input schema for the tool, which is an empty object (no required parameters).inputSchema: { type: 'object', properties: {}, },
- index.js:387-388 (handler)Dispatch handler in the CallToolRequest switch statement that routes calls to the runNextJSAudit method.case 'run_nextjs_audit': return await this.runNextJSAudit();
- index.js:1068-1068 (helper)Usage of runNextJSAudit within the comprehensive runAuditMode tool.results.nextjs = await this.runNextJSAudit();