Skip to main content
Glama

buddypress_list_group_members

Retrieve and filter members from a specific BuddyPress group using group ID, pagination, and role-based filtering to manage community participation.

Instructions

List members of a specific group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_idYesGroup ID
pageNoPage number (default: 1)
per_pageNoItems per page (default: 20)
rolesNoFilter by roles (admin, mod, member, banned)

Implementation Reference

  • Handler function that destructures arguments, builds query parameters for page, per_page, and roles, and calls the BuddyPress API endpoint `/groups/{group_id}/members` to retrieve the list of group members.
    else if (name === 'buddypress_list_group_members') {
      const { group_id, ...params } = args as any;
      const queryParams = new URLSearchParams();
      if (params.page) queryParams.append('page', String(params.page));
      if (params.per_page) queryParams.append('per_page', String(params.per_page));
      if (params.roles) queryParams.append('roles', String(params.roles));
      result = await buddypressRequest(`/groups/${group_id}/members?${queryParams}`);
    }
  • Tool definition including name, description, and input schema specifying required group_id and optional pagination/role parameters.
    {
      name: 'buddypress_list_group_members',
      description: 'List members of a specific group',
      inputSchema: {
        type: 'object',
        properties: {
          group_id: { type: 'number', description: 'Group ID', required: true },
          page: { type: 'number', description: 'Page number (default: 1)' },
          per_page: { type: 'number', description: 'Items per page (default: 20)' },
          roles: { type: 'string', description: 'Filter by roles (admin, mod, member, banned)' },
        },
        required: ['group_id'],
      },
    },
  • src/index.ts:528-530 (registration)
    Registers the list tools handler which returns the full tools array containing the buddypress_list_group_members tool.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • Shared helper function used by all tools, including buddypress_list_group_members, to make authenticated 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