Skip to main content
Glama

Send Broadcast

send-broadcast

Send messages to all agents simultaneously for announcements, group questions, updates, or seeking assistance. Use priority levels to filter important communications across the distributed agent system.

Instructions

SHOUT TO EVERYONE AT ONCE! Sends your message to ALL agents in the system. Use for: announcements, questions to the group, general updates, seeking help from anyone. More efficient than multiple private messages. REMEMBER: Everyone sees broadcasts - both active agents and those who check messages later. Priority levels (low/normal/high) help agents filter important messages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesThe sender agent's ID
messageYesThe broadcast message content
priorityNoThe priority level of the broadcastnormal

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYesWhether the broadcast was sent successfully

Implementation Reference

  • Main handler function for send-broadcast tool. Verifies sender exists, calls messageStore.sendBroadcast to deliver messages to all agents, tracks broadcast activity, and returns a structured response with recipient count.
    export async function sendBroadcast(from, message, priority = 'normal') {
      const startTime = Date.now();
      
      try {
        // Verify sender exists
        const fromAgent = await agentRegistry.getAgent(from);
        if (!fromAgent) {
          throw Errors.resourceNotFound(`Sender agent not found: ${from}`);
        }
        
        // Pass agentRegistry to enable actual message delivery
        const result = await messageStore.sendBroadcast(from, message, priority, agentRegistry);
        
        // Track the broadcast activity
        if (result.success) {
          await agentRegistry.trackBroadcastSent(from, result.recipientCount);
        }
        
        const metadata = createMetadata(startTime, { 
          tool: 'send-broadcast',
          priority,
          recipientCount: result.recipientCount
        });
        
        // Check if broadcast was blocked
        if (!result.success && result.error) {
          // Return error response with all violation details
          return structuredResponse(
            result,
            result.error,
            metadata
          );
        }
        
        const statusMessage = result.recipientCount > 0
          ? `Broadcast sent from ${fromAgent.name} to ${result.recipientCount} agent${result.recipientCount === 1 ? '' : 's'} with ${priority} priority`
          : `Broadcast sent from ${fromAgent.name} with ${priority} priority (no recipients)`;
        
        return structuredResponse(
          result,
          statusMessage,
          metadata
        );
      } catch (error) {
        if (error instanceof MCPError) {
          throw error;
        }
        throw Errors.internalError(error.message);
      }
    }
  • Tool registration with name 'send-broadcast', description, inputSchema (from, message, priority properties) and outputSchema (success property). Defines the tool's interface for MCP.
    {
      name: 'send-broadcast',
      title: 'Send Broadcast',
      description: 'SHOUT TO EVERYONE AT ONCE! Sends your message to ALL agents in the system. Use for: announcements, questions to the group, general updates, seeking help from anyone. More efficient than multiple private messages. REMEMBER: Everyone sees broadcasts - both active agents and those who check messages later. Priority levels (low/normal/high) help agents filter important messages.',
      inputSchema: {
        $schema: 'http://json-schema.org/draft-07/schema#',
        type: 'object',
        properties: {
          from: {
            type: 'string',
            description: 'The sender agent\'s ID',
            minLength: 1
          },
          message: {
            type: 'string',
            description: 'The broadcast message content',
            minLength: 1,
            maxLength: 10000
          },
          priority: {
            type: 'string',
            enum: ['low', 'normal', 'high'],
            description: 'The priority level of the broadcast',
            default: 'normal'
          }
        },
        required: ['from', 'message'],
        additionalProperties: false
      },
      outputSchema: {
        $schema: 'http://json-schema.org/draft-07/schema#',
        type: 'object',
        properties: {
          success: {
            type: 'boolean',
            description: 'Whether the broadcast was sent successfully'
          }
        },
        required: ['success'],
        additionalProperties: false
      }
    },
  • src/server.js:179-182 (registration)
    Server case statement that routes 'send-broadcast' tool calls to the sendBroadcast function, extracting from, message, and priority from args.
    case 'send-broadcast': {
      const { from, message, priority } = args;
      return await sendBroadcast(from, message, priority);
    }
  • Core broadcast implementation in messageStore. Gets all registered agents, filters out sender, creates broadcast messages with priority prefix, and sends to each recipient asynchronously.
    const sendBroadcast = async (from, message, priority = 'normal', agentRegistry = null) => {
      validateAgentId(from, 'From');
      validateMessageContent(message);
    
      let recipientCount = 0;
      const errors = [];
      let warning = null;
    
      // If agentRegistry is provided, send actual messages to all agents
      if (agentRegistry) {
        try {
          // Get all registered agents
          const allAgents = await agentRegistry.getAllAgents();
          
          // Filter out the sender using functional approach
          const recipients = allAgents.filter(agent => agent.id !== from.trim());
          
          // Send message to each recipient using functional map
          const sendPromises = recipients.map(async (agent) => {
            try {
              // Create broadcast message with metadata
              const broadcastMessage = `[BROADCAST ${priority.toUpperCase()}] ${message}`;
              await sendMessage(from, agent.id, broadcastMessage);
              return { success: true, agentId: agent.id };
            } catch (error) {
              return { success: false, agentId: agent.id, error: error.message };
            }
          });
          
          // Wait for all messages to be sent
          const results = await Promise.all(sendPromises);
          
          // Count successes and collect errors functionally
          const { successes, failures } = results.reduce(
            (acc, result) => {
              if (result.success) {
                acc.successes++;
              } else {
                acc.failures.push(result);
              }
              return acc;
            },
            { successes: 0, failures: [] }
          );
          
          recipientCount = successes;
          if (failures.length > 0) {
            failures.forEach(f => errors.push(`Failed to send to ${f.agentId}: ${f.error}`));
          }
        } catch (error) {
          errors.push(`Failed to get agent list: ${error.message}`);
        }
      }
    
      // Still emit notification for any listeners
      if (notificationManager) {
        await notificationManager.notifyBroadcast(from.trim(), message.trim(), priority);
      }
      
      return { 
        success: errors.length === 0,
        recipientCount,
        errors: errors.length > 0 ? errors : undefined,
        warning: warning || undefined
      };
    };
Behavior4/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 effectively describes key behavioral traits: the broadcast reaches 'ALL agents in the system', includes both 'active agents and those who check messages later', mentions priority filtering, and implies persistence. However, it doesn't cover potential rate limits, error conditions, or specific response formats, leaving some gaps.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose in the first sentence. Each subsequent sentence adds valuable context (usage examples, efficiency comparison, audience scope, priority system). While slightly verbose with the capitalization and exclamation, every sentence earns its place by providing useful information.

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?

Given that there's an output schema (though not shown), the description doesn't need to explain return values. For a broadcast tool with 3 parameters and no annotations, the description provides good context about audience, persistence, and priority system. However, it could be more complete by mentioning authentication requirements or potential limitations of the broadcast mechanism.

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 parameters thoroughly. The description adds minimal parameter semantics beyond the schema, mentioning 'priority levels (low/normal/high)' which is already in the enum. It doesn't provide additional context about parameter interactions or usage nuances, so it meets the baseline but doesn't add significant value.

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 explicitly states the tool 'Sends your message to ALL agents in the system' with the verb 'sends' and resource 'message to ALL agents', clearly distinguishing it from sibling tools like 'send-message' (likely private) and 'check-for-messages'. The capitalization and exclamation point emphasize the broadcast nature, making the purpose unmistakable.

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 usage scenarios ('announcements, questions to the group, general updates, seeking help from anyone'), contrasts with alternatives ('More efficient than multiple private messages'), and includes a caution ('REMEMBER: Everyone sees broadcasts'). This gives clear guidance on when to use this tool versus other messaging options.

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