delete_membership
Remove a specific membership by its unique ID from Webex using the MCP server. This tool ensures targeted deletion of memberships to manage access and participation effectively.
Instructions
Delete a membership by ID in Webex.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| membershipId | Yes | The unique identifier for the membership to be deleted. |
Implementation Reference
- The main handler function that performs the DELETE request to the Webex API to delete a membership by its ID.const executeFunction = async ({ membershipId }) => { try { // Construct the URL with the membership ID const url = getWebexUrl(`/memberships/${encodeURIComponent(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 membership:', error); return { error: 'An error occurred while deleting the membership.' }; } };
- Tool schema definition including the name, description, input parameters (membershipId as required string), used for validation.definition: { type: 'function', function: { name: 'delete_membership', description: 'Delete a membership by ID in Webex.', parameters: { type: 'object', properties: { membershipId: { type: 'string', description: 'The unique identifier for the membership to be deleted.' } }, required: ['membershipId'] } } } };
- The apiTool object that bundles the handler function and schema definition, exported for registration in the MCP tools system.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'delete_membership', description: 'Delete a membership by ID in Webex.', parameters: { type: 'object', properties: { membershipId: { type: 'string', description: 'The unique identifier for the membership to be deleted.' } }, required: ['membershipId'] } } } }; export { apiTool };