Skip to main content
Glama

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
NameRequiredDescriptionDefault
group_idYesGroup ID
user_idYesUser ID

Implementation Reference

  • 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'],
      },
    },
  • 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();
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vapvarun/buddypress-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server