Skip to main content
Glama
sharozdawa

content-optimizer-mcp

analyze_keyword

Analyze SERP data for keywords to identify word counts, heading patterns, common topics, and SERP features in top results.

Instructions

Analyze SERP data for a keyword. Returns simulated top 10 results with word counts, heading counts, common topics, and SERP features.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYesThe keyword to analyze

Implementation Reference

  • Registration and handler definition for the 'analyze_keyword' tool.
    server.tool(
      "analyze_keyword",
      "Analyze SERP data for a keyword. Returns simulated top 10 results with word counts, heading counts, common topics, and SERP features.",
      {
        keyword: z.string().describe("The keyword to analyze"),
      },
      async ({ keyword }) => {
        const result = analyzeSERP(keyword);
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      }
    );
  • The core logic function 'analyzeSERP' which generates the keyword analysis data.
    function analyzeSERP(keyword: string) {
      const rng = seededRandom(keyword.toLowerCase());
      const topics = getKeywordTopics(keyword);
    
      const results = [];
      for (let i = 0; i < 10; i++) {
        const wordCount = 800 + Math.floor(rng() * 2500);
        const headingCount = 3 + Math.floor(rng() * 12);
        const h2Count = 2 + Math.floor(rng() * 8);
        const h3Count = Math.floor(rng() * 6);
    
        results.push({
          position: i + 1,
          title: `${keyword.charAt(0).toUpperCase() + keyword.slice(1)}: ${["Complete Guide", "Everything You Need to Know", "Ultimate Guide", "Best Practices", "How to Get Started", "Expert Tips", "A Comprehensive Overview", "Step-by-Step Guide", "What You Should Know", "Top Strategies"][i]}`,
          wordCount,
          headingCount,
          h2Count,
          h3Count,
          estimatedReadingTime: `${Math.ceil(wordCount / 250)} min`,
        });
      }
    
      const avgWordCount = Math.round(results.reduce((s, r) => s + r.wordCount, 0) / 10);
      const avgHeadings = Math.round(results.reduce((s, r) => s + r.headingCount, 0) / 10);
    
      return {
        keyword,
        topResults: results,
        averages: {
          wordCount: avgWordCount,
          headingCount: avgHeadings,
          recommendedWordCount: Math.round(avgWordCount * 1.1),
        },
        commonTopics: topics,
        serpFeatures: {
          featuredSnippet: rng() > 0.4,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sharozdawa/content-optimizer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server