buddypress_create_group
Create new BuddyPress groups with customizable settings including name, description, status, and forum options to build online communities.
Instructions
Create a new group
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| creator_id | No | Creator user ID (default: current user) | |
| description | No | Group description | |
| enable_forum | No | Enable group forum | |
| name | Yes | Group name | |
| status | No | Group status (public, private, hidden) |
Implementation Reference
- src/index.ts:611-613 (handler)Handler logic for the buddypress_create_group tool. It makes a POST request to the BuddyPress /groups endpoint using the shared buddypressRequest helper with the provided arguments.else if (name === 'buddypress_create_group') { result = await buddypressRequest('/groups', 'POST', args); }
- src/index.ts:213-223 (schema)Input schema definition for the buddypress_create_group tool, specifying parameters like name (required), description, status, enable_forum, and creator_id.inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Group name', required: true }, description: { type: 'string', description: 'Group description' }, status: { type: 'string', description: 'Group status (public, private, hidden)' }, enable_forum: { type: 'boolean', description: 'Enable group forum' }, creator_id: { type: 'number', description: 'Creator user ID (default: current user)' }, }, required: ['name'], },
- src/index.ts:210-224 (registration)Registration of the buddypress_create_group tool in the tools array, including name, description, and inputSchema. This array is returned by the list tools handler.{ name: 'buddypress_create_group', description: 'Create a new group', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Group name', required: true }, description: { type: 'string', description: 'Group description' }, status: { type: 'string', description: 'Group status (public, private, hidden)' }, enable_forum: { type: 'boolean', description: 'Enable group forum' }, creator_id: { type: 'number', description: 'Creator user ID (default: current user)' }, }, required: ['name'], }, },
- src/index.ts:18-46 (helper)Shared helper function used by all BuddyPress tools, including buddypress_create_group, 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(); }