buddypress_get_xprofile_group
Retrieve a specific BuddyPress extended profile field group by its ID, with an option to include associated fields in the response.
Instructions
Get a single XProfile field group
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Field group ID | |
| fetch_fields | No | Include fields in response |
Implementation Reference
- src/index.ts:646-649 (handler)Handler function for the 'buddypress_get_xprofile_group' tool. Constructs query parameters for fetch_fields if provided, then calls the BuddyPress API to retrieve the XProfile field group by 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-312 (schema)Input schema definition for the 'buddypress_get_xprofile_group' tool, specifying required 'id' parameter and optional 'fetch_fields'.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 'buddypressRequest' used by all BuddyPress tools, including this one, to make authenticated API calls 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(); }