buddypress_delete_member
Remove a member from the BuddyPress community by user ID, with optional content reassignment to another user.
Instructions
Delete a member
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | User ID | |
| reassign | No | User ID to reassign content to |
Implementation Reference
- src/index.ts:591-595 (handler)The core handler logic for the 'buddypress_delete_member' tool. It extracts the user ID and optional reassign ID from arguments, constructs the appropriate DELETE endpoint URL for the BuddyPress members API, and calls the shared request helper.else if (name === 'buddypress_delete_member') { const { id, reassign } = args as any; const params = reassign ? `?reassign=${reassign}` : ''; result = await buddypressRequest(`/members/${id}${params}`, 'DELETE'); }
- src/index.ts:170-181 (registration)Registration of the 'buddypress_delete_member' tool in the tools array, including its name, description, and input schema. This array is returned by the ListTools handler.{ name: 'buddypress_delete_member', description: 'Delete a member', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'User ID', required: true }, reassign: { type: 'number', description: 'User ID to reassign content to' }, }, required: ['id'], }, },
- src/index.ts:173-181 (schema)Input schema definition for the 'buddypress_delete_member' tool, specifying required 'id' parameter and optional 'reassign'.inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'User ID', required: true }, reassign: { type: 'number', description: 'User ID to reassign content to' }, }, required: ['id'], }, },
- src/index.ts:18-46 (helper)Shared utility function that performs authenticated HTTP requests to the BuddyPress REST API endpoints. Used by the handler to execute the DELETE request.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(); }