buddypress_get_group
Retrieve detailed information about a specific BuddyPress community group using its unique identifier to access group data and manage community interactions.
Instructions
Get a single group by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Group ID |
Implementation Reference
- src/index.ts:199-209 (registration)Registration of the buddypress_get_group tool in the tools list, including name, description, and input schema.{ name: 'buddypress_get_group', description: 'Get a single group by ID', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Group ID', required: true }, }, required: ['id'], }, },
- src/index.ts:202-208 (schema)Input schema definition for the buddypress_get_group tool, specifying the required 'id' parameter.inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Group ID', required: true }, }, required: ['id'], },
- src/index.ts:608-610 (handler)Handler logic for executing the buddypress_get_group tool by calling the BuddyPress groups API endpoint with the provided group ID.else if (name === 'buddypress_get_group') { result = await buddypressRequest(`/groups/${args.id}`); }
- src/index.ts:18-46 (helper)Helper function that makes authenticated HTTP requests to the BuddyPress REST API, used by the buddypress_get_group handler.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(); }