27 lines
1.2 KiB
JSON
27 lines
1.2 KiB
JSON
{
|
|
"name": "chrome_javascript",
|
|
"description": "Execute JavaScript code in a browser tab and return the result. Uses CDP Runtime.evaluate with awaitPromise and returnByValue; automatically falls back to chrome.scripting.executeScript if the debugger is busy. Output is sanitized (sensitive data redacted) and truncated by default.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "string",
|
|
"description": "JavaScript code to execute. Runs inside an async function body, so top-level await and \"return ...\" are supported. A single bare expression is auto-returned, so \"2+2\" yields 4 \u2014 but a MULTI-STATEMENT snippet needs an explicit \"return\", since only the last value of a one-expression snippet can be inferred (e.g. \"const t = document.title; return t;\")."
|
|
},
|
|
"tabId": {
|
|
"type": "number",
|
|
"description": "Target tab ID. If omitted, uses the current active tab."
|
|
},
|
|
"timeoutMs": {
|
|
"type": "number",
|
|
"description": "Execution timeout in milliseconds (default: 15000)."
|
|
},
|
|
"maxOutputBytes": {
|
|
"type": "number",
|
|
"description": "Maximum output size in bytes after sanitization (default: 51200). Output exceeding this limit will be truncated."
|
|
}
|
|
},
|
|
"required": ["code"]
|
|
}
|
|
}
|