Skip to main content
Glama

buddypress_list_groups

Retrieve BuddyPress groups with filtering options by status, user membership, type, or search terms to manage community groups effectively.

Instructions

List BuddyPress groups with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_typeNoGroup type
pageNoPage number (default: 1)
per_pageNoItems per page (default: 20)
searchNoSearch term
statusNoGroup status (public, private, hidden)
user_idNoFilter groups by user membership

Implementation Reference

  • Handler function that executes the buddypress_list_groups tool by building query parameters from input arguments and calling the shared buddypressRequest helper to fetch groups from the BuddyPress API.
    else if (name === 'buddypress_list_groups') { const params = new URLSearchParams(); if (args.page) params.append('page', String(args.page)); if (args.per_page) params.append('per_page', String(args.per_page)); if (args.search) params.append('search', String(args.search)); if (args.status) params.append('status', String(args.status)); if (args.user_id) params.append('user_id', String(args.user_id)); if (args.group_type) params.append('group_type', String(args.group_type)); result = await buddypressRequest(`/groups?${params}`);
  • Tool schema definition including name, description, and inputSchema for validating parameters like page, per_page, search, status, user_id, and group_type.
    { name: 'buddypress_list_groups', description: 'List BuddyPress groups with optional filters', inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number (default: 1)' }, per_page: { type: 'number', description: 'Items per page (default: 20)' }, search: { type: 'string', description: 'Search term' }, status: { type: 'string', description: 'Group status (public, private, hidden)' }, user_id: { type: 'number', description: 'Filter groups by user membership' }, group_type: { type: 'string', description: 'Group type' }, }, }, },
  • Shared helper function used by all BuddyPress tools, including buddypress_list_groups, to make authenticated API requests to the BuddyPress REST API endpoints.
    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(); }
  • src/index.ts:528-530 (registration)
    Registration of the ListTools handler that returns the full tools array including buddypress_list_groups.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });

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