Skip to main content

app_storage

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Save, restore or clear the current WebView's storage state: its cookies and its origin's localStorage and sessionStorage, in the shape Vibium saves — {cookies, origins: [{origin, localStorage, sessionStorage}]} — so a state saved by one restores in the other. Vibium's storage command, on a WebView: switch with app_context first. "get" (the default) answers the state; "restore" sets its cookies and writes each origin's storage only into a page on that origin, saying which it skipped; "clear" empties all three. Every write is read back. A page with no origin of its own — an app's inline HTML, about:blank — cannot hold storage, and is refused as that.

Changes the device, the app or the session: readOnlyHint is false.

Arguments​

NameTypeRequiredWhat it is
actionstring: get, restore, clearget (default), restore or clear.
devicestringDevice serial to target, e.g. "emulator-5554". Omit when only one device is running.
driverstring: uiautomator2, uiautomator, wdaDriver to use: "uiautomator2" (default for Android; fast, installs a server APK on first use), "uiautomator" (Android, installs nothing, slower, cannot type), or "wda" (WebDriverAgent: iOS simulators and iPhones).
stateobjectWith restore: a storage state, as get answers it.

Examples​

Each is the arguments of a tools/call request; the first is shown whole.

Save the WebView's cookies and web storage​

{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_storage",
"arguments": {}
}
}

On an Android 15 emulator the answer's text was:

saved state.json

mobium storage -o state.json on an Android 15 emulator

mobium storage -o state.json on an Android 15 emulator

Restore them in a later run​

{
"action": "restore",
"state": {
"cookies": [],
"origins": []
}
}

On an Android 15 emulator the answer's text was:

restored 1 cookie(s) and https://mobiumapp.test's storage
{
"cookies": [
{
"name": "visited",
"value": "yes",
"domain": "mobiumapp.test",
"path": "/",
"expires": 1790759538.232578,
"secure": true
}
],
"origins": [
{
"origin": "https://mobiumapp.test",
"localStorage": [
{
"name": "visits",
"value": "2"
}
],
"sessionStorage": [
{
"name": "lastVisit",
"value": "visit 2"
}
]
}
]
}
BeforeAfter
Before: mobium storage restore state.json on an Android 15 emulatorAfter: mobium storage restore state.json on an Android 15 emulator

mobium storage restore state.json on an Android 15 emulator