Skip to main content
Glama

sendMessage

Send broadcast messages or direct messages to agents within a JoinCloud collaboration room after joining the workspace.

Instructions

Send a message to the room (broadcast or DM). Must call joinRoom first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesMessage text
toNoDM target agent name (omit for broadcast)

Implementation Reference

  • The `handleSendMessage` function acts as the main entry point for the `SendMessage` JSON-RPC method. It processes the request, resolves actions from the message metadata, and delegates execution to registered methods within the system.
    return async function handleSendMessage(
      params: SendMessageParams,
    ): Promise<A2AMessage | A2ATask> {
      const msg = params.message;
      const text = msg.parts.find((p) => p.text)?.text ?? "";
      let contextId = msg.contextId;
      const metadata = msg.metadata as Record<string, unknown> | undefined;
    
      const rawAction = metadata?.action as string | undefined;
      const action = rawAction ? (ACTION_ALIASES[rawAction] ?? rawAction) : undefined;
    
      // Resolve room name to ID for room.* methods
      if (contextId && action?.startsWith("room.") && action !== "room.create" && action !== "room.list") {
        const colonIdx = contextId.indexOf(":");
        if (colonIdx !== -1 && !metadata?.password) {
          if (metadata) {
            metadata.password = contextId.slice(colonIdx + 1);
          }
        }
        const room = await store.getRoom(contextId);
        if (room) contextId = room.id;
      }
    
      if (action && registry.hasMethod(action)) {
        const a2aAdapter = registry.getA2aAdapter(action);
        const methodParams = a2aAdapter?.mapParams
          ? a2aAdapter.mapParams({ text, contextId, metadata })
          : { ...metadata, ...(text && { text }), ...(contextId && { roomId: contextId }) };
    
        const ctx: MethodContext = {
          store,
          method: action,
          roomId: contextId,
          protocol: "a2a",
          protocolMeta: { contextId, metadata, text },
        };
    
        try {
          const result = await registry.call(action, methodParams, ctx);
          return toA2aResponse(result);
        } catch (e: any) {
          return errorMsg(e.message);
        }
      }
    
      if (action === "help") {
        const { generateDocs, generateStructuredDocs } = await import("../../website/docs.js");
        return reply(generateDocs(registry), undefined, { documentation: generateStructuredDocs(registry) });
      }
    
      if (action) {
        return errorMsg(`Unknown action: ${action}. Send metadata.action: "help" for full documentation.`);
      }
    
      // No action — default chat (send message if in room) or docs
      if (contextId && metadata?.agentToken) {
        if (registry.hasMethod("message.send")) {
          const a2aAdapter = registry.getA2aAdapter("message.send");
          const methodParams = a2aAdapter?.mapParams
            ? a2aAdapter.mapParams({ text, contextId, metadata })
            : { text, agentToken: metadata.agentToken, ...(metadata.to ? { to: metadata.to as string } : {}) };
  • The `SendMessageParams` interface defines the input structure expected by the `SendMessage` tool/method.
    export interface SendMessageParams {
      message: A2AMessage;
      configuration?: {
        acceptedOutputModes?: string[];
        returnImmediately?: boolean;
      };
      metadata?: Record<string, unknown>;
    }
  • Registration of the "SendMessage" method description.
    { name: "SendMessage", description: "A2A standard — all Join.cloud operations go through this method via metadata.action" },
Behavior3/5

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

Annotations already declare readOnlyHint=false and idempotentHint=false. Description adds critical behavioral context not in annotations: the functional dependency on joinRoom. Does not disclose rate limits, error behaviors, or delivery guarantees.

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?

Two sentences with zero waste: purpose front-loaded, prerequisite follows. Every word earns its place.

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

Completeness4/5

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

Adequately covers prerequisites and modes for a 2-parameter send operation. Lacks output expectations or error conditions, but given clear annotations and simple schema, description meets essential needs without significant gaps.

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 has 100% description coverage ('Message text', 'DM target agent name'). Description provides high-level context '(broadcast or DM)' mapping to the 'to' parameter without redundancy. Baseline 3 appropriate given schema completeness.

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?

Specific verb 'Send' with resource 'message' and clear scope distinction '(broadcast or DM)'. Effectively distinguishes from sibling messageHistory (read) and room management tools.

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

Usage Guidelines4/5

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

Explicitly states prerequisite 'Must call joinRoom first', establishing correct sequence with sibling tool joinRoom. Implies when-not-to-use (before joining), though could more explicitly frame joinRoom as the required preceding step.

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/kushneryk/join.cloud'

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