Skip to main content
Glama

wp_seo_get_live_data

Retrieve live SEO data from WordPress posts to analyze metadata, check configurations, and get optimization recommendations for improved search visibility.

Instructions

Retrieve live SEO data from WordPress including plugin-specific metadata and configurations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoSite identifier for multi-site setups
postIdYesWordPress post ID to get SEO data for
includeAnalysisNoInclude SEO analysis of the live data
includeRecommendationsNoInclude optimization recommendations

Implementation Reference

  • Defines the Tool object for 'wp_seo_get_live_data' including name, description, and input schema requiring postId.
    export const getLiveSEODataTool: Tool = { name: "wp_seo_get_live_data", description: "Retrieve live SEO data from WordPress including plugin-specific metadata and configurations", inputSchema: { type: "object", properties: { postId: { type: "number", description: "WordPress post ID to get SEO data for", }, includeAnalysis: { type: "boolean", description: "Include SEO analysis of the live data", }, includeRecommendations: { type: "boolean", description: "Include optimization recommendations", }, site: { type: "string", description: "Site identifier for multi-site setups", }, }, required: ["postId"], }, };
  • Registers the handler mapping for 'wp_seo_get_live_data' to 'handleGetLiveSEOData' in the getHandlerForTool function, used by getTools() for MCP registration.
    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, };
  • The registered MCP handler function that parses arguments and delegates to SEOTools instance's getLiveSEOData method.
    /** * Handle get live SEO data request */ export async function handleGetLiveSEOData(client: WordPressClient, args: Record<string, unknown>): Promise<unknown> { const logger = LoggerFactory.tool("wp_seo_get_live_data"); try { const seoTools = getSEOToolsInstance(); const params: SEOToolParams = { postId: args.postId as number, includeAnalysis: args.includeAnalysis as boolean, includeRecommendations: args.includeRecommendations as boolean, site: args.site as string, }; return await seoTools.getLiveSEOData(params); } catch (error) { logger.error("Failed to get live SEO data", { error, args }); throw error; } }
  • Core tool logic implementation that retrieves live SEO data from WordPress site using SEOWordPressClient, performs analysis, and structures the response with post details and statistics.
    /** * Get live SEO data for multiple posts */ async getLiveSEOData(params: SEOToolParams & { maxPosts?: number }): Promise<unknown> { const siteLogger = LoggerFactory.tool("wp_seo_get_live_data", params.site); return await siteLogger.time("Get live SEO data", async () => { try { const seoClient = await this.getSEOClient(params.site); // Get all posts with SEO data const postsWithSEO = await seoClient.getAllPostsWithSEO({ maxPosts: params.maxPosts || 20, includePages: true, }); // Analyze the SEO data const analysis = this.analyzeLiveSEOData(postsWithSEO); const result = { totalContent: postsWithSEO.length, contentWithSEO: postsWithSEO.filter((p) => p.seoData).length, analysis, posts: postsWithSEO.map((post) => ({ id: post.id, title: post.title?.rendered, type: post.type, url: post.link, seoData: post.seoData ? { hasTitle: !!post.seoData.title, hasDescription: !!post.seoData.description, hasFocusKeyword: !!post.seoData.focusKeyword, plugin: post.seoData.plugin, lastModified: post.seoData.lastModified, } : null, })), retrievedAt: new Date().toISOString(), }; siteLogger.info("Live SEO data retrieved", { totalContent: result.totalContent, withSEO: result.contentWithSEO, plugin: analysis.detectedPlugin, }); return result; } catch (_error) { handleToolError(_error, "get live SEO data", { site: params.site, maxPosts: params.maxPosts, }); throw _error; } }); }

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