webview_eval
Evaluate JavaScript expressions in iOS app WebViews to read app state or assert conditions against the live DOM.
Instructions
Evaluates a JavaScript expression in a WebView's page context and returns the result. Use it to read web-app state (location.href, store values, feature flags, on-screen balances) or to assert conditions against the live DOM. Requires the app's WKWebView to be inspectable (isInspectable=true) — on by default in debug/staging builds, frequently disabled in production App Store builds.
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": {
"udid": "<udid>",
"expression": "<expression>"
},
"name": "webview_eval"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | Yes | Simulator / device UDID | |
| expression | Yes | JavaScript expression to evaluate, e.g. "location.href" or "document.querySelectorAll('button').length" | |
| webviewId | No | Target WebView id. Omit to auto-select the first visible WebView. |