buddypress_list_xprofile_groups
Retrieve BuddyPress extended profile field groups to organize and manage user profile data. Optionally include individual fields for comprehensive profile structure access.
Instructions
List XProfile field groups
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fetch_fields | No | Include fields in response |
Implementation Reference
- src/index.ts:641-645 (handler)Handler that checks the tool name and makes an authenticated GET request to the BuddyPress XProfile groups endpoint with optional fetch_fields parameter.else if (name === 'buddypress_list_xprofile_groups') { const params = new URLSearchParams(); if (args.fetch_fields !== undefined) params.append('fetch_fields', String(args.fetch_fields)); result = await buddypressRequest(`/xprofile/groups?${params}`); }
- src/index.ts:293-302 (registration)Registration of the tool in the tools array, including name, description, and input schema definition.{ name: 'buddypress_list_xprofile_groups', description: 'List XProfile field groups', inputSchema: { type: 'object', properties: { fetch_fields: { type: 'boolean', description: 'Include fields in response' }, }, }, },
- src/index.ts:296-301 (schema)Input schema defining the optional fetch_fields boolean parameter.inputSchema: { type: 'object', properties: { fetch_fields: { type: 'boolean', description: 'Include fields in response' }, }, },
- src/index.ts:18-46 (helper)Shared helper function used by all BuddyPress tools 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(); }