We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e279f1 commit effbe56Copy full SHA for effbe56
1 file changed
src/tools/pages.ts
@@ -133,6 +133,9 @@ export const navigatePage = defineTool({
133
.describe(
134
'Whether to auto accept or beforeunload dialogs triggered by this navigation. Default is accept.',
135
),
136
+ initScript: zod.string().optional().describe(
137
+ `(optional) A JavaScript function declaration to be executed by the tool on new document for every page load.
138
+ `),
139
...timeoutSchema,
140
},
141
handler: async (request, response, context) => {
@@ -163,6 +166,10 @@ export const navigatePage = defineTool({
163
166
context.clearDialog();
164
167
}
165
168
};
169
+
170
+ if (request.params.initScript) {
171
+ await page.evaluateOnNewDocument(request.params.initScript);
172
+ }
173
page.on('dialog', dialogHandler);
174
175
try {
0 commit comments