wpnav_get_page
Retrieve a WordPress page by ID to access its full content, metadata, and edit history for management purposes.
Instructions
Get a single WordPress page by ID. Returns full page content, metadata, and edit history.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | WordPress page ID |
Implementation Reference
- src/tools/content/index.ts:66-80 (handler)Handler function for wpnav_get_page tool. Validates the page ID, fetches the page data from the WordPress REST API endpoint `/wp/v2/pages/${id}`, extracts a summary of key fields using extractSummary utility, and returns a formatted JSON response clamped for length.handler: async (args, context) => { validateRequired(args, ['id']); const id = validateId(args.id, 'Page'); const page = await context.wpRequest(`/wp/v2/pages/${id}`); const summary = extractSummary(page, [ 'id', 'title.rendered', 'content.rendered', 'status', 'author', 'modified', 'link', 'template', 'parent', 'menu_order', ]); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(summary, null, 2)) }], }; },
- src/tools/content/index.ts:58-64 (schema)Input schema definition for wpnav_get_page, requiring a numeric 'id' parameter.inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'WordPress page ID' }, }, required: ['id'], },
- src/tools/content/index.ts:54-82 (registration)Full tool registration block for wpnav_get_page using toolRegistry.register, including definition (name, description, schema), handler, and category.toolRegistry.register({ definition: { name: 'wpnav_get_page', description: 'Get a single WordPress page by ID. Returns full page content, metadata, and edit history.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'WordPress page ID' }, }, required: ['id'], }, }, handler: async (args, context) => { validateRequired(args, ['id']); const id = validateId(args.id, 'Page'); const page = await context.wpRequest(`/wp/v2/pages/${id}`); const summary = extractSummary(page, [ 'id', 'title.rendered', 'content.rendered', 'status', 'author', 'modified', 'link', 'template', 'parent', 'menu_order', ]); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(summary, null, 2)) }], }; }, category: ToolCategory.CONTENT, });
- src/tools.ts:82-95 (schema)Tool schema stub in the main tools export array, used for MCP schema discovery and client-side validation.{ name: 'wpnav_get_page', description: 'Get a single WordPress page by ID. Returns full page content, metadata, and edit history.', inputSchema: { type: 'object' as const, properties: { id: { type: 'number' as const, description: 'WordPress page ID', }, }, required: ['id'], },