Skip to main content
Glama

wp_performance_export

Export comprehensive WordPress performance reports with analytics, historical data, and customizable time ranges in JSON, CSV, or summary formats.

Instructions

Export comprehensive performance report

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoSpecific site ID for multi-site setups (optional for single site)
formatNoExport format (json, csv, summary)
includeHistoricalNoInclude historical data (default: true)
includeAnalyticsNoInclude analytics and insights (default: true)
timeRangeNoTime range for data export (1h, 6h, 24h, 7d, 30d)

Implementation Reference

  • The core handler function for the 'wp_performance_export' tool. It collects current performance metrics, optional historical data and analytics, formats the report (JSON, CSV, or summary), and returns the export data.
    private async exportPerformanceReport(_client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { return toolWrapper(async () => { const { site, format = "json", includeHistorical = true, includeAnalytics = true, timeRange = "24h", } = params as { site?: string; format?: string; includeHistorical?: boolean; includeAnalytics?: boolean; timeRange?: string; }; // Generate comprehensive analytics report const report = this.analytics.exportAnalyticsReport(); // Add additional data based on parameters const exportData: { currentMetrics: PerformanceMetrics; [key: string]: unknown; } = { metadata: { generatedAt: new Date().toISOString(), site: site || "all", timeRange, format, version: "1.0.0", }, summary: report.summary, currentMetrics: this.collector.collectCurrentMetrics(), }; if (includeHistorical) { const timeframMs = parseTimeframe(timeRange); const startTime = Date.now() - timeframMs; exportData.historicalData = this.monitor.getHistoricalData(startTime); } if (includeAnalytics) { exportData.analytics = { trends: report.trends, benchmarks: report.benchmarks, insights: report.insights, anomalies: report.anomalies, predictions: report.predictions, optimizationPlan: report.optimizationPlan, }; } // Add aggregated statistics exportData.aggregatedStats = { cache: this.collector.getAggregatedCacheStats(), client: this.collector.getAggregatedClientStats(), }; // Add site comparison if multi-site if (!site) { exportData.siteComparison = this.collector.compareSitePerformance(); } // Format output based on requested format let formattedOutput: unknown; if (format === "csv") { formattedOutput = convertToCSV(exportData); } else if (format === "summary") { formattedOutput = createSummaryReport(exportData); } else { formattedOutput = exportData; } return { success: true, data: formattedOutput, metadata: { timestamp: new Date().toISOString(), format, dataSize: JSON.stringify(exportData).length, site: site || "all", }, }; }); }
  • Tool registration in PerformanceTools.getTools(), defining name, description, input parameters schema, and binding to the exportPerformanceReport handler.
    { name: "wp_performance_export", description: "Export comprehensive performance report", parameters: [ { name: "site", type: "string", description: "Specific site ID for multi-site setups (optional for single site)", required: false, }, { name: "format", type: "string", description: "Export format (json, csv, summary)", required: false, }, { name: "includeHistorical", type: "boolean", description: "Include historical data (default: true)", required: false, }, { name: "includeAnalytics", type: "boolean", description: "Include analytics and insights (default: true)", required: false, }, { name: "timeRange", type: "string", description: "Time range for data export (1h, 6h, 24h, 7d, 30d)", required: false, }, ], handler: this.exportPerformanceReport.bind(this), },
  • Higher-level registration in ToolRegistry.registerAllTools() where PerformanceTools class is instantiated and its tools (including wp_performance_export) are registered with the MCP server.
    Object.values(Tools).forEach((ToolClass) => { let toolInstance: { getTools(): unknown[] }; // Cache and Performance tools need the clients map if (ToolClass.name === "CacheTools" || ToolClass.name === "PerformanceTools") { toolInstance = new ToolClass(this.wordpressClients); } else { toolInstance = new (ToolClass as new () => { getTools(): unknown[] })(); } const tools = toolInstance.getTools(); tools.forEach((tool: unknown) => { this.registerTool(tool as ToolDefinition); }); });
  • The MCP server.tool() registration with Zod schema built from tool parameters, including site handling for multi-site.
    this.server.tool( tool.name, tool.description || `WordPress tool: ${tool.name}`, parameterSchema,

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