Skip to main content
Glama

wp_seo_analyze_content

Analyze WordPress post content for SEO optimization by checking readability, keyword usage, structure, and technical factors to improve search visibility.

Instructions

Analyze WordPress post content for SEO optimization opportunities including readability, keyword density, structure, and technical factors

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoSite identifier for multi-site setups
postIdYesWordPress post ID to analyze
analysisTypeNoType of SEO analysis to perform (default: full)
focusKeywordsNoPrimary keywords to analyze for optimization

Implementation Reference

  • MCP handler function for wp_seo_analyze_content tool. Extracts parameters from args, creates logger, instantiates SEOTools if needed, and calls analyzeContent method.
    export async function handleAnalyzeContent(client: WordPressClient, args: Record<string, unknown>): Promise<unknown> { const logger = LoggerFactory.tool("wp_seo_analyze_content"); try { const seoTools = getSEOToolsInstance(); const params: SEOToolParams = { postId: args.postId as number, analysisType: args.analysisType as SEOAnalysisType, focusKeywords: args.focusKeywords as string[], site: args.site as string, }; return await seoTools.analyzeContent(params); } catch (error) { logger.error("Failed to analyze content", { error, args }); throw error; } }
  • Tool schema definition for wp_seo_analyze_content, including input schema with properties for postId (required), analysisType, focusKeywords, and site.
    export const analyzeContentTool: Tool = { name: "wp_seo_analyze_content", description: "Analyze WordPress post content for SEO optimization opportunities including readability, keyword density, structure, and technical factors", inputSchema: { type: "object", properties: { postId: { type: "number", description: "WordPress post ID to analyze", }, analysisType: { type: "string", enum: ["readability", "keywords", "structure", "full"], description: "Type of SEO analysis to perform (default: full)", }, focusKeywords: { type: "array", items: { type: "string" }, description: "Primary keywords to analyze for optimization", }, site: { type: "string", description: "Site identifier for multi-site setups", }, }, required: ["postId"], }, };
  • Registration mapping in SEOTools.getHandlerForTool that links tool name 'wp_seo_analyze_content' to its handler function handleAnalyzeContent. Used by getTools() for MCP tool registration.
    private getHandlerForTool(toolName: string): unknown { const handlers: Record<string, unknown> = { wp_seo_analyze_content: handleAnalyzeContent, wp_seo_generate_metadata: handleGenerateMetadata, wp_seo_bulk_update_metadata: handleBulkUpdateMetadata, wp_seo_generate_schema: handleGenerateSchema, wp_seo_validate_schema: handleValidateSchema, wp_seo_suggest_internal_links: handleSuggestInternalLinks, wp_seo_site_audit: handlePerformSiteAudit, wp_seo_track_serp: handleTrackSERPPositions, wp_seo_keyword_research: handleKeywordResearch, wp_seo_test_integration: handleTestSEOIntegration, wp_seo_get_live_data: handleGetLiveSEOData, }; return ( handlers[toolName] || (() => { throw new Error(`Unknown SEO tool: ${toolName}`); }) ); }
  • Core implementation logic of the analysis in SEOTools.analyzeContent: handles caching, validation, client retrieval, performs analysis via performAnalysis, and error handling.
    async analyzeContent(params: SEOToolParams): Promise<SEOAnalysisResult> { const siteLogger = LoggerFactory.tool("wp_seo_analyze_content", params.site); return await siteLogger.time("SEO content analysis", async () => { try { validateRequired(params, ["postId", "analysisType"]); const client = this.getSiteClient(params.site); // Check cache first const cacheKey = `seo:analyze:${params.site}:${params.postId as number}:${params.analysisType}`; const cached = await this.getCachedResult(cacheKey); if (cached) { siteLogger.debug("Cache hit for content analysis", { cacheKey }); return cached as SEOAnalysisResult; } // Perform analysis (implementation will be added in analyzers) const result = await this.performAnalysis(client, params); // Cache the result await this.cacheResult(cacheKey, result, 21600); // 6 hours return result; } catch (_error) { handleToolError(_error, "analyze content", { site: params.site, postId: params.postId as number, }); throw _error; // handleToolError will format it properly } }); }

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/docdyhr/mcp-wordpress'

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