Skip to main content
Glama

wp_get_page

Retrieve a WordPress page by its ID to view or edit content, with optional full HTML content inclusion for detailed management.

Instructions

Retrieves a single page by its ID, optionally including full content for editing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
idYesThe unique identifier for the page.
include_contentNoIf true, includes the full HTML content of the page. Default: false

Implementation Reference

  • The handler function that executes the wp_get_page tool: retrieves the page by ID using WordPressClient, formats details (title, status, link, date, optional content), and returns as formatted string.
    public async handleGetPage(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      const { id, include_content = false } = params as { id: number; include_content?: boolean };
      try {
        const page = await client.getPage(id);
        let content =
          `**Page Details (ID: ${page.id})**\n\n` +
          `- **Title:** ${page.title.rendered}\n` +
          `- **Status:** ${page.status}\n` +
          `- **Link:** ${page.link}\n` +
          `- **Date:** ${new Date(page.date).toLocaleString()}`;
    
        if (include_content) {
          content += `\n\n**Content:**\n\n` + `${page.content.rendered || "(empty)"}`;
        }
    
        return content;
      } catch (_error) {
        throw new Error(`Failed to get page: ${getErrorMessage(_error)}`);
      }
    }
  • Registers the 'wp_get_page' tool in the PageTools.getTools() array, defining its name, description, input parameters schema, and binding the handler function.
    {
      name: "wp_get_page",
      description: "Retrieves a single page by its ID, optionally including full content for editing.",
      parameters: [
        {
          name: "id",
          type: "number",
          required: true,
          description: "The unique identifier for the page.",
        },
        {
          name: "include_content",
          type: "boolean",
          description: "If true, includes the full HTML content of the page. Default: false",
        },
      ],
      handler: this.handleGetPage.bind(this),
    },
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. It mentions the tool retrieves data (implied read-only) and the optional content inclusion, but lacks details on permissions required, rate limits, error handling, or what the return format looks like (e.g., JSON structure). For a read tool with no annotations, this leaves significant behavioral gaps.

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 front-loads the core purpose and includes the key optional feature. There is no wasted wording, and it's appropriately sized for a simple retrieval tool.

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 low complexity (simple retrieval), 100% schema coverage, and no output schema, the description is adequate but not complete. It covers the basic purpose and optional feature, but lacks behavioral details (e.g., response format, error cases) that would be helpful for an agent, especially with no annotations. It's minimally viable but has clear gaps.

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 three parameters thoroughly. The description adds minimal value by hinting at the purpose of include_content ('for editing'), but doesn't provide additional semantics beyond what's in the schema descriptions. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('Retrieves a single page'), the resource ('by its ID'), and distinguishes it from siblings by specifying it's for a single page rather than listing pages (unlike wp_list_pages). It also mentions the optional content inclusion feature, which further differentiates it.

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

Usage Guidelines3/5

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

The description implies usage context through 'optionally including full content for editing,' suggesting when to set include_content=true. However, it doesn't explicitly state when to use this tool versus alternatives like wp_list_pages for multiple pages or wp_get_post for posts, nor does it mention prerequisites or exclusions.

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