run_seo_audit
Analyze webpage SEO performance to identify optimization opportunities and improve search visibility.
Instructions
Run an SEO audit on the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:906-946 (handler)The main handler function for the 'run_seo_audit' tool. It evaluates JavaScript in the browser context to check for common SEO issues: title tag, meta description, H1 tags, and canonical link.async runSEOAudit() { await this.ensureChromium(); const result = await this.sendCDPCommand('Runtime.evaluate', { expression: ` const results = []; const title = document.querySelector('title'); if (!title || title.textContent.trim().length === 0) { results.push('Missing or empty title tag'); } else if (title.textContent.length > 60) { results.push('Title tag is too long (>60 characters)'); } const metaDesc = document.querySelector('meta[name="description"]'); if (!metaDesc || metaDesc.getAttribute('content').trim().length === 0) { results.push('Missing or empty meta description'); } const h1Tags = document.querySelectorAll('h1'); if (h1Tags.length === 0) { results.push('No H1 tag found'); } else if (h1Tags.length > 1) { results.push('Multiple H1 tags found'); } const canonical = document.querySelector('link[rel="canonical"]'); if (!canonical) { results.push('Missing canonical link'); } JSON.stringify(results.length > 0 ? results : ['Basic SEO checks passed']); `, returnByValue: true }); const seoResults = JSON.parse(result.result?.value || '[]'); return { content: [{ type: 'text', text: `SEO Audit Results:\\n${seoResults.join('\\n')}` }], }; }
- index.js:295-302 (schema)Tool schema definition including name, description, and input schema (empty properties). Used in ListToolsRequest response.{ name: 'run_seo_audit', description: 'Run an SEO audit on the current page', inputSchema: { type: 'object', properties: {}, }, },
- index.js:383-384 (registration)Registration in the CallToolRequestSchema switch statement that dispatches calls to the runSEOAudit handler method.case 'run_seo_audit': return await this.runSEOAudit();