Skip to main content
Glama

wpnav_get_post

Retrieve a WordPress post by ID to access content, metadata, categories, and tags for management or analysis.

Instructions

Get a single WordPress post by ID. Returns full post content, metadata, categories, and tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWordPress post ID

Implementation Reference

  • The handler function for the wpnav_get_post tool. Validates the post ID, fetches the full post data from the WordPress REST API endpoint `/wp/v2/posts/${id}`, extracts a summary of key fields (id, title, content, excerpt, status, author, modified, link, categories, tags), and returns a formatted JSON response.
    handler: async (args, context) => { validateRequired(args, ['id']); const id = validateId(args.id, 'Post'); const post = await context.wpRequest(`/wp/v2/posts/${id}`); const summary = extractSummary(post, [ 'id', 'title.rendered', 'content.rendered', 'excerpt.rendered', 'status', 'author', 'modified', 'link', 'categories', 'tags', ]); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(summary, null, 2)) }], }; },
  • The input schema definition for wpnav_get_post tool, specifying a required numeric 'id' parameter for the WordPress post ID.
    definition: { name: 'wpnav_get_post', description: 'Get a single WordPress post by ID. Returns full post content, metadata, categories, and tags.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'WordPress post ID' }, }, required: ['id'], },
  • The complete registration of the wpnav_get_post tool using toolRegistry.register, including definition (name, description, schema), handler function, and category assignment within the registerContentTools function.
    toolRegistry.register({ definition: { name: 'wpnav_get_post', description: 'Get a single WordPress post by ID. Returns full post content, metadata, categories, and tags.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'WordPress post ID' }, }, required: ['id'], }, }, handler: async (args, context) => { validateRequired(args, ['id']); const id = validateId(args.id, 'Post'); const post = await context.wpRequest(`/wp/v2/posts/${id}`); const summary = extractSummary(post, [ 'id', 'title.rendered', 'content.rendered', 'excerpt.rendered', 'status', 'author', 'modified', 'link', 'categories', 'tags', ]); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(summary, null, 2)) }], }; }, category: ToolCategory.CONTENT, });
  • The tool schema for wpnav_get_post exported in the main tools list, used for MCP client discovery of available tools.
    { name: 'wpnav_get_post', description: 'Get a single WordPress post by ID. Returns full post content, metadata, categories, and tags.', inputSchema: { type: 'object' as const, properties: { id: { type: 'number' as const, description: 'WordPress post ID', }, }, required: ['id'], },

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/littlebearapps/wp-navigator-mcp'

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