buddypress_remove_group_member
Remove a user from a BuddyPress group by specifying group ID and user ID for community management.
Instructions
Remove a member from a group
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | Yes | Group ID | |
| user_id | Yes | User ID |
Implementation Reference
- src/index.ts:635-638 (handler)Handler logic for the buddypress_remove_group_member tool. Destructures group_id and user_id from input arguments and performs a DELETE request to the BuddyPress API endpoint to remove the member from the group.else if (name === 'buddypress_remove_group_member') { const { group_id, user_id } = args as any; result = await buddypressRequest(`/groups/${group_id}/members/${user_id}`, 'DELETE'); }
- src/index.ts:279-290 (registration)Registration of the buddypress_remove_group_member tool in the tools array. Defines the tool name, description, and input schema requiring group_id and user_id.{ name: 'buddypress_remove_group_member', description: 'Remove a member from a group', inputSchema: { type: 'object', properties: { group_id: { type: 'number', description: 'Group ID', required: true }, user_id: { type: 'number', description: 'User ID', required: true }, }, required: ['group_id', 'user_id'], }, },
- src/index.ts:18-46 (helper)Shared helper function buddypressRequest used by the tool handler to make authenticated HTTP 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(); }