diff --git a/src/ToolHandler.ts b/src/ToolHandler.ts index c9bf56d9f..80950c97b 100644 --- a/src/ToolHandler.ts +++ b/src/ToolHandler.ts @@ -163,7 +163,7 @@ export class ToolHandler { tool.pageScoped && serverArgs.experimentalPageIdRouting && !serverArgs.slim - ? {...tool.schema, ...pageIdSchema} + ? {...pageIdSchema, ...tool.schema} : tool.schema; this.registeredInputSchema = zod.object(this.inputSchema).passthrough(); } diff --git a/src/tools/script.ts b/src/tools/script.ts index 0d5bb9ec8..a483330c2 100644 --- a/src/tools/script.ts +++ b/src/tools/script.ts @@ -24,6 +24,7 @@ so returned values have to be JSON-serializable.`, readOnlyHint: false, }, schema: { + ...(cliArgs?.experimentalPageIdRouting ? pageIdSchema : {}), function: zod.string().describe( `A JavaScript function declaration to be executed by the tool in the currently selected page. Example without arguments: \`() => { @@ -58,7 +59,6 @@ Example with arguments: \`(el) => { .describe( 'Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.', ), - ...(cliArgs?.experimentalPageIdRouting ? pageIdSchema : {}), ...(cliArgs?.categoryExtensions ? { serviceWorkerId: zod