Skip to main content
Glama
gaupoit

WordPress MCP Server

by gaupoit

wp_get_post

Retrieve a WordPress post by its ID to access the full content, title, excerpt, status, date, slug, and link for content management or analysis.

Instructions

Get a single post by ID with full content.

Args:
    post_id: The ID of the post to retrieve.

Returns:
    Post with id, title, content (raw), excerpt, status, date, slug, and link.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_idYes

Implementation Reference

  • The handler function for the 'wp_get_post' tool, registered via @mcp.tool() decorator. It retrieves the WordPressClient instance and calls its get_post method to fetch the post data.
    @mcp.tool()
    def wp_get_post(post_id: int) -> dict:
        """Get a single post by ID with full content.
    
        Args:
            post_id: The ID of the post to retrieve.
    
        Returns:
            Post with id, title, content (raw), excerpt, status, date, slug, and link.
        """
        client = get_client()
        return client.get_post(post_id)
  • Supporting method in WordPressClient that performs the actual API call to retrieve a single post by ID from the WordPress REST API and formats the response.
    def get_post(self, post_id: int) -> dict:
        """Get a single post by ID with full content."""
        post = self._get(f"posts/{post_id}", params={"context": "edit"}, require_auth=True)
    
        return {
            "id": post["id"],
            "title": post["title"]["raw"] if isinstance(post["title"], dict) else post["title"],
            "content": post["content"]["raw"] if isinstance(post["content"], dict) else post["content"],
            "excerpt": post["excerpt"]["raw"] if isinstance(post["excerpt"], dict) else post["excerpt"],
            "status": post["status"],
            "date": post["date"],
            "slug": post["slug"],
            "link": post.get("link", ""),
        }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the tool retrieves data ('Get') with 'full content', which implies a read-only operation, but doesn't mention behavioral traits like error handling, authentication needs, or rate limits. The description is basic but doesn't contradict any annotations.

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 appropriately sized and front-loaded with the core purpose in the first sentence. The Args and Returns sections are structured clearly with no wasted words, making it easy to scan and understand quickly.

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

Completeness4/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 (1 parameter, no output schema, no annotations), the description is reasonably complete. It covers purpose, parameters, and return values. However, it lacks details on error cases or behavioral context, which would be beneficial for a read operation without annotations.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that 'post_id' is 'The ID of the post to retrieve', which clarifies the parameter's purpose beyond the schema's title 'Post Id'. However, it doesn't provide format details or constraints, leaving some gaps.

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 ('Get a single post by ID with full content'), identifies the resource ('post'), and distinguishes it from siblings like wp_get_posts (plural) which likely retrieves multiple posts. It explicitly mentions 'full content' which adds specificity.

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'by ID' and 'single post', suggesting it's for retrieving a specific post rather than listing multiple posts (wp_get_posts) or other resources. However, it doesn't explicitly state when not to use it or name alternatives, though the sibling list provides clear options.

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/gaupoit/wordpress-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server