delete_room
Remove a Webex room by specifying its unique room ID. This tool is part of the Webex MCP Server, enabling AI assistants to manage Webex messaging resources.
Instructions
Delete a room in Webex by its ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roomId | Yes | The unique identifier for the room to be deleted. |
Implementation Reference
- The core handler function that executes the tool logic: constructs the Webex API URL for the room, sends a DELETE request with appropriate headers, handles the response, and returns success or error details.const executeFunction = async ({ roomId }) => { try { // Construct the URL with the room ID const url = getWebexUrl(`/rooms/${encodeURIComponent(roomId)}`); // 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 errorText = await response.text(); let errorMessage = `HTTP ${response.status}: ${response.statusText}`; try { const errorData = JSON.parse(errorText); errorMessage = errorData.message || errorData.error || JSON.stringify(errorData); } catch (e) { errorMessage = errorText || errorMessage; } throw new Error(errorMessage); } // For DELETE requests, return success message (204 No Content has no body) if (response.status === 204) { return { success: true, message: 'Room deleted successfully' }; } // Return the response data (if any) try { return await response.json(); } catch (e) { // If no JSON body, return success return { success: true, message: 'Room deleted successfully' }; } } catch (error) { console.error('Error deleting the room:', error); return { error: 'An error occurred while deleting the room.' }; } };
- Input schema definition for the 'delete_room' tool, specifying an object with a required 'roomId' string property.parameters: { type: 'object', properties: { roomId: { type: 'string', description: 'The unique identifier for the room to be deleted.' } }, required: ['roomId'] }
- The tool registration object 'apiTool' that binds the handler to the schema definition with name 'delete_room' and exports it for dynamic loading.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'delete_room', description: 'Delete a room in Webex by its ID.', parameters: { type: 'object', properties: { roomId: { type: 'string', description: 'The unique identifier for the room to be deleted.' } }, required: ['roomId'] } } } }; export { apiTool };
- lib/tools.js:7-16 (registration)Central registration mechanism that dynamically loads all tools (including delete_room) by importing their paths from toolPaths, extracting apiTool, and returning the list of registered tools.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:24-24 (registration)The specific path to the delete_room tool file is included in the toolPaths array used for dynamic tool discovery.'webex-public-workspace/webex-messaging/delete-a-room.js',