wp_get_pages
Retrieve pages from WordPress sites with options to filter by search terms and control result quantity for content management and navigation.
Instructions
Get pages from WordPress.
Args:
per_page: Number of pages to return (1-100). Default is 10.
search: Search term to filter pages by title/content.
Returns:
List of pages with id, title, status, slug, and link.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| per_page | No | ||
| search | No |
Implementation Reference
- src/wordpress_mcp/server.py:44-59 (handler)The MCP tool handler and registration for 'wp_get_pages'. This function defines the tool schema via type hints and docstring, and executes by delegating to WordPressClient.get_pages().@mcp.tool() def wp_get_pages( per_page: int = 10, search: str | None = None, ) -> list[dict]: """Get pages from WordPress. Args: per_page: Number of pages to return (1-100). Default is 10. search: Search term to filter pages by title/content. Returns: List of pages with id, title, status, slug, and link. """ client = get_client() return client.get_pages(per_page=per_page, search=search)
- src/wordpress_mcp/client.py:98-121 (helper)Supporting method in WordPressClient that performs the actual API call to /wp/v2/pages, handles parameters, and formats the response data.def get_pages( self, per_page: int = 10, search: str | None = None, ) -> list[dict]: """Get pages from WordPress.""" params = {"per_page": per_page} if search: params["search"] = search pages = self._get("pages", params) return [ { "id": p["id"], "title": p["title"]["rendered"], "status": p["status"], "slug": p["slug"], "link": p["link"], } for p in pages ]