update_membership
Modify Webex membership settings by updating roles and visibility. Adjust moderator status and room visibility using the membership ID for precise control.
Instructions
Update a membership in Webex.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| isModerator | Yes | Indicates if the user is a moderator. | |
| isRoomHidden | Yes | Indicates if the room is hidden. | |
| membershipId | Yes | The unique identifier for the membership. |
Implementation Reference
- The main handler function `executeFunction` that performs the Webex API PUT request to update a membership's isModerator and isRoomHidden properties.const executeFunction = async ({ membershipId, isModerator, isRoomHidden }) => { try { // Construct the URL for the membership update const url = getWebexUrl(`/memberships/${encodeURIComponent(membershipId)}`); // Prepare the request body const body = JSON.stringify({ isModerator, isRoomHidden }); // Set up headers for the request const headers = getWebexJsonHeaders(); // Perform the fetch request const response = await fetch(url, { method: 'PUT', headers, body }); // Check if the response was successful if (!response.ok) { const errorData = await response.json(); throw new Error(errorData); } // Parse and return the response data const data = await response.json(); return data; } catch (error) { console.error('Error updating membership:', error); return { error: 'An error occurred while updating the membership.' }; } };
- Input schema defining the parameters for the update_membership tool, including required membershipId and optional isRoomHidden.parameters: { type: 'object', properties: { membershipId: { type: 'string', description: 'The unique identifier for the membership.' }, isModerator: { type: 'boolean', description: 'Indicates if the user is a moderator.' }, isRoomHidden: { type: 'boolean', description: 'Indicates if the room is hidden.' } }, required: ['membershipId', 'isModerator'] } }
- tools/paths.js:39-39 (registration)The file path for the update_membership tool is listed in the toolPaths array, which is used to dynamically discover and load tools.'webex-public-workspace/webex-messaging/update-a-membership.js',
- lib/tools.js:7-16 (registration)The `discoverTools` function dynamically imports the apiTool from each path in toolPaths, effectively registering all tools including update_membership.export async function discoverTools() { const toolPromises = toolPaths.map(async (file) => { const module = await import(`../tools/${file}`); return { ...module.apiTool, path: file, }; }); return Promise.all(toolPromises); }