update_room_tab
Modify a room tab in Webex by updating its content URL and display name, ensuring accurate and relevant information is displayed for users.
Instructions
Update a Room Tab in Webex.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contentUrl | Yes | The new content URL for the tab. | |
| displayName | Yes | The display name for the tab. | |
| id | Yes | The unique identifier for the Room Tab. | |
| roomId | Yes | The ID of the room to which the tab belongs. |
Implementation Reference
- The main handler function that executes the tool logic. It constructs the Webex API URL, prepares the request body with roomId, contentUrl, and displayName, sends a PUT request, and handles the response or errors.const executeFunction = async ({ id, roomId, contentUrl, displayName }) => { try { // Construct the URL with the path variable const url = getWebexUrl(`/room/tabs/${encodeURIComponent(id)}`); // Prepare the request body const body = JSON.stringify({ roomId, contentUrl, displayName }); // 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 Room Tab:', error); return { error: 'An error occurred while updating the Room Tab.' }; } };
- The JSON schema definition for the tool's input parameters, including types, descriptions, and required fields.name: 'update_room_tab', description: 'Update a Room Tab in Webex.', parameters: { type: 'object', properties: { id: { type: 'string', description: 'The unique identifier for the Room Tab.' }, roomId: { type: 'string', description: 'The ID of the room to which the tab belongs.' }, contentUrl: { type: 'string', description: 'The new content URL for the tab.' }, displayName: { type: 'string', description: 'The display name for the tab.' } }, required: ['id', 'roomId', 'contentUrl', 'displayName'] } }
- The apiTool export that registers the handler function with its schema definition for the MCP tool system.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'update_room_tab', description: 'Update a Room Tab in Webex.', parameters: { type: 'object', properties: { id: { type: 'string', description: 'The unique identifier for the Room Tab.' }, roomId: { type: 'string', description: 'The ID of the room to which the tab belongs.' }, contentUrl: { type: 'string', description: 'The new content URL for the tab.' }, displayName: { type: 'string', description: 'The display name for the tab.' } }, required: ['id', 'roomId', 'contentUrl', 'displayName'] } } } }; export { apiTool };
- Imports helper functions from webex-config.js used for constructing API URLs and headers.import { getWebexUrl, getWebexHeaders, getWebexJsonHeaders } from '../../../lib/webex-config.js';