Skip to main content
Glama

buddypress_get_xprofile_group

Retrieve a specific BuddyPress extended profile field group by its ID, with an option to include associated fields in the response.

Instructions

Get a single XProfile field group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesField group ID
fetch_fieldsNoInclude fields in response

Implementation Reference

  • Handler function for the 'buddypress_get_xprofile_group' tool. Constructs query parameters for fetch_fields if provided, then calls the BuddyPress API to retrieve the XProfile field group by ID.
    else if (name === 'buddypress_get_xprofile_group') {
      const params = new URLSearchParams();
      if (args.fetch_fields !== undefined) params.append('fetch_fields', String(args.fetch_fields));
      result = await buddypressRequest(`/xprofile/groups/${args.id}?${params}`);
  • src/index.ts:303-314 (registration)
    Registration of the 'buddypress_get_xprofile_group' tool in the tools array, including name, description, and input schema definition.
    {
      name: 'buddypress_get_xprofile_group',
      description: 'Get a single XProfile field group',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'number', description: 'Field group ID', required: true },
          fetch_fields: { type: 'boolean', description: 'Include fields in response' },
        },
        required: ['id'],
      },
    },
  • Input schema definition for the 'buddypress_get_xprofile_group' tool, specifying required 'id' parameter and optional 'fetch_fields'.
    inputSchema: {
      type: 'object',
      properties: {
        id: { type: 'number', description: 'Field group ID', required: true },
        fetch_fields: { type: 'boolean', description: 'Include fields in response' },
      },
      required: ['id'],
  • Shared helper function 'buddypressRequest' used by all BuddyPress tools, including this one, to make authenticated API calls 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