Skip to main content
Glama

check

Verify new messages in the Claude IPC MCP server system by providing your instance ID, ensuring timely communication between AI assistants via inter-process channels.

Instructions

Check for new messages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idYesYour instance ID

Implementation Reference

  • MCP tool 'check' handler: sends check request to internal broker via BrokerClient, formats retrieved messages nicely for display, or reports no messages.
    elif name == "check": if not current_session_token: return [TextContent(type="text", text="Error: Not registered. Please register first.")] response = BrokerClient.send_request({ "action": "check", "instance_id": arguments["instance_id"], "session_token": current_session_token }) if response["status"] == "ok" and response.get("messages"): formatted = "New messages:\n" for msg in response["messages"]: formatted += f"\nFrom: {msg['from']}\n" formatted += f"Time: {msg['timestamp']}\n" formatted += f"Content: {msg['message']['content']}\n" if msg['message'].get('data'): formatted += f"Data: {json.dumps(msg['message']['data'], indent=2)}\n" return [TextContent(type="text", text=formatted)] else: return [TextContent(type="text", text="No new messages")]
  • Input schema for the 'check' tool: requires 'instance_id' string.
    name="check", description="Check for new messages", inputSchema={ "type": "object", "properties": { "instance_id": { "type": "string", "description": "Your instance ID" } }, "required": ["instance_id"] }
  • Backend message broker handler for 'check' action: retrieves and clears unread messages for the instance from the queue/database, marks them as read.
    elif action == "check": # instance_id already validated and set from session instance_id = request["instance_id"] # Resolve name through forwarding if needed resolved_id = self._resolve_name(instance_id) if resolved_id not in self.queues: return {"status": "ok", "messages": []} messages = self.queues[resolved_id] self.queues[resolved_id] = [] # Mark messages as read in database if self.db_path and messages: try: conn = sqlite3.connect(self.db_path) cursor = conn.cursor() # Get message IDs to mark as read for msg in messages: cursor.execute(''' UPDATE messages SET read_flag = 1 WHERE to_id = ? AND timestamp = ? AND read_flag = 0 ''', (resolved_id, msg.get("timestamp"))) conn.commit() conn.close() except Exception as e: logger.error(f"Failed to mark messages as read: {e}") return {"status": "ok", "messages": messages}
  • Tool registration via @app.list_tools(): includes the 'check' tool in the returned list of available MCP 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"] } ) ]

Other Tools

Related 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