Skip to main content
Glama

edit_message

Update text or markdown in a Webex message by specifying the message ID, room ID, and new content. Enables quick edits to enhance clarity or correct errors.

Instructions

Edit a message in Webex.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
markdownNoThe new markdown for the message (optional).
messageIdYesThe unique identifier for the message to edit.
roomIdYesThe ID of the room where the message is located.
textYesThe new text for the message.

Implementation Reference

  • The main handler function that executes the edit_message tool logic. It sends a PUT request to the Webex API to update the message with new text and optional markdown.
    const executeFunction = async ({ messageId, roomId, text, markdown }) => { try { // Construct the URL for the PUT request const url = getWebexUrl(`/messages/${encodeURIComponent(messageId)}`); // Prepare the request body const body = JSON.stringify({ roomId, text, ...(markdown && { markdown }) // Include markdown only if provided }); // Set up headers for the request const headers = getWebexJsonHeaders(); // Perform the fetch request const response = await fetch(url, { method: 'PUT', headers, body }); // Check if the response was successful if (!response.ok) { const errorData = await response.json(); throw new Error(JSON.stringify(errorData)); } // Parse and return the response data const data = await response.json(); return data; } catch (error) { console.error('Error editing the message:', error); return { error: error.message || 'An error occurred while editing the message.', details: error.stack }; } };
  • The input schema and tool name definition for the edit_message tool, including parameters and required fields.
    function: { name: 'edit_message', description: 'Edit a message in Webex.', parameters: { type: 'object', properties: { messageId: { type: 'string', description: 'The unique identifier for the message to edit.' }, roomId: { type: 'string', description: 'The ID of the room where the message is located.' }, text: { type: 'string', description: 'The new text for the message.' }, markdown: { type: 'string', description: 'The new markdown for the message (optional).' } }, required: ['messageId', 'text'] } }
  • The apiTool object that encapsulates the handler and schema, exported from the tool file for registration.
    const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'edit_message', description: 'Edit a message in Webex.', parameters: { type: 'object', properties: { messageId: { type: 'string', description: 'The unique identifier for the message to edit.' }, roomId: { type: 'string', description: 'The ID of the room where the message is located.' }, text: { type: 'string', description: 'The new text for the message.' }, markdown: { type: 'string', description: 'The new markdown for the message (optional).' } }, required: ['messageId', 'text'] } } } };
  • tools/paths.js:33-33 (registration)
    The edit_message tool file is registered by being listed in the toolPaths array used for dynamic discovery.
    'webex-public-workspace/webex-messaging/edit-a-message.js',
  • lib/tools.js:7-16 (registration)
    The discoverTools function that dynamically loads and registers all tools, including edit_message, by importing their apiTool objects.
    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); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kashyap-AI-ML-Solutions/webex-messaging-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server