update_team_membership
Modify team membership roles in Webex by updating the moderator status for a specific user. Enter the membership ID and set the isModerator flag to adjust permissions.
Instructions
Update a team membership in Webex.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| isModerator | Yes | Indicates if the user is a moderator. | |
| membershipId | Yes | The unique identifier for the team membership. |
Implementation Reference
- The core handler function `executeFunction` that performs the HTTP PUT request to the Webex API endpoint `/team/memberships/{membershipId}` to update the isModerator status. Includes URL construction using helpers, JSON body preparation, fetch call, response validation, JSON parsing, and comprehensive error handling with logging.const executeFunction = async ({ membershipId, isModerator }) => { try { // Construct the URL with the membership ID const url = getWebexUrl(`/team/memberships/${encodeURIComponent(membershipId)}`); // Set up headers for the request const headers = getWebexJsonHeaders(); // Prepare the request body const body = JSON.stringify({ isModerator }); // 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 team membership:', error); return { error: 'An error occurred while updating the team membership.' }; } };
- Tool schema defining the name 'update_team_membership', description, and parameters: membershipId (required string) and isModerator (required boolean). Used for input validation in MCP.name: 'update_team_membership', description: 'Update a team membership in Webex.', parameters: { type: 'object', properties: { membershipId: { type: 'string', description: 'The unique identifier for the team membership.' }, isModerator: { type: 'boolean', description: 'Indicates if the user is a moderator.' } }, required: ['membershipId', 'isModerator'] } }
- tools/paths.js:18-18 (registration)Specific registration of the tool by including its relative path in the central toolPaths array. This array is mapped in lib/tools.js#discoverTools() to dynamically import and load apiTool from each file for MCP server registration.'webex-public-workspace/webex-messaging/update-a-team-membership.js',