fc_add_space_member
Add users to community spaces by specifying their user ID and space ID, with optional role assignment to manage member permissions.
Instructions
Add a user to a space
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_id | Yes | The space ID | |
| user_id | Yes | The user ID to add | |
| role | No | Member role in the space | member |
Implementation Reference
- src/tools/fluent-community.ts:477-490 (handler)The main handler function for the fc_add_space_member tool. It constructs query parameters for user_id and role, then makes a POST request to the WordPress FluentCommunity API endpoint to add the member to the specified space.fc_add_space_member: async (args: any) => { try { // WordPress endpoint expects URL parameters for POST const queryParams = new URLSearchParams({ user_id: args.user_id.toString(), role: args.role || 'member', }); const response = await makeWordPressRequest('POST', `fc-manager/v1/spaces/${args.space_id}/members?${queryParams.toString()}`); return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } }; } catch (error: any) { return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } }; } },
- Zod schema defining the input parameters for the fc_add_space_member tool: space_id (required number), user_id (required number), role (optional string, defaults to 'member').const addSpaceMemberSchema = z.object({ space_id: z.number().describe('The space ID'), user_id: z.number().describe('The user ID to add'), role: z.string().optional().default('member').describe('Member role in the space') });
- src/tools/fluent-community.ts:243-247 (registration)Tool registration in the fluentCommunityTools array, specifying the name, description, and input schema reference.{ name: 'fc_add_space_member', description: 'Add a user to a FluentCommunity space', inputSchema: { type: 'object', properties: addSpaceMemberSchema.shape } },