list_webhooks
Retrieve all organization-wide webhooks from the Webex MCP Server, with options to limit results by maximum count or ownership scope.
Instructions
List all webhooks for the organization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max | No | Limit the maximum number of webhooks in the response. | |
| ownedBy | No | Limit the result list to organization-wide webhooks. |
Implementation Reference
- The main handler function that performs a GET request to the Webex /webhooks endpoint with optional parameters max and ownedBy, handles errors, and returns the list of webhooks.const executeFunction = async ({ max = 100, ownedBy = 'org' }) => { try { // Construct the URL with query parameters const url = new URL(getWebexUrl('/webhooks')); url.searchParams.append('max', max.toString()); url.searchParams.append('ownedBy', ownedBy); // 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 webhooks:', error); return { error: 'An error occurred while listing webhooks.' }; } };
- The JSON schema definition for the list_webhooks tool, including name, description, parameters (max: integer, ownedBy: string enum ['org']), and no required parameters.definition: { type: 'function', function: { name: 'list_webhooks', description: 'List all webhooks for the organization.', parameters: { type: 'object', properties: { max: { type: 'integer', description: 'Limit the maximum number of webhooks in the response.' }, ownedBy: { type: 'string', enum: ['org'], description: 'Limit the result list to organization-wide webhooks.' } }, required: [] } } }
- tools/paths.js:23-23 (registration)The file path for list-webhooks.js is included in the toolPaths array, which is used to dynamically discover and load all MCP tools.'webex-public-workspace/webex-messaging/list-webhooks.js',
- lib/tools.js:7-16 (registration)The discoverTools function iterates over toolPaths, dynamically imports each tool module, extracts the apiTool object (which includes handler and schema for list_webhooks), and collects them for registration in the MCP system.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); }