delete_team_membership
Remove a team membership by ID in Webex using this tool. Ideal for managing team access and roles effectively within the Webex MCP Server.
Instructions
Delete a team membership by ID in Webex.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| membershipId | Yes | The unique identifier for the team membership to be deleted. |
Implementation Reference
- The main handler function `executeFunction` that performs the Webex API DELETE request to remove a team membership by ID, handles errors, and returns success or error status.const executeFunction = async ({ membershipId }) => { try { // Construct the URL for the request const url = getWebexUrl('/team/memberships/${membershipId}'); // Set up headers for the request const headers = getWebexHeaders(); // Perform the fetch request const response = await fetch(url, { method: 'DELETE', headers }); // Check if the response was successful if (!response.ok) { const errorData = await response.json(); throw new Error(errorData); } // Return the response status return { status: response.status, message: 'Membership deleted successfully.' }; } catch (error) { console.error('Error deleting team membership:', error); return { error: 'An error occurred while deleting the team membership.' }; } };
- The tool definition including the schema for input parameters (membershipId), description, and name 'delete_team_membership'.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'delete_team_membership', description: 'Delete a team membership by ID in Webex.', parameters: { type: 'object', properties: { membershipId: { type: 'string', description: 'The unique identifier for the team membership to be deleted.' } }, required: ['membershipId'] } } } };
- lib/tools.js:7-16 (registration)Generic tool registration/discovery function that dynamically imports all tool modules from paths listed in tools/paths.js and extracts their `apiTool` objects, including delete_team_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); }
- tools/paths.js:10-10 (registration)The specific path entry for the delete_team_membership tool file, which enables its inclusion in the discoverTools() registration.'webex-public-workspace/webex-messaging/delete-a-team-membership.js',