Skip to main content
Glama

wp_cache_warm

Pre-warm WordPress cache by loading essential site data to improve page load times and reduce server load for visitors.

Instructions

Pre-warm cache with essential WordPress data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoSite ID to warm cache for.

Implementation Reference

  • The main handler function for the 'wp_cache_warm' tool. It resolves the appropriate CachedWordPressClient instance and calls its warmCache() method to pre-populate the cache with essential data like user info, categories, tags, and site settings.
    async handleWarmCache(params: { site?: string }) {
      return toolWrapper(async () => {
        const client = this.resolveClient(params.site);
    
        if (!(client instanceof CachedWordPressClient)) {
          return {
            success: false,
            message: "Caching is not enabled for this site.",
          };
        }
    
        await client.warmCache();
    
        const stats = client.getCacheStats();
    
        return {
          success: true,
          message: "Cache warmed with essential WordPress data.",
          cache_entries_after_warming: stats.cache.totalSize,
          warmed_data: ["Current user information", "Categories", "Tags", "Site settings"],
        };
      });
    }
  • The core cache warming implementation in CachedWordPressClient. Pre-loads essential WordPress data (current user, categories, tags, site settings) into the cache in parallel, ignoring individual failures.
    async warmCache(): Promise<void> {
      try {
        // Pre-load frequently accessed data
        const warmupOperations = [
          () => this.getCurrentUser().catch(() => null),
          () => this.getCategories().catch(() => null),
          () => this.getTags().catch(() => null),
          () => this.getSiteSettings().catch(() => null),
        ];
    
        // Execute warmup operations in parallel
        await Promise.allSettled(warmupOperations.map((op) => op()));
      } catch (_error) {
        // Ignore warmup errors - they shouldn't fail the cache warming
      }
    }
  • Tool definition and registration object for 'wp_cache_warm' returned by CacheTools.getTools(), including name, description, parameters schema, and handler binding.
    {
      name: "wp_cache_warm",
      description: "Pre-warm cache with essential WordPress data.",
      parameters: [
        {
          name: "site",
          type: "string",
          description: "Site ID to warm cache for.",
        },
      ],
      handler: this.handleWarmCache.bind(this),
    },
  • Registration of CacheTools instance in ToolRegistry.registerAllTools(), which instantiates CacheTools with wordpressClients map and registers all its tools (including wp_cache_warm) with the MCP server.
    // Register all tools from the tools directory
    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);
      });
    });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'pre-warm' implies a read operation that populates cache, it doesn't specify whether this is a background process, how long it takes, what permissions are required, whether it affects site performance during execution, or what happens on failure. For a tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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

Conciseness5/5

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

The description is a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a single-parameter tool and front-loads the essential information.

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?

Given the complexity of cache operations and the complete lack of annotations and output schema, the description is insufficiently complete. It doesn't explain what 'essential WordPress data' includes, what the tool returns (success/failure indicators, metrics), performance implications, or error conditions. For a tool that likely involves system-level operations, more 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 the single 'site' parameter. The description doesn't add any parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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

Purpose4/5

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

The description clearly states the action ('pre-warm cache') and the target ('with essential WordPress data'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling cache tools like wp_cache_clear or wp_cache_info, which would be needed for a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of when pre-warming is appropriate, what 'essential WordPress data' means, or how this differs from other cache-related tools like wp_cache_clear or wp_cache_info. The agent receives no usage context.

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