Skip to main content
Glama

create_message

Send messages in Webex rooms by specifying room ID, text, or attachments. Supports replies, markdown formatting, and file attachments for effective communication.

Instructions

Create a message in a Webex room.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
attachmentsNoAn array of attachment objects.
filesNoAn array of file URLs to attach to the message.
markdownNoThe message in markdown format.
parentIdNoThe ID of the parent message (if this is a reply).
roomIdYesThe ID of the room where the message will be sent.
textYesThe plain text message to send.
toPersonEmailNoThe email of the person to whom the message is directed.
toPersonIdNoThe ID of the person to whom the message is directed.

Implementation Reference

  • The executeFunction that implements the core logic of the 'create_message' tool. It constructs a payload from input parameters and sends a POST request to the Webex /messages endpoint using fetch, handling errors and returning the API response.
    const executeFunction = async ({ roomId, parentId, toPersonId, toPersonEmail, text, markdown, files = [], attachments = [] }) => {
    
      try {
        // Debug: Log received parameters
        console.error('[DEBUG] create-a-message received parameters:', { roomId, parentId, toPersonId, toPersonEmail, text, markdown, files, attachments });
        // Construct the message payload (only include defined parameters)
        const payload = {};
    
        if (roomId) payload.roomId = roomId;
        if (parentId) payload.parentId = parentId;
        if (toPersonId) payload.toPersonId = toPersonId;
        if (toPersonEmail) payload.toPersonEmail = toPersonEmail;
        if (text) payload.text = text;
        if (markdown) payload.markdown = markdown;
        if (files && files.length > 0) payload.files = files;
        if (attachments && attachments.length > 0) payload.attachments = attachments;
    
        // Get the API URL and headers using the centralized config
        const url = getWebexUrl('/messages');
        const headers = getWebexJsonHeaders();
    
        // Perform the fetch request
        const response = await fetch(url, {
          method: 'POST',
          headers,
          body: JSON.stringify(payload)
        });
    
        // 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 creating message:', error);
        return {
          error: error.message || 'An error occurred while creating the message.',
          details: error.stack
        };
      }
    };
  • The JSON schema definition for the 'create_message' tool, including input parameters with types, descriptions, and required fields.
      type: 'function',
      function: {
        name: 'create_message',
        description: 'Create a message in a Webex room.',
        parameters: {
          type: 'object',
          properties: {
            roomId: {
              type: 'string',
              description: 'The ID of the room where the message will be sent.'
            },
            parentId: {
              type: 'string',
              description: 'The ID of the parent message (if this is a reply).'
            },
            toPersonId: {
              type: 'string',
              description: 'The ID of the person to whom the message is directed.'
            },
            toPersonEmail: {
              type: 'string',
              description: 'The email of the person to whom the message is directed.'
            },
            text: {
              type: 'string',
              description: 'The plain text message to send.'
            },
            markdown: {
              type: 'string',
              description: 'The message in markdown format.'
            },
            files: {
              type: 'array',
              items: {
                type: 'string'
              },
              description: 'An array of file URLs to attach to the message.'
            },
            attachments: {
              type: 'array',
              items: {
                type: 'object'
              },
              description: 'An array of attachment objects.'
            }
          },
          required: ['text']
        }
      }
    }
  • The apiTool constant that bundles the handler function and schema definition, exported for use in tool registration (likely loaded dynamically in the MCP server).
    const apiTool = {
      function: executeFunction,
      definition: {
        type: 'function',
        function: {
          name: 'create_message',
          description: 'Create a message in a Webex room.',
          parameters: {
            type: 'object',
            properties: {
              roomId: {
                type: 'string',
                description: 'The ID of the room where the message will be sent.'
              },
              parentId: {
                type: 'string',
                description: 'The ID of the parent message (if this is a reply).'
              },
              toPersonId: {
                type: 'string',
                description: 'The ID of the person to whom the message is directed.'
              },
              toPersonEmail: {
                type: 'string',
                description: 'The email of the person to whom the message is directed.'
              },
              text: {
                type: 'string',
                description: 'The plain text message to send.'
              },
              markdown: {
                type: 'string',
                description: 'The message in markdown format.'
              },
              files: {
                type: 'array',
                items: {
                  type: 'string'
                },
                description: 'An array of file URLs to attach to the message.'
              },
              attachments: {
                type: 'array',
                items: {
                  type: 'object'
                },
                description: 'An array of attachment objects.'
              }
            },
            required: ['text']
          }
        }
      }
    };
    
    export { apiTool };
  • Import of helper functions getWebexUrl and getWebexJsonHeaders from lib/webex-config.js, used to obtain the API endpoint and authorization headers.
    import { getWebexUrl, getWebexJsonHeaders } from '../../../lib/webex-config.js';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a creation operation but doesn't mention required permissions, rate limits, whether the message is sent immediately, if it's editable after creation, or what happens on failure. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently communicates the core functionality without unnecessary words. It's appropriately sized for a basic creation tool and gets straight to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 8 parameters, no annotations, and no output schema, the description is insufficient. It doesn't address behavioral aspects like permissions, side effects, or error handling, nor does it explain the relationship between parameters like 'roomId' and 'toPersonEmail' for direct messaging scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter information beyond what's already in the schema, which has 100% coverage with detailed descriptions for all 8 parameters. The baseline score of 3 reflects that the schema adequately documents parameters, though the description could have added context about parameter relationships (e.g., 'text' vs 'markdown' usage).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('a message in a Webex room'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'edit_message' or 'delete_message' beyond the basic verb, nor does it specify what type of message creation this involves (e.g., direct vs. room message).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'edit_message' or 'delete_message', nor does it mention any prerequisites or contextual constraints. It simply states what the tool does without indicating appropriate usage scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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