list_memberships
Retrieve and filter memberships in a Webex room using room ID, person ID, email, or limit results by specifying a maximum number. Integrates with the Webex MCP Server for efficient access to messaging data.
Instructions
List memberships in a Webex room.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max | No | The maximum number of memberships to return. | |
| personEmail | No | The email address of the person to filter memberships by. | |
| personId | No | The ID of the person to filter memberships by. | |
| roomId | Yes | The ID of the room to list memberships for. |
Implementation Reference
- The handler function that executes the tool logic by making a GET request to the Webex memberships API endpoint with query parameters for roomId, optional personId, personEmail, and max.const executeFunction = async ({ roomId, personId, personEmail, max = 100 }) => { try { // Construct the URL with query parameters const url = new URL(getWebexUrl('/memberships')); url.searchParams.append('roomId', roomId); if (personId) url.searchParams.append('personId', personId); if (personEmail) url.searchParams.append('personEmail', personEmail); url.searchParams.append('max', max.toString()); // Set up headers for the request const headers = getWebexHeaders(); // Perform the fetch request const response = await fetch(url.toString(), { method: 'GET', headers }); // 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 listing memberships:', error); return { error: 'An error occurred while listing memberships.' }; } };
- Input schema defining the parameters for the list_memberships tool.parameters: { type: 'object', properties: { roomId: { type: 'string', description: 'The ID of the room to list memberships for.' }, personId: { type: 'string', description: 'The ID of the person to filter memberships by.' }, personEmail: { type: 'string', description: 'The email address of the person to filter memberships by.' }, max: { type: 'integer', description: 'The maximum number of memberships to return.' } }, required: [] }
- The apiTool export that registers the tool with its name, description, schema, and handler reference.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'list_memberships', description: 'List memberships in a Webex room.', parameters: { type: 'object', properties: { roomId: { type: 'string', description: 'The ID of the room to list memberships for.' }, personId: { type: 'string', description: 'The ID of the person to filter memberships by.' }, personEmail: { type: 'string', description: 'The email address of the person to filter memberships by.' }, max: { type: 'integer', description: 'The maximum number of memberships to return.' } }, required: [] } } } }; export { apiTool };