Skip to main content
Glama

wp_performance_optimize

Analyze WordPress sites to identify performance improvements, generate actionable recommendations for speed, reliability, and efficiency, and provide ROI estimates and predictions.

Instructions

Get optimization recommendations and insights

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoSpecific site ID for multi-site setups (optional for single site)
focusNoOptimization focus area (speed, reliability, efficiency, scaling)
priorityNoImplementation timeline (quick_wins, medium_term, long_term, all)
includeROINoInclude ROI estimates (default: true)
includePredictionsNoInclude performance predictions (default: true)

Implementation Reference

  • The handler function for wp_performance_optimize tool. Generates optimization recommendations from analytics, filters by priority and focus area, formats output, includes ROI estimates and performance predictions.
    private async getOptimizationRecommendations(
      _client: WordPressClient,
      params: Record<string, unknown>,
    ): Promise<unknown> {
      return toolWrapper(async () => {
        const {
          site,
          focus = "speed",
          priority = "all",
          includeROI = true,
          includePredictions = true,
        } = params as {
          site?: string;
          focus?: string;
          priority?: string;
          includeROI?: boolean;
          includePredictions?: boolean;
        };
    
        // Generate optimization plan
        const optimizationPlan = this.analytics.generateOptimizationPlan();
    
        // Filter by priority
        let recommendations: Array<{
          priority: string;
          impact: string;
          implementationEffort: string;
          [key: string]: unknown;
        }> = [];
        if (priority === "quick_wins" || priority === "all") {
          recommendations.push(
            ...optimizationPlan.quickWins.map((r) => ({
              ...r,
              timeline: "quick_wins",
            })),
          );
        }
        if (priority === "medium_term" || priority === "all") {
          recommendations.push(
            ...optimizationPlan.mediumTerm.map((r) => ({
              ...r,
              timeline: "medium_term",
            })),
          );
        }
        if (priority === "long_term" || priority === "all") {
          recommendations.push(
            ...optimizationPlan.longTerm.map((r) => ({
              ...r,
              timeline: "long_term",
            })),
          );
        }
    
        // Filter by focus area
        if (focus !== "speed") {
          const focusMap: Record<string, string[]> = {
            reliability: ["reliability"],
            efficiency: ["cost", "performance"],
            scaling: ["performance", "reliability"],
          };
          const targetImpacts = focusMap[focus] || [];
          recommendations = recommendations.filter((r) => targetImpacts.includes(r.impact));
        }
    
        // Get predictions if requested
        let predictions: Record<string, unknown> | null = null;
        if (includePredictions) {
          predictions = this.analytics.predictPerformance(60); // 1 hour prediction
        }
    
        return {
          success: true,
          data: {
            recommendations: recommendations.map((rec) => ({
              ...rec,
              formattedPriority: formatPriority(rec.priority),
              formattedEffort: formatEffort(rec.implementationEffort),
            })),
            roi: includeROI ? optimizationPlan.estimatedROI : null,
            predictions: predictions || null,
            summary: {
              totalRecommendations: recommendations.length,
              quickWins: optimizationPlan.quickWins.length,
              mediumTerm: optimizationPlan.mediumTerm.length,
              longTerm: optimizationPlan.longTerm.length,
              estimatedImpact: calculateEstimatedImpact(recommendations),
            },
            metadata: {
              timestamp: new Date().toISOString(),
              focus,
              priority,
              site: site || "all",
            },
          },
        };
      });
  • Tool registration definition including name, description, parameters schema, and handler reference within the getTools() method.
    {
      name: "wp_performance_optimize",
      description: "Get optimization recommendations and insights",
      parameters: [
        {
          name: "site",
          type: "string",
          description: "Specific site ID for multi-site setups (optional for single site)",
          required: false,
        },
        {
          name: "focus",
          type: "string",
          description: "Optimization focus area (speed, reliability, efficiency, scaling)",
          required: false,
        },
        {
          name: "priority",
          type: "string",
          description: "Implementation timeline (quick_wins, medium_term, long_term, all)",
          required: false,
        },
        {
          name: "includeROI",
          type: "boolean",
          description: "Include ROI estimates (default: true)",
          required: false,
        },
        {
          name: "includePredictions",
          type: "boolean",
          description: "Include performance predictions (default: true)",
          required: false,
        },
      ],
      handler: this.getOptimizationRecommendations.bind(this),
    },
  • Input schema definition for the wp_performance_optimize tool parameters.
    parameters: [
      {
        name: "site",
        type: "string",
        description: "Specific site ID for multi-site setups (optional for single site)",
        required: false,
      },
      {
        name: "focus",
        type: "string",
        description: "Optimization focus area (speed, reliability, efficiency, scaling)",
        required: false,
      },
      {
        name: "priority",
        type: "string",
        description: "Implementation timeline (quick_wins, medium_term, long_term, all)",
        required: false,
      },
      {
        name: "includeROI",
        type: "boolean",
        description: "Include ROI estimates (default: true)",
        required: false,
      },
      {
        name: "includePredictions",
        type: "boolean",
        description: "Include performance predictions (default: true)",
        required: false,
      },
    ],
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. 'Get' implies a read-only operation, but it doesn't disclose whether this requires specific permissions, has rate limits, or what the output format looks like (e.g., list of recommendations, structured data). The description lacks behavioral context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's appropriately sized for a tool with good schema coverage, though it could be more front-loaded with specific context (e.g., 'WordPress performance optimization recommendations').

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns (e.g., list of actionable items, scores, predictions) or how results are structured. Given the complexity and lack of structured data, more behavioral and output context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly. The description adds no additional meaning about parameters beyond what's in the schema (e.g., it doesn't explain how 'focus' values affect recommendations or what 'includeROI' entails). Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get optimization recommendations and insights' states the general purpose (retrieving recommendations) but is vague about scope and resource. It doesn't specify what type of optimization (WordPress performance) or distinguish from sibling tools like wp_performance_stats or wp_performance_benchmark, which could also provide performance-related data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. While the description implies it's for optimization recommendations, it doesn't specify when to choose this over wp_performance_stats (which might show metrics) or wp_performance_alerts (which might identify issues). No prerequisites or exclusions are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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