get_room_details
Retrieve detailed information about a specific room using its unique ID, enabling integration with Cisco Webex messaging capabilities for enhanced collaboration and data access.
Instructions
Get details of a room by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roomId | Yes | The unique identifier for the room. |
Implementation Reference
- The main handler function that executes the tool logic: fetches room details from Webex API endpoint `/rooms/{roomId}` using GET request with authentication headers, handles errors, and returns the data or error object.const executeFunction = async ({ roomId }) => { try { // Construct the URL with the roomId 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: 'GET', 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); } // Parse and return the response data const data = await response.json(); return data; } catch (error) { console.error('Error getting room details:', error); return { error: 'An error occurred while getting room details.' }; } };
- The apiTool object defining the tool's schema: name 'get_room_details', description, input parameters schema (roomId: string, required), and references the handler function.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'get_room_details', description: 'Get details of a room by ID.', parameters: { type: 'object', properties: { roomId: { type: 'string', description: 'The unique identifier for the room.' } }, required: ['roomId'] } } } };
- lib/tools.js:7-16 (registration)The discoverTools function that registers all tools by dynamically importing modules from toolPaths (including get-room-details.js) and collecting their apiTool definitions.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:6-6 (registration)The toolPaths array entry that includes the path to the get_room_details tool file, used by discoverTools for registration.'webex-public-workspace/webex-messaging/get-room-details.js',
- Import of helper functions getWebexUrl and getWebexHeaders from webex-config.js, used to construct API URL and authentication headers.import { getWebexUrl, getWebexHeaders } from '../../../lib/webex-config.js'; /** * Function to get room details from Webex. * * @param {Object} args - Arguments for the room details request. * @param {string} args.roomId - The unique identifier for the room. * @returns {Promise<Object>} - The details of the room. */ const executeFunction = async ({ roomId }) => { try { // Construct the URL with the roomId const url = getWebexUrl(`/rooms/${encodeURIComponent(roomId)}`); // Set up headers for the request const headers = getWebexHeaders();