Skip to main content
Glama

buddypress_create_activity

Create new activity items in BuddyPress communities to post updates, comments, and user interactions for enhanced community engagement.

Instructions

Create a new activity item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentNoComponent (activity, groups, members, etc.)
contentYesActivity content
primary_item_idNoPrimary item ID (e.g., group ID)
secondary_item_idNoSecondary item ID
typeNoActivity type (activity_update, activity_comment, etc.)
user_idNoUser ID (default: current user)

Implementation Reference

  • Executes the buddypress_create_activity tool by sending a POST request to the BuddyPress /activity endpoint with the provided arguments using the buddypressRequest helper.
    else if (name === 'buddypress_create_activity') { result = await buddypressRequest('/activity', 'POST', args); }
  • Defines the input schema and parameters for the buddypress_create_activity tool, including required 'content' and optional fields like user_id, component, type, etc.
    inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'Activity content', required: true }, user_id: { type: 'number', description: 'User ID (default: current user)' }, component: { type: 'string', description: 'Component (activity, groups, members, etc.)' }, type: { type: 'string', description: 'Activity type (activity_update, activity_comment, etc.)' }, primary_item_id: { type: 'number', description: 'Primary item ID (e.g., group ID)' }, secondary_item_id: { type: 'number', description: 'Secondary item ID' }, }, required: ['content'], },
  • src/index.ts:78-93 (registration)
    Registers the buddypress_create_activity tool in the tools array used for listing and dispatching tools in the MCP server.
    { name: 'buddypress_create_activity', description: 'Create a new activity item', inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'Activity content', required: true }, user_id: { type: 'number', description: 'User ID (default: current user)' }, component: { type: 'string', description: 'Component (activity, groups, members, etc.)' }, type: { type: 'string', description: 'Activity type (activity_update, activity_comment, etc.)' }, primary_item_id: { type: 'number', description: 'Primary item ID (e.g., group ID)' }, secondary_item_id: { type: 'number', description: 'Secondary item ID' }, }, required: ['content'], }, },
  • Helper function that makes authenticated HTTP requests to the BuddyPress REST API, used by all BuddyPress tools including buddypress_create_activity.
    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