Skip to main content
Glama

send

Send messages between Claude AI instances using Inter-Process Communication for coordinated workflows and data exchange.

Instructions

Send a message to another Claude instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_idYesYour instance ID
to_idYesTarget instance ID
contentYesMessage content
dataNoOptional structured data to send

Implementation Reference

  • Input schema for the 'send' MCP tool defining parameters from_id, to_id, content (required) and optional data.
    Tool(
        name="send",
        description="Send a message to another Claude instance",
        inputSchema={
            "type": "object",
            "properties": {
                "from_id": {
                    "type": "string",
                    "description": "Your instance ID"
                },
                "to_id": {
                    "type": "string",
                    "description": "Target instance ID"
                },
                "content": {
                    "type": "string",
                    "description": "Message content"
                },
                "data": {
                    "type": "object",
                    "description": "Optional structured data to send"
                }
            },
            "required": ["from_id", "to_id", "content"]
        }
    ),
  • MCP tool handler for 'send': checks registration, builds message, sends to internal broker via BrokerClient, returns broker response.
    elif name == "send":
        if not current_session_token:
            return [TextContent(type="text", text="Error: Not registered. Please register first.")]
            
        message = {
            "content": arguments["content"],
            "data": arguments.get("data", {})
        }
        response = BrokerClient.send_request({
            "action": "send",
            "from_id": arguments["from_id"],
            "to_id": arguments["to_id"],
            "message": message,
            "session_token": current_session_token
        })
        return [TextContent(type="text", text=json.dumps(response, indent=2))]
  • Registration of 'send' tool via list_tools() returning Tool definitions including 'send'.
    @app.list_tools()
    async def list_tools() -> List[Tool]:
        """List available tools"""
        return [
            Tool(
                name="register",
                description="Register this Claude instance with the IPC system",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "instance_id": {
                            "type": "string",
                            "description": "Unique identifier for this instance (e.g., 'wsl1', 'wsl2')"
                        }
                    },
                    "required": ["instance_id"]
                }
            ),
            Tool(
                name="send",
                description="Send a message to another Claude instance",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "from_id": {
                            "type": "string",
                            "description": "Your instance ID"
                        },
                        "to_id": {
                            "type": "string",
                            "description": "Target instance ID"
                        },
                        "content": {
                            "type": "string",
                            "description": "Message content"
                        },
                        "data": {
                            "type": "object",
                            "description": "Optional structured data to send"
                        }
                    },
                    "required": ["from_id", "to_id", "content"]
                }
            ),
            Tool(
                name="broadcast",
                description="Broadcast a message to all other Claude instances",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "from_id": {
                            "type": "string",
                            "description": "Your instance ID"
                        },
                        "content": {
                            "type": "string",
                            "description": "Message content"
                        },
                        "data": {
                            "type": "object",
                            "description": "Optional structured data"
                        }
                    },
                    "required": ["from_id", "content"]
                }
            ),
            Tool(
                name="check",
                description="Check for new messages",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "instance_id": {
                            "type": "string",
                            "description": "Your instance ID"
                        }
                    },
                    "required": ["instance_id"]
                }
            ),
            Tool(
                name="list_instances",
                description="List all active Claude instances",
                inputSchema={
                    "type": "object",
                    "properties": {}
                }
            ),
            Tool(
                name="share_file",
                description="Share file content with another instance",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "from_id": {
                            "type": "string",
                            "description": "Your instance ID"
                        },
                        "to_id": {
                            "type": "string",
                            "description": "Target instance ID"
                        },
                        "filepath": {
                            "type": "string",
                            "description": "Path to file to share"
                        },
                        "description": {
                            "type": "string",
                            "description": "Description of the file"
                        }
                    },
                    "required": ["from_id", "to_id", "filepath"]
                }
            ),
            Tool(
                name="share_command",
                description="Execute a command and share output with another instance",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "from_id": {
                            "type": "string",
                            "description": "Your instance ID"
                        },
                        "to_id": {
                            "type": "string",
                            "description": "Target instance ID"
                        },
                        "command": {
                            "type": "string",
                            "description": "Command to execute"
                        },
                        "description": {
                            "type": "string",
                            "description": "Description of what this command does"
                        }
                    },
                    "required": ["from_id", "to_id", "command"]
                }
            ),
            Tool(
                name="rename",
                description="Rename your instance ID (rate limited to once per hour)",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "old_id": {
                            "type": "string",
                            "description": "Your current instance ID"
                        },
                        "new_id": {
                            "type": "string",
                            "description": "The new instance ID you want"
                        }
                    },
                    "required": ["old_id", "new_id"]
                }
            ),
            Tool(
                name="auto_process",
                description="Automatically check and process IPC messages (for use with auto-check feature)",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "instance_id": {
                            "type": "string",
                            "description": "Your instance ID"
                        }
                    },
                    "required": ["instance_id"]
                }
            )
        ]
  • Core implementation of 'send' action in MessageBroker._process_request: handles validation, large message storage, name resolution/forwarding, queuing, persistence to SQLite, and response.
    elif action == "send":
        from_id = request["from_id"]
        to_id = request["to_id"]
        message = request["message"]
        
        # Validate to_id format
        if not self._validate_instance_id(to_id):
            return {"status": "error", "message": "Invalid recipient ID format"}
        
        # Check message size (10KB threshold)
        content = message.get("content", "")
        content_size = len(content.encode('utf-8'))
        size_threshold = 10 * 1024  # 10KB
        
        if content_size > size_threshold:
            # Save large message to file
            filepath = self._save_large_message(from_id, to_id, content)
            if filepath:
                # Create summary and update message
                summary = self._create_summary(content)
                message = {
                    "content": f"{summary} Full content saved to: {filepath}",
                    "data": message.get("data", {})
                }
                message["data"]["large_message_file"] = filepath
                message["data"]["original_size_kb"] = round(content_size / 1024, 1)
        
        # Resolve name through forwarding if needed
        resolved_to = self._resolve_name(to_id)
        forwarded = resolved_to != to_id
        
        # Create queue for future instances if it doesn't exist
        if resolved_to not in self.queues:
            self.queues[resolved_to] = []
            future_delivery = True
        else:
            future_delivery = not (resolved_to in self.instances)
            
        # Check queue limit (100 messages per instance)
        if len(self.queues[resolved_to]) >= 100:
            return {"status": "error", "message": f"Message queue full for {resolved_to} (100 message limit)"}
            
        msg_data = {
            "from": from_id,
            "to": resolved_to,
            "timestamp": datetime.now().isoformat(),
            "message": message
        }
        self.queues[resolved_to].append(msg_data)
        
        # Save to SQLite
        self._save_message_to_db(from_id, resolved_to, msg_data)
        
        if forwarded:
            return {"status": "ok", "message": f"Message forwarded from {to_id} to {resolved_to}"}
        elif future_delivery:
            return {"status": "ok", "message": f"Message queued for {resolved_to} (not yet registered)"}
        else:
            return {"status": "ok", "message": "Message sent"}
  • BrokerClient.send_request: utility to send JSON requests to the TCP message broker socket and return response.
    @staticmethod
    def send_request(request: Dict[str, Any]) -> Dict[str, Any]:
        """Send a request to the broker"""
        try:
            client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            client_socket.settimeout(5.0)
            client_socket.connect((IPC_HOST, IPC_PORT))
            
            client_socket.send(json.dumps(request).encode('utf-8'))
            response_data = client_socket.recv(65536).decode('utf-8')
            response = json.loads(response_data)
            
            client_socket.close()
            return response
            
        except Exception as e:
            return {"status": "error", "message": f"Broker connection failed: {e}"}
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 the action but doesn't cover critical aspects like whether this is a synchronous or asynchronous operation, error conditions (e.g., if the target instance is unavailable), rate limits, or authentication requirements. This leaves significant gaps for an agent to understand how to use it effectively.

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, efficient sentence that front-loads the core purpose without any wasted words. It's appropriately sized for a tool with a straightforward action, making it easy for an agent to parse quickly.

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?

Given the complexity of inter-instance communication and the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral traits, error handling, or return values, which are crucial for an agent to use this tool correctly in a real-world scenario.

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 no additional meaning beyond what the schema provides, such as clarifying the format of 'instance ID' or the nature of 'structured data'. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('send') and resource ('a message to another Claude instance'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'broadcast' or 'share_command', which would require explicit comparison, but it's not vague or tautological.

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 'broadcast' or 'share_command'. It lacks context about prerequisites, such as whether instances need to be registered or online, and offers no explicit when-not-to-use or alternative recommendations.

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/jdez427/claude-ipc-mcp'

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