Skip to main content
Glama

rename

Change your instance ID in the Claude IPC MCP server by providing your current and desired new identifiers, with a rate limit of one change per hour.

Instructions

Rename your instance ID (rate limited to once per hour)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
old_idYesYour current instance ID
new_idYesThe new instance ID you want

Implementation Reference

  • Core implementation of the rename action in the MessageBroker's _process_request method. Handles validation, queue migration, instance update, forwarding setup, rate limiting, session updates, and broadcasts a notification to other instances.
    elif action == "rename":
        # Get validated instance_id from session
        old_id = request.get("old_id")  # This will be overridden by session validation
        new_id = request["new_id"]
        
        # Validate new_id format
        if not self._validate_instance_id(new_id):
            return {"status": "error", "message": "Invalid new instance ID format"}
        
        # The old_id should match the session's instance_id (enforced by _process_request)
        # Check if old instance exists
        if old_id not in self.instances:
            return {"status": "error", "message": f"Instance {old_id} not found"}
        if new_id in self.instances:
            return {"status": "error", "message": f"Instance {new_id} already exists"}
        
        # Check rate limit (1 hour)
        now = datetime.now()
        if old_id in self.last_rename:
            time_since_last = (now - self.last_rename[old_id]).total_seconds()
            if time_since_last < 3600:  # 1 hour in seconds
                minutes_left = int((3600 - time_since_last) / 60)
                return {"status": "error", "message": f"Rate limit: can rename again in {minutes_left} minutes"}
        
        # Move the queue
        if old_id in self.queues:
            self.queues[new_id] = self.queues.pop(old_id)
        else:
            self.queues[new_id] = []
        
        # Update instance record
        self.instances[new_id] = self.instances.pop(old_id)
        
        # Set up name forwarding
        self.name_history[old_id] = (new_id, now)
        
        # Update rate limit tracking
        self.last_rename[new_id] = now
        if old_id in self.last_rename:
            del self.last_rename[old_id]
        
        # Update session mapping
        if old_id in self.instance_sessions:
            session_token = self.instance_sessions.pop(old_id)
            self.instance_sessions[new_id] = session_token
            # Update session info
            if session_token in self.sessions:
                self.sessions[session_token]["instance_id"] = new_id
        
        # Broadcast rename notification
        for instance_id in self.queues:
            if instance_id != new_id:
                notification = {
                    "from": "system",
                    "to": instance_id,
                    "timestamp": now.isoformat(),
                    "message": {"content": f"📝 {old_id} renamed to {new_id}"}
                }
                self.queues[instance_id].append(notification)
        
        return {"status": "ok", "message": f"Renamed {old_id} to {new_id}"}
  • MCP tool handler for the 'rename' tool in call_tool(). Forwards the rename request to the MessageBroker via BrokerClient and updates the local current_instance_id if successful.
    elif name == "rename":
        if not current_session_token:
            return [TextContent(type="text", text="Error: Not registered. Please register first.")]
            
        response = BrokerClient.send_request({
            "action": "rename",
            "old_id": arguments["old_id"],
            "new_id": arguments["new_id"],
            "session_token": current_session_token
        })
        
        # Update stored instance_id if rename succeeded
        if response.get("status") == "ok":
            current_instance_id = arguments["new_id"]
            
        return [TextContent(type="text", text=json.dumps(response, indent=2))]
  • Registration of the 'rename' tool in @app.list_tools(), including its name, description, and input schema.
    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"]
        }
    ),
  • Input schema definition for the 'rename' tool, specifying parameters old_id and new_id.
    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"]
    }

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