get_content_recommendations
Analyze content against a target keyword to generate prioritized optimization recommendations for better search visibility.
Instructions
Get a prioritized list of specific improvements to optimize content for a target keyword.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The content to analyze | |
| keyword | Yes | The target keyword |
Implementation Reference
- mcp-server/src/index.ts:372-447 (handler)The `get_content_recommendations` tool is registered and implemented within `mcp-server/src/index.ts`. It takes `content` and `keyword` as inputs, uses `scoreContent`, `analyzeSERP`, and `countWords` to evaluate the content, then generates and prioritizes a list of recommendations based on SERP benchmarks and content scores.
server.tool( "get_content_recommendations", "Get a prioritized list of specific improvements to optimize content for a target keyword.", { content: z.string().describe("The content to analyze"), keyword: z.string().describe("The target keyword"), }, async ({ content, keyword }) => { const { overallScore, categories, recommendations } = scoreContent(content, keyword); const serp = analyzeSERP(keyword); const words = countWords(content); const prioritized: { priority: "high" | "medium" | "low"; recommendation: string }[] = []; // High priority: low-scoring categories for (const [name, cat] of Object.entries(categories)) { const ratio = cat.score / cat.maxScore; if (ratio < 0.4) { prioritized.push({ priority: "high", recommendation: `[${name}] ${cat.details}` }); } } // Word count gap if (words < serp.averages.recommendedWordCount * 0.7) { prioritized.push({ priority: "high", recommendation: `Content is ${words} words. Top-ranking pages average ${serp.averages.wordCount} words. Aim for ${serp.averages.recommendedWordCount}+.`, }); } // Add scored recommendations for (const rec of recommendations) { const isHigh = rec.toLowerCase().includes("keyword") && rec.toLowerCase().includes("first paragraph"); prioritized.push({ priority: isHigh ? "high" : "medium", recommendation: rec }); } // Missing topics const topics = getKeywordTopics(keyword); const contentLower = content.toLowerCase(); const missing = topics.filter((t) => !contentLower.includes(t.toLowerCase())); if (missing.length > topics.length * 0.5) { prioritized.push({ priority: "high", recommendation: `Missing ${missing.length}/${topics.length} key topics. Add sections on: ${missing.slice(0, 5).join(", ")}.`, }); } // Deduplicate const seen = new Set<string>(); const unique = prioritized.filter((r) => { if (seen.has(r.recommendation)) return false; seen.add(r.recommendation); return true; }); // Sort by priority const order = { high: 0, medium: 1, low: 2 }; unique.sort((a, b) => order[a.priority] - order[b.priority]); return { content: [ { type: "text" as const, text: JSON.stringify({ overallScore, targetKeyword: keyword, recommendations: unique, serpBenchmark: { avgWordCount: serp.averages.wordCount, recommendedWordCount: serp.averages.recommendedWordCount, avgHeadings: serp.averages.headingCount, }, }, null, 2), }, ], };