buddypress_get_xprofile_group
Retrieve a specific BuddyPress extended profile field group to access user profile data structure and organization within community sites.
Instructions
Get a single XProfile field group
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fetch_fields | No | Include fields in response | |
| id | Yes | Field group ID |
Implementation Reference
- src/index.ts:646-650 (handler)Handler logic for executing the buddypress_get_xprofile_group tool. Constructs query parameters for fetch_fields if provided and calls the BuddyPress API endpoint `/xprofile/groups/${id}`.else if (name === 'buddypress_get_xprofile_group') { const params = new URLSearchParams(); if (args.fetch_fields !== undefined) params.append('fetch_fields', String(args.fetch_fields)); result = await buddypressRequest(`/xprofile/groups/${args.id}?${params}`); }
- src/index.ts:303-314 (registration)Registration of the buddypress_get_xprofile_group tool in the tools array, including name, description, and input schema definition.{ name: 'buddypress_get_xprofile_group', description: 'Get a single XProfile field group', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Field group ID', required: true }, fetch_fields: { type: 'boolean', description: 'Include fields in response' }, }, required: ['id'], }, },
- src/index.ts:306-313 (schema)Input schema definition for the buddypress_get_xprofile_group tool, specifying required 'id' parameter and optional 'fetch_fields' boolean.inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Field group ID', required: true }, fetch_fields: { type: 'boolean', description: 'Include fields in response' }, }, required: ['id'], },
- src/index.ts:18-46 (helper)Shared helper function used by all BuddyPress tools, including this one, to make authenticated API requests to the BuddyPress REST API.async function buddypressRequest( endpoint: string, method: string = 'GET', body?: any ): Promise<any> { const url = `${BUDDYPRESS_URL}/wp-json/buddypress/v2${endpoint}`; const auth = Buffer.from(`${BUDDYPRESS_USERNAME}:${BUDDYPRESS_PASSWORD}`).toString('base64'); const options: any = { method, headers: { 'Authorization': `Basic ${auth}`, 'Content-Type': 'application/json', }, }; if (body && method !== 'GET') { options.body = JSON.stringify(body); } const response = await fetch(url, options); if (!response.ok) { const errorText = await response.text(); throw new Error(`BuddyPress API Error (${response.status}): ${errorText}`); } return await response.json(); }