wpnav_list_pages
Retrieve and filter WordPress pages by status, search term, or pagination to view IDs, titles, statuses, and modification dates.
Instructions
List WordPress pages with optional filtering. Returns page ID, title, status, and last modified date.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination (default: 1) | |
| per_page | No | Number of pages to return (default: 10, max: 100) | |
| status | No | Filter by status (default: publish) | |
| search | No | Search term to filter pages by title or content |
Implementation Reference
- src/tools/content/index.ts:23-52 (registration)Full registration of wpnav_list_pages tool including name, description, inputSchema, handler function, and category. This is the primary location where the tool is defined and registered with the toolRegistry.toolRegistry.register({ definition: { name: 'wpnav_list_pages', description: 'List WordPress pages with optional filtering. Returns page ID, title, status, and last modified date.', inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number for pagination (default: 1)' }, per_page: { type: 'number', description: 'Number of pages to return (default: 10, max: 100)' }, status: { type: 'string', enum: ['publish', 'draft', 'private', 'any'], description: 'Filter by status (default: publish)' }, search: { type: 'string', description: 'Search term to filter pages by title or content' }, }, required: [], }, }, handler: async (args, context) => { const { page, per_page } = validatePagination(args); const status = args.status || 'publish'; const qs = buildQueryString({ page, per_page, status, search: args.search }); const pages = await context.wpRequest(`/wp/v2/pages?${qs}`); const summary = pages.map((p: any) => extractSummary(p, ['id', 'title.rendered', 'status', 'modified', 'link'])); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(summary, null, 2)) }], }; }, category: ToolCategory.CONTENT, });
- src/tools/content/index.ts:38-50 (handler)The handler function implements the core logic: validates pagination, builds query string with filters, fetches pages from WP REST API /wp/v2/pages, extracts summary fields, and returns formatted JSON response.handler: async (args, context) => { const { page, per_page } = validatePagination(args); const status = args.status || 'publish'; const qs = buildQueryString({ page, per_page, status, search: args.search }); const pages = await context.wpRequest(`/wp/v2/pages?${qs}`); const summary = pages.map((p: any) => extractSummary(p, ['id', 'title.rendered', 'status', 'modified', 'link'])); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(summary, null, 2)) }], }; },
- src/tools/content/index.ts:27-36 (schema)Input schema defines optional parameters: page, per_page (with validation), status enum, and search string for filtering WordPress pages.inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number for pagination (default: 1)' }, per_page: { type: 'number', description: 'Number of pages to return (default: 10, max: 100)' }, status: { type: 'string', enum: ['publish', 'draft', 'private', 'any'], description: 'Filter by status (default: publish)' }, search: { type: 'string', description: 'Search term to filter pages by title or content' }, }, required: [], },
- src/tools.ts:51-81 (schema)Static schema definition for wpnav_list_pages in the tools export array, likely used for MCP tool discovery or documentation.{ name: 'wpnav_list_pages', description: 'List WordPress pages with optional filtering. Returns page ID, title, status, and last modified date.', inputSchema: { type: 'object' as const, properties: { per_page: { type: 'number' as const, description: 'Number of pages to return (default: 10, max: 100)', default: 10, }, page: { type: 'number' as const, description: 'Page number for pagination (default: 1)', default: 1, }, status: { type: 'string' as const, description: 'Filter by status: publish, draft, private, or any', enum: ['publish', 'draft', 'private', 'any'], default: 'publish', }, search: { type: 'string' as const, description: 'Search term to filter pages by title or content', }, }, required: [], }, },