web_seo_check
Analyze webpage SEO by checking title tags, meta descriptions, heading structure, and image attributes to identify optimization opportunities.
Instructions
Basic SEO analysis of a webpage (title, meta, headings, images)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to analyze |
Implementation Reference
- src/modules/web.ts:54-68 (handler)The `web_seo_check` tool implementation in `src/modules/web.ts`. It takes a URL, fetches the page content, and uses regex to analyze various SEO-related elements like title, meta description, H1/H2 counts, image alt tags, canonical link, and Open Graph title.
server.tool("web_seo_check", "Basic SEO analysis of a webpage (title, meta, headings, images)", { url: z.string().url().describe("URL to analyze") }, async ({ url }) => { const html = await safeFetchText(url); const title = html.match(/<title[^>]*>(.*?)<\/title>/i)?.[1] || "Missing"; const metaDesc = html.match(/<meta[^>]*name=["']description["'][^>]*content=["']([^"']*)/i)?.[1] || "Missing"; const h1Count = (html.match(/<h1/gi) || []).length; const h2Count = (html.match(/<h2/gi) || []).length; const imgCount = (html.match(/<img/gi) || []).length; const imgNoAlt = (html.match(/<img(?![^>]*alt=)[^>]*>/gi) || []).length; const canonical = html.match(/<link[^>]*rel=["']canonical["'][^>]*href=["']([^"']*)/i)?.[1] || "Missing"; const ogTitle = html.match(/<meta[^>]*property=["']og:title["'][^>]*content=["']([^"']*)/i)?.[1] || "Missing"; return { content: [{ type: "text", text: `**SEO Analysis:** ${url}\n\n**Title**: ${title} (${title.length} chars)\n**Meta Description**: ${metaDesc.substring(0, 100)}... (${metaDesc.length} chars)\n**Canonical**: ${canonical}\n**OG Title**: ${ogTitle}\n**H1 Tags**: ${h1Count}\n**H2 Tags**: ${h2Count}\n**Images**: ${imgCount} total, ${imgNoAlt} missing alt\n\n**Score**: ${title !== "Missing" && metaDesc !== "Missing" && h1Count === 1 ? "GOOD" : "NEEDS WORK"}` }] }; });