Skip to main content
Glama

wp_list_pages

Retrieve and filter WordPress pages from a configured site using parameters like search terms, status, and pagination for site management.

Instructions

Lists pages from a WordPress site, with filters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
per_pageNoNumber of items to return per page (max 100).
searchNoLimit results to those matching a search term.
statusNoFilter by page status.

Implementation Reference

  • The handler function that implements the core logic of the wp_list_pages tool. It queries the WordPress client for pages using provided parameters, formats a list of pages with IDs, titles, status, and links, or returns a no-pages message on empty results.
    public async handleListPages(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      const queryParams = params as unknown as PageQueryParams;
      try {
        const pages = await client.getPages(queryParams);
        if (pages.length === 0) {
          return "No pages found matching the criteria.";
        }
        const content =
          `Found ${pages.length} pages:\n\n` +
          pages.map((p) => `- ID ${p.id}: **${p.title.rendered}** (${p.status})\n  Link: ${p.link}`).join("\n");
        return content;
      } catch (_error) {
        throw new Error(`Failed to list pages: ${getErrorMessage(_error)}`);
      }
    }
  • The tool registration within PageTools.getTools(), defining the name, description, input parameters schema (per_page, search, status), and binding to the handleListPages handler.
    {
      name: "wp_list_pages",
      description: "Lists pages from a WordPress site, with filters.",
      parameters: [
        {
          name: "per_page",
          type: "number",
          description: "Number of items to return per page (max 100).",
        },
        {
          name: "search",
          type: "string",
          description: "Limit results to those matching a search term.",
        },
        {
          name: "status",
          type: "string",
          description: "Filter by page status.",
          enum: ["publish", "future", "draft", "pending", "private"],
        },
      ],
      handler: this.handleListPages.bind(this),
    },
  • Generic registration loop in ToolRegistry.registerAllTools() that instantiates PageTools (imported via * as Tools from '@/tools/index.js'), calls getTools() to retrieve wp_list_pages definition, and registers it with the MCP server via registerTool().
    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 the full burden of behavioral disclosure. While 'Lists' implies a read-only operation, the description doesn't mention important behavioral aspects like pagination behavior (implied by 'per_page' parameter but not explained), authentication requirements, rate limits, or what happens when filters return no results. For a tool with 4 parameters and no annotation coverage, this is insufficient.

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 communicates the core functionality without waste. It's appropriately sized for a listing tool and front-loads the essential information. Every word earns its place in this compact description.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It covers the basic purpose but lacks behavioral context and usage guidance. The 100% schema coverage helps compensate, but for a listing tool that likely returns structured data, more context about the return format would be helpful since there's no output schema.

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?

The schema description coverage is 100%, meaning all parameters are well-documented in the input schema itself. The description adds minimal value beyond the schema by mentioning 'with filters' which aligns with the search and status parameters. However, it doesn't provide additional context about parameter interactions or usage patterns that aren't already in the schema descriptions.

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 verb ('Lists') and resource ('pages from a WordPress site'), making the purpose immediately understandable. It also mentions 'with filters' which adds specificity about functionality. However, it doesn't explicitly differentiate from sibling tools like wp_list_posts or wp_list_media, which would require a 5.

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 are multiple listing tools in the sibling set (wp_list_categories, wp_list_comments, wp_list_media, wp_list_posts, wp_list_tags, wp_list_users), but the description doesn't help an agent choose between them. No context about prerequisites or exclusions is provided.

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