You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** When present the function did not complete within the timeout. Pass this ID to {@link IPlaywrightService.waitForDeferredResult} to keep waiting. */
15
+
deferredResultId?: string;
16
+
}
17
+
11
18
/**
12
19
* A service for using Playwright to connect to and automate the integrated browser.
* Run a function with access to a Playwright page and return a result for tool output, including error handling.
76
83
* The first function argument is always the Playwright `page` object, and additional arguments can be passed after.
84
+
*
85
+
* When {@link timeoutMs} is provided, the call races against that timeout.
86
+
* If the timeout fires before the function completes, or the function is otherwise interrupted,
87
+
* the in-flight promise is stored as a *deferred result* and the returned object includes a
88
+
* {@link deferredResultId} that can be passed to {@link waitForDeferredResult} to resume waiting.
89
+
* When {@link timeoutMs} is omitted the function runs to completion with no deferral.
90
+
*
77
91
* @param pageId The browser view ID identifying the page to operate on.
78
92
* @param fnDef The function code to execute. Should contain the function definition but not its invocation, e.g. `async (page, arg1, arg2) => { ... }`.
79
93
* @param args Additional arguments to pass to the function after the `page` object.
80
-
* @returns The result of the function execution, including a page summary.
94
+
* @param timeoutMs Maximum time (in ms) to wait for the function to complete before deferring. When omitted the call awaits indefinitely.
95
+
* @returns The result of the function execution, including a page summary and optionally a deferredResultId if the call did not complete.
content.push({kind: 'text',value: `[deferredResultId=${result.deferredResultId}] The code has not finished executing yet. Call run_playwright_code again with this deferredResultId and the same pageId (no code) to continue waiting.`});
description: `The Playwright code to execute. The code must be concise, serve one clear purpose, and be self-contained. You **must not** directly access \`document\` or \`window\` using this tool. You must access it via the provided \`page\` object, e.g. "return page.evaluate(() => document.title)".`
32
+
description: `The Playwright code to execute. The code must be concise, serve one clear purpose, and be self-contained. You **must not** directly access \`document\` or \`window\` using this tool. You must access it via the provided \`page\` object, e.g. "return page.evaluate(() => document.title)". Omit this when resuming a deferred execution via deferredResultId.`
33
+
},
34
+
deferredResultId: {
35
+
type: 'string',
36
+
description: `If a previous call returned a deferredResultId, pass it here to continue waiting for that execution to complete.`
37
+
},
38
+
timeoutMs: {
39
+
type: 'number',
40
+
description: `Maximum time in milliseconds to wait for the code to complete. Defaults to 5000 (5 seconds).`
0 commit comments