buddypress_list_components
Retrieve active BuddyPress components to manage community features like groups, profiles, and activities on your WordPress site.
Instructions
List active BuddyPress components
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:504-511 (schema)Schema definition for the 'buddypress_list_components' tool in the tools array, specifying name, description, and empty input schema (no parameters required). This is used for tool listing and validation.{ name: 'buddypress_list_components', description: 'List active BuddyPress components', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:727-729 (handler)Handler implementation in the tool execution switch statement. Executes by calling the BuddyPress API endpoint '/components' via the buddypressRequest helper to list active components.else if (name === 'buddypress_list_components') { result = await buddypressRequest('/components'); }
- src/index.ts:528-530 (registration)Registration of tool list handler, which returns the tools array containing the 'buddypress_list_components' tool schema.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/index.ts:18-46 (helper)Helper function buddypressRequest used by the handler to make authenticated requests to 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(); }