wpnav_get_user
Retrieve a WordPress user's complete profile by ID, including roles, capabilities, and metadata for user management tasks.
Instructions
Get a single WordPress user by ID. Returns full user profile including roles, capabilities, and metadata.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | WordPress user ID |
Implementation Reference
- src/tools/users/index.ts:63-72 (handler)The handler function executes the core logic of wpnav_get_user: validates the user ID input, fetches the user data via WordPress REST API `/wp/v2/users/${id}`, and returns the full user profile as clamped JSON text.handler: async (args, context) => { validateRequired(args, ['id']); const id = validateId(args.id, 'User'); const user = await context.wpRequest(`/wp/v2/users/${id}`); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(user, null, 2)) }], }; },
- src/tools/users/index.ts:52-62 (schema)Input schema defining the tool name, description, and required 'id' parameter (number) for wpnav_get_user.definition: { name: 'wpnav_get_user', description: 'Get a single WordPress user by ID. Returns full user profile including roles, capabilities, and metadata.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'WordPress user ID' }, }, required: ['id'], }, },
- src/tools/users/index.ts:51-74 (registration)Full tool registration call for wpnav_get_user using toolRegistry.register, bundling definition (schema), handler, and category.toolRegistry.register({ definition: { name: 'wpnav_get_user', description: 'Get a single WordPress user by ID. Returns full user profile including roles, capabilities, and metadata.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'WordPress user ID' }, }, required: ['id'], }, }, handler: async (args, context) => { validateRequired(args, ['id']); const id = validateId(args.id, 'User'); const user = await context.wpRequest(`/wp/v2/users/${id}`); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(user, null, 2)) }], }; }, category: ToolCategory.USERS, });
- src/tools.ts:771-784 (schema)Additional schema definition for wpnav_get_user in the tools manifest file, used likely for type generation or documentation.name: 'wpnav_get_user', description: 'Get a single WordPress user by ID. Returns full user profile including roles, capabilities, and metadata.', inputSchema: { type: 'object' as const, properties: { id: { type: 'number' as const, description: 'WordPress user ID', }, }, required: ['id'], }, },