We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c42d81a commit 78127e2Copy full SHA for 78127e2
1 file changed
src/tools/pages.ts
@@ -116,6 +116,9 @@ export const navigatePage = defineTool({
116
.boolean()
117
.optional()
118
.describe('Whether to ignore cache on reload.'),
119
+ initScript: zod.string().optional().describe(
120
+ `(optional) A JavaScript function declaration to be executed by the tool on new document for every page load.
121
+ `),
122
...timeoutSchema,
123
},
124
handler: async (request, response, context) => {
@@ -132,6 +135,10 @@ export const navigatePage = defineTool({
132
135
request.params.type = 'url';
133
136
}
134
137
138
+ if(request.params.initScript){
139
+ page.evaluateOnNewDocument(request.params.initScript);
140
+ }
141
+
142
await context.waitForEventsAfterAction(async () => {
143
switch (request.params.type) {
144
case 'url':
0 commit comments