create_room_tab
Add a customizable tab to a Webex room by specifying the room ID, tab URL, and display name for enhanced collaboration and resource access.
Instructions
Create a tab in a specified room.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contentUrl | Yes | The URL to be displayed in the tab. | |
| displayName | Yes | The name to be displayed for the tab. | |
| roomId | Yes | The ID of the room where the tab will be added. |
Implementation Reference
- The main handler function that executes the tool logic: constructs Webex API URL, sets headers, sends POST request with roomId, contentUrl, displayName to create a room tab, handles errors.const executeFunction = async ({ roomId, contentUrl, displayName }) => { try { // Construct the URL for the request const url = getWebexUrl('/room/tabs'); // Set up headers for the request const headers = getWebexJsonHeaders(); // Prepare the body of the request const body = JSON.stringify({ roomId, contentUrl, displayName }); // Perform the fetch request const response = await fetch(url, { method: 'POST', 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 creating room tab:', error); return { error: 'An error occurred while creating the room tab.' }; } };
- Input schema definition for the create_room_tab tool, specifying parameters roomId, contentUrl, displayName as required strings.type: 'function', function: { name: 'create_room_tab', description: 'Create a tab in a specified room.', parameters: { type: 'object', properties: { roomId: { type: 'string', description: 'The ID of the room where the tab will be added.' }, contentUrl: { type: 'string', description: 'The URL to be displayed in the tab.' }, displayName: { type: 'string', description: 'The name to be displayed for the tab.' } }, required: ['roomId', 'contentUrl', 'displayName'] } } }
- The apiTool object that registers the tool by associating the executeFunction handler with the schema definition under the name 'create_room_tab' and exports it.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'create_room_tab', description: 'Create a tab in a specified room.', parameters: { type: 'object', properties: { roomId: { type: 'string', description: 'The ID of the room where the tab will be added.' }, contentUrl: { type: 'string', description: 'The URL to be displayed in the tab.' }, displayName: { type: 'string', description: 'The name to be displayed for the tab.' } }, required: ['roomId', 'contentUrl', 'displayName'] } } } }; export { apiTool };