set_storage
Set cookies, localStorage, and sessionStorage to maintain login sessions in browser automation. Import authentication data from files or cookie strings.
Instructions
🔐 PREFERRED TOOL for setting login state and authentication data. Use this instead of evaluate() to set cookies, localStorage, and sessionStorage to maintain user login sessions across browser automation.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>"
},
"name": "set_storage"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | 🔗 Optional URL to navigate to in a background tab before setting storage. If provided, opens a new tab (without switching focus), navigates to this URL, and sets storage there. Useful for setting cookies/storage for a specific domain. | |
| domain | No | 🌐 Default website domain for cookies when not specified individually. Example: 'localhost:3001', 'app.example.com' | |
| cookies | No | 🍪 Array of cookie objects for authentication tokens, session IDs, etc. | |
| filePath | No | Path to JSON file containing storage data to import | |
| sessionId | Yes | Session ID to operate on | default |
| cookieString | No | 🍪 EASY WAY: Raw cookie string copied from browser (document.cookie). Example: 'session_id=abc123; user_token=xyz789; theme=dark' | |
| localStorage | No | 💾 Persistent browser storage that survives page reloads. Used for user preferences, auth tokens, app state. Example: {'auth_token': 'bearer_xyz', 'user_id': '12345'} | |
| sessionStorage | No | 🔄 Temporary storage that clears when tab closes. Used for session-specific data. Example: {'temp_data': 'value', 'session_state': 'active'} |