auto_process
Process IPC messages automatically to enable communication between AI assistants, using instance identification for message handling.
Instructions
Automatically check and process IPC messages (for use with auto-check feature)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance_id | Yes | Your instance ID |
Implementation Reference
- src/claude_ipc_server.py:1260-1329 (handler)Handler implementation for the 'auto_process' MCP tool. Checks for pending IPC messages, processes them by acknowledging specific senders, updates the auto-check configuration timestamp, and provides a processing summary.elif name == "auto_process": if not current_session_token: return [TextContent(type="text", text="Error: Not registered. Please register first.")] instance_id = arguments["instance_id"] # Check for messages using existing check functionality check_response = BrokerClient.send_request({ "action": "check", "instance_id": instance_id, "session_token": current_session_token }) if check_response.get("status") != "ok": return [TextContent(type="text", text=f"Error checking messages: {check_response.get('message')}")] messages = check_response.get("messages", []) if not messages: return [TextContent(type="text", text="No messages to process.")] # Process each message processed = [] for msg in messages: sender = msg.get("from", "unknown") content = msg.get("message", {}).get("content", "") timestamp = msg.get("timestamp", "") # Log what we're processing action_taken = f"From {sender}: {content[:50]}..." # Here we could add smart processing logic: # - If content contains "read", read the mentioned file # - If content contains "urgent", send acknowledgment # - etc. # For now, just acknowledge receipt if sender in ["fred", "claude", "nessa"]: # Known senders ack_response = BrokerClient.send_request({ "action": "send", "from_id": instance_id, "to_id": sender, "message": { "content": f"Auto-processed your message from {timestamp}. Content received: '{content[:30]}...'", "data": {"auto_processed": True} }, "session_token": current_session_token }) if ack_response.get("status") == "ok": action_taken += " [Acknowledged]" processed.append(action_taken) # Update last check time import time os.makedirs("/tmp/claude-ipc-mcp", exist_ok=True) config_file = "/tmp/claude-ipc-mcp/auto_check_config.json" if os.path.exists(config_file): with open(config_file, 'r') as f: config = json.load(f) config["last_check"] = time.strftime("%Y-%m-%dT%H:%M:%S") with open(config_file, 'w') as f: json.dump(config, f, indent=2) # Return summary summary = f"Auto-processed {len(messages)} message(s):\n" summary += "\n".join(f" {i+1}. {p}" for i, p in enumerate(processed)) return [TextContent(type="text", text=summary)]
- src/claude_ipc_server.py:1064-1076 (schema)Input schema definition for the 'auto_process' tool, requiring an 'instance_id' parameter.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"] } )
- src/claude_ipc_server.py:905-1077 (registration)The 'auto_process' tool is registered by being included in the return list of the list_tools() handler, making it available to MCP clients.@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"] } ) ]