Skip to main content
Glama

Send Private Message

send-message

Send private one-on-one messages between agents in the MCP Agentic Framework for personal conversations, support, and coordination.

Instructions

Send a PRIVATE message to ONE specific agent (like a DM). Only they will see it. REQUIRES: "to" (their ID from discover-agents), "from" (YOUR ID), "message" (content). CRITICAL: Double-check the "to" ID - wrong ID = message lost forever! Use for: personal conversations, private support, one-on-one coordination. NOT for group announcements!

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesThe recipient agent's ID (obtain from discover-agents)
fromYesYour agent ID (obtained during registration)
messageYesThe content of your private message

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYesWhether the message was sent successfully

Implementation Reference

  • The main handler function `sendMessage` that executes the send-message tool logic. It verifies both sender and recipient agents exist, sends the message via messageStore, tracks the activity, and returns a structured response.
    export async function sendMessage(to, from, message) {
      const startTime = Date.now();
      
      try {
        // Verify both agents exist
        const fromAgent = await agentRegistry.getAgent(from);
        const toAgent = await agentRegistry.getAgent(to);
        
        if (!fromAgent) {
          throw Errors.resourceNotFound(`Sender agent not found: ${from}`);
        }
        if (!toAgent) {
          throw Errors.resourceNotFound(`Recipient agent not found: ${to}`);
        }
        
        const result = await messageStore.sendMessage(from, to, message);
        
        // Track the message activity
        await agentRegistry.trackMessageSent(from, to);
        
        const metadata = createMetadata(startTime, { 
          tool: 'send-message',
          messageId: result.messageId 
        });
        
        const statusMessage = `Message sent successfully from ${fromAgent.name} to ${toAgent.name}`;
        
        return structuredResponse(
          { success: result.success },
          statusMessage,
          metadata
        );
      } catch (error) {
        if (error instanceof MCPError) {
          throw error;
        }
        throw Errors.internalError(error.message);
      }
    }
  • The tool definition for 'send-message' including JSON Schema for input (to, from, message) and output (success boolean). Defines validation rules like max message length of 10000 characters.
    {
      name: 'send-message',
      title: 'Send Private Message',
      description: 'Send a PRIVATE message to ONE specific agent (like a DM). Only they will see it. REQUIRES: "to" (their ID from discover-agents), "from" (YOUR ID), "message" (content). CRITICAL: Double-check the "to" ID - wrong ID = message lost forever! Use for: personal conversations, private support, one-on-one coordination. NOT for group announcements!',
      inputSchema: {
        $schema: 'http://json-schema.org/draft-07/schema#',
        type: 'object',
        properties: {
          to: {
            type: 'string',
            description: 'The recipient agent\'s ID (obtain from discover-agents)',
            minLength: 1
          },
          from: {
            type: 'string',
            description: 'Your agent ID (obtained during registration)',
            minLength: 1
          },
          message: {
            type: 'string',
            description: 'The content of your private message',
            minLength: 1,
            maxLength: 10000
          }
        },
        required: ['to', 'from', 'message'],
        additionalProperties: false
      },
      outputSchema: {
        $schema: 'http://json-schema.org/draft-07/schema#',
        type: 'object',
        properties: {
          success: {
            type: 'boolean',
            description: 'Whether the message was sent successfully'
          }
        },
        required: ['success'],
        additionalProperties: false
      }
    },
  • src/server.js:164-167 (registration)
    Registration of the send-message tool in the MCP server's CallToolRequestSchema handler. Routes incoming tool calls to the sendMessage function with extracted arguments.
    case 'send-message': {
      const { to, from, message } = args;
      return await sendMessage(to, from, message);
    }
  • The sendMessage helper function in messageStore that handles the actual message storage. Validates inputs, generates a unique message ID, saves the message to disk, and emits notifications.
    const sendMessage = async (from, to, message) => {
      validateAgentId(from, 'From');
      validateAgentId(to, 'To');
      validateMessageContent(message);
    
      const id = generateMessageId();
      const messageObj = createMessage(id, from.trim(), to.trim(), message.trim());
      
      await saveMessage(storageDir, messageObj);
      
      // Emit notification if manager is available
      if (notificationManager) {
        await notificationManager.notifyMessageDelivered(id, to.trim(), from.trim());
      }
      
      return { success: true, messageId: id };
    };
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing critical behavioral traits: the irreversible consequence of wrong IDs ('message lost forever'), the private nature of communication ('Only they will see it'), and the one-to-one scope. It doesn't cover rate limits or auth details, but provides substantial operational context.

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 efficiently structured with zero waste: it front-loads the core purpose, lists requirements, highlights critical warnings, and provides clear usage guidelines—all in four concise sentences where each earns its place by adding distinct value.

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

Completeness5/5

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

Given the tool's complexity (mutation with irreversible consequences), no annotations, and an output schema present, the description is complete enough. It covers purpose, guidelines, critical behaviors, and parameter context, while the output schema handles return values. No significant gaps remain for agent understanding.

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?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds minimal value beyond the schema by emphasizing the criticality of the 'to' parameter and mentioning where to obtain IDs, but doesn't provide additional syntax or format details. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('Send a PRIVATE message'), the resource ('ONE specific agent'), and distinguishes it from siblings like 'send-broadcast' by emphasizing private vs. group communication. It explicitly mentions the tool's scope and differentiates from alternatives.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use ('personal conversations, private support, one-on-one coordination') and when not to use ('NOT for group announcements'), directly contrasting with the 'send-broadcast' sibling tool. It also mentions prerequisites like obtaining IDs from 'discover-agents'.

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

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/Piotr1215/mcp-agentic-framework'

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