Skip to main content
Glama

wp_performance_benchmark

Compare WordPress site performance against industry benchmarks to identify optimization opportunities and receive improvement recommendations.

Instructions

Compare current performance against industry benchmarks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoSpecific site ID for multi-site setups (optional for single site)
categoryNoBenchmark category (response_time, cache_performance, error_rate, system_resources, all)
includeRecommendationsNoInclude improvement recommendations (default: true)

Implementation Reference

  • Registration of the wp_performance_benchmark tool, including schema (parameters) and handler binding in PerformanceTools.getTools() method.
    { name: "wp_performance_benchmark", description: "Compare current performance against industry benchmarks", parameters: [ { name: "site", type: "string", description: "Specific site ID for multi-site setups (optional for single site)", required: false, }, { name: "category", type: "string", description: "Benchmark category (response_time, cache_performance, error_rate, system_resources, all)", required: false, }, { name: "includeRecommendations", type: "boolean", description: "Include improvement recommendations (default: true)", required: false, }, ], handler: this.getBenchmarkComparison.bind(this), },
  • Handler function that executes the tool: collects benchmarks from PerformanceAnalytics, filters by category, generates recommendations, formats results using helpers, and returns structured comparison data.
    private async getBenchmarkComparison(_client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { return toolWrapper(async () => { const { site, category = "all", includeRecommendations = true, } = params as { site?: string; category?: string; includeRecommendations?: boolean; }; // Get benchmark comparisons const benchmarks = this.analytics.benchmarkPerformance() as BenchmarkComparison[]; // Filter by category if specified let filteredBenchmarks = benchmarks; if (category !== "all") { const categoryMap: Record<string, string> = { response_time: "Response Time", cache_performance: "Cache Hit Rate", error_rate: "Error Rate", system_resources: "Memory Usage", }; const targetCategory = categoryMap[category as string]; if (targetCategory) { filteredBenchmarks = benchmarks.filter((b) => b.category === targetCategory); } } // Get recommendations if requested let recommendations = null; if (includeRecommendations) { const insights = this.analytics.generateInsights(); recommendations = insights .filter((insight) => insight.category === "optimization") .map((insight) => ({ title: insight.title, description: insight.description, priority: insight.priority, estimatedImprovement: insight.estimatedImprovement, implementationEffort: insight.implementationEffort, })); } return { success: true, data: { benchmarks: filteredBenchmarks.map((benchmark) => ({ ...benchmark, status: formatBenchmarkStatus(benchmark.status), improvement: benchmark.improvement > 0 ? { needed: benchmark.improvement, description: getBenchmarkImprovementDescription(benchmark), } : null, })), overallRanking: calculateOverallRanking(benchmarks), recommendations: recommendations || [], metadata: { timestamp: new Date().toISOString(), category, site: site || "all", benchmarkVersion: "2024-industry-standards", }, }, }; }); }
  • Helper function to format benchmark status with emojis, used in the handler for output formatting.
    export function formatBenchmarkStatus(status: string): string { const statusMap: Record<string, string> = { excellent: "🟢 Excellent", good: "🟡 Good", average: "🟠 Average", below_average: "🔴 Below Average", poor: "⚫ Poor", }; return statusMap[status] || status; }
  • Helper to generate human-readable improvement descriptions for benchmarks, used conditionally in the handler.
    export function getBenchmarkImprovementDescription(benchmark: BenchmarkComparison): string { const improvements: Record<string, string> = { "Response Time": `Reduce by ${benchmark.improvement.toFixed(0)}ms`, "Cache Hit Rate": `Increase by ${benchmark.improvement.toFixed(1)}%`, "Error Rate": `Reduce by ${benchmark.improvement.toFixed(2)}%`, "Memory Usage": `Reduce by ${benchmark.improvement.toFixed(0)}%`, }; return improvements[benchmark.category] || `Improve by ${benchmark.improvement}`; }
  • Helper to compute overall performance ranking percentile and status from benchmark results, used in handler summary.
    export function calculateOverallRanking(benchmarks: BenchmarkComparison[]): { percentile: number; status: string } { const statuses = benchmarks.map((b) => b.status); const excellentCount = statuses.filter((s) => s === "excellent").length; const goodCount = statuses.filter((s) => s === "good").length; const percentile = ((excellentCount + goodCount * 0.8) / statuses.length) * 100; let status = "Needs Improvement"; if (percentile >= 90) status = "Top Performer"; else if (percentile >= 75) status = "Above Average"; else if (percentile >= 50) status = "Average"; return { percentile: Math.round(percentile), status }; }

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