Skip to main content
Glama

buddypress_get_xprofile_field

Retrieve a specific extended profile field from a BuddyPress community site using its ID, with optional field data inclusion for comprehensive user profile management.

Instructions

Get a single XProfile field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesField ID
fetch_field_dataNoInclude field data

Implementation Reference

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

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