update_person
Modify user details in Webex by providing a unique person ID and updated information. Part of the Webex MCP Server for managing messaging capabilities.
Instructions
Update a person's details in Webex.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| personDetails | Yes | The details of the person to update. | |
| personId | Yes | The unique identifier for the person to update. |
Implementation Reference
- The asynchronous handler function that executes the tool logic: constructs Webex API URL, filters person details, sends PUT request to update person, handles errors, and returns response.const executeFunction = async ({ personId, personDetails }) => { try { // Construct the URL const url = getWebexUrl(`/people/${encodeURIComponent(personId)}?callingData=true&showAllTypes=true&minResponse=true`); // Set up headers for the request const headers = getWebexJsonHeaders(); // Filter out null/undefined avatar field to avoid API errors const filteredPersonDetails = { ...personDetails }; if (filteredPersonDetails.avatar === null || filteredPersonDetails.avatar === undefined) { delete filteredPersonDetails.avatar; } // Perform the fetch request const response = await fetch(url, { method: 'PUT', headers, body: JSON.stringify(filteredPersonDetails) }); // 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 person details:', error); return { error: 'An error occurred while updating person details.' }; } };
- The apiTool export that registers the 'update_person' tool, linking the handler function and providing the schema definition including parameters and requirements.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'update_person', description: 'Update a person\'s details in Webex.', parameters: { type: 'object', properties: { personId: { type: 'string', description: 'The unique identifier for the person to update.' }, personDetails: { type: 'object', description: 'The details of the person to update.' } }, required: ['personId', 'personDetails'] } } } }; export { apiTool };