/** * Schema Registry for Chrome Control * * This module defines the Zod validation schemas for all parameter types used by * Chrome Control tools. These schemas serve several important purposes: * * 1. Type validation - Ensuring that parameters meet expected formats * 2. Documentation - Providing descriptions of parameters for LLMs * 3. Runtime validation - Validating parameters at runtime before execution * 4. TypeScript type inference - Enabling strong typing throughout the codebase * * Each schema corresponds to a specific tool or tool category in the system and * defines the expected structure of parameters for that tool. These schemas are * used when registering tools with the MCP server to ensure that parameter * validation is consistent and well-documented. * * @module register */ import { z } from 'zod'; import { McpServer } from './mcp-server.js'; import { Tool } from './types/tool.js'; import { ActionType } from './types/puppeteer.js'; /** * ZodSchema for base Puppeteer parameters */ export declare const basePuppeteerParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; }, "strip", z.ZodTypeAny, { browserId?: string | undefined; tabId?: string | undefined; }, { browserId?: string | undefined; tabId?: string | undefined; }>; /** * Browser management schemas */ export declare const browserParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { launchOptions: z.ZodOptional>; }, "strip", z.ZodTypeAny, { browserId?: string | undefined; launchOptions?: Record | undefined; tabId?: string | undefined; }, { browserId?: string | undefined; launchOptions?: Record | undefined; tabId?: string | undefined; }>; /** * Tab management schemas */ export declare const tabParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { url: z.ZodOptional; }, "strip", z.ZodTypeAny, { url?: string | undefined; browserId?: string | undefined; tabId?: string | undefined; }, { url?: string | undefined; browserId?: string | undefined; tabId?: string | undefined; }>; /** * Navigation schemas */ export declare const responseFormatSchema: z.ZodOptional; fullPage: z.ZodOptional; pageText: z.ZodOptional; pageTitle: z.ZodOptional; elements: z.ZodOptional; attributes: z.ZodOptional>; includeText: z.ZodOptional; includeHTML: z.ZodOptional; }, "strip", z.ZodTypeAny, { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; }, { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; }>>; links: z.ZodOptional; inputs: z.ZodOptional; }, "strip", z.ZodTypeAny, { fullPage?: boolean | undefined; screenshot?: boolean | undefined; pageText?: boolean | undefined; pageTitle?: boolean | undefined; elements?: { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; } | undefined; links?: boolean | undefined; inputs?: boolean | undefined; }, { fullPage?: boolean | undefined; screenshot?: boolean | undefined; pageText?: boolean | undefined; pageTitle?: boolean | undefined; elements?: { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; } | undefined; links?: boolean | undefined; inputs?: boolean | undefined; }>>; export declare const navigateParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { url: z.ZodString; waitUntil: z.ZodOptional>; timeout: z.ZodOptional; responseFormat: z.ZodOptional; fullPage: z.ZodOptional; pageText: z.ZodOptional; pageTitle: z.ZodOptional; elements: z.ZodOptional; attributes: z.ZodOptional>; includeText: z.ZodOptional; includeHTML: z.ZodOptional; }, "strip", z.ZodTypeAny, { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; }, { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; }>>; links: z.ZodOptional; inputs: z.ZodOptional; }, "strip", z.ZodTypeAny, { fullPage?: boolean | undefined; screenshot?: boolean | undefined; pageText?: boolean | undefined; pageTitle?: boolean | undefined; elements?: { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; } | undefined; links?: boolean | undefined; inputs?: boolean | undefined; }, { fullPage?: boolean | undefined; screenshot?: boolean | undefined; pageText?: boolean | undefined; pageTitle?: boolean | undefined; elements?: { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; } | undefined; links?: boolean | undefined; inputs?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { url: string; browserId?: string | undefined; waitUntil?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2" | undefined; timeout?: number | undefined; responseFormat?: { fullPage?: boolean | undefined; screenshot?: boolean | undefined; pageText?: boolean | undefined; pageTitle?: boolean | undefined; elements?: { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; } | undefined; links?: boolean | undefined; inputs?: boolean | undefined; } | undefined; tabId?: string | undefined; }, { url: string; browserId?: string | undefined; waitUntil?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2" | undefined; timeout?: number | undefined; responseFormat?: { fullPage?: boolean | undefined; screenshot?: boolean | undefined; pageText?: boolean | undefined; pageTitle?: boolean | undefined; elements?: { selector?: string | undefined; attributes?: string[] | undefined; includeText?: boolean | undefined; includeHTML?: boolean | undefined; } | undefined; links?: boolean | undefined; inputs?: boolean | undefined; } | undefined; tabId?: string | undefined; }>; /** * Wait schemas */ export declare const waitParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { selector: z.ZodOptional; xpath: z.ZodOptional; function: z.ZodOptional; navigation: z.ZodOptional; waitUntil: z.ZodOptional>; time: z.ZodOptional; timeout: z.ZodOptional; }, "strip", z.ZodTypeAny, { function?: string | undefined; browserId?: string | undefined; waitUntil?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2" | undefined; timeout?: number | undefined; selector?: string | undefined; xpath?: string | undefined; navigation?: boolean | undefined; time?: number | undefined; tabId?: string | undefined; }, { function?: string | undefined; browserId?: string | undefined; waitUntil?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2" | undefined; timeout?: number | undefined; selector?: string | undefined; xpath?: string | undefined; navigation?: boolean | undefined; time?: number | undefined; tabId?: string | undefined; }>; /** * Screenshot schemas */ export declare const screenshotParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { name: z.ZodString; selector: z.ZodOptional; width: z.ZodOptional; height: z.ZodOptional; fullPage: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; browserId?: string | undefined; selector?: string | undefined; width?: number | undefined; height?: number | undefined; fullPage?: boolean | undefined; tabId?: string | undefined; }, { name: string; browserId?: string | undefined; selector?: string | undefined; width?: number | undefined; height?: number | undefined; fullPage?: boolean | undefined; tabId?: string | undefined; }>; /** * Mouse actions schemas */ export declare const mouseParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { action: z.ZodEnum<["move", "down", "up", "click"]>; x: z.ZodOptional; y: z.ZodOptional; button: z.ZodOptional>; clickCount: z.ZodOptional; }, "strip", z.ZodTypeAny, { action: "move" | "down" | "up" | "click"; browserId?: string | undefined; x?: number | undefined; y?: number | undefined; button?: "left" | "right" | "middle" | undefined; clickCount?: number | undefined; tabId?: string | undefined; }, { action: "move" | "down" | "up" | "click"; browserId?: string | undefined; x?: number | undefined; y?: number | undefined; button?: "left" | "right" | "middle" | undefined; clickCount?: number | undefined; tabId?: string | undefined; }>; export declare const clickParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { selector: z.ZodString; options: z.ZodOptional>; clickCount: z.ZodOptional; delay: z.ZodOptional; }, "strip", z.ZodTypeAny, { button?: "left" | "right" | "middle" | undefined; clickCount?: number | undefined; delay?: number | undefined; }, { button?: "left" | "right" | "middle" | undefined; clickCount?: number | undefined; delay?: number | undefined; }>>; }, "strip", z.ZodTypeAny, { selector: string; browserId?: string | undefined; options?: { button?: "left" | "right" | "middle" | undefined; clickCount?: number | undefined; delay?: number | undefined; } | undefined; tabId?: string | undefined; }, { selector: string; browserId?: string | undefined; options?: { button?: "left" | "right" | "middle" | undefined; clickCount?: number | undefined; delay?: number | undefined; } | undefined; tabId?: string | undefined; }>; export declare const hoverParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { selector: z.ZodString; }, "strip", z.ZodTypeAny, { selector: string; browserId?: string | undefined; tabId?: string | undefined; }, { selector: string; browserId?: string | undefined; tabId?: string | undefined; }>; /** * Keyboard schemas */ export declare const keyboardParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { action: z.ZodEnum<["press", "down", "up", "type"]>; key: z.ZodOptional; text: z.ZodOptional; delay: z.ZodOptional; }, "strip", z.ZodTypeAny, { action: "type" | "down" | "up" | "press"; browserId?: string | undefined; text?: string | undefined; delay?: number | undefined; key?: string | undefined; tabId?: string | undefined; }, { action: "type" | "down" | "up" | "press"; browserId?: string | undefined; text?: string | undefined; delay?: number | undefined; key?: string | undefined; tabId?: string | undefined; }>; /** * Form action schemas */ export declare const fillParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { selector: z.ZodString; value: z.ZodString; delay: z.ZodOptional; }, "strip", z.ZodTypeAny, { value: string; selector: string; browserId?: string | undefined; delay?: number | undefined; tabId?: string | undefined; }, { value: string; selector: string; browserId?: string | undefined; delay?: number | undefined; tabId?: string | undefined; }>; export declare const selectParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { selector: z.ZodString; value: z.ZodString; }, "strip", z.ZodTypeAny, { value: string; selector: string; browserId?: string | undefined; tabId?: string | undefined; }, { value: string; selector: string; browserId?: string | undefined; tabId?: string | undefined; }>; /** * Cookie schemas */ export declare const cookieParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { action: z.ZodEnum<["get", "set", "delete", "clear"]>; cookie: z.ZodOptional; path: z.ZodOptional; expires: z.ZodOptional; httpOnly: z.ZodOptional; secure: z.ZodOptional; sameSite: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; value: string; path?: string | undefined; domain?: string | undefined; expires?: number | undefined; httpOnly?: boolean | undefined; secure?: boolean | undefined; sameSite?: "Strict" | "Lax" | "None" | undefined; }, { name: string; value: string; path?: string | undefined; domain?: string | undefined; expires?: number | undefined; httpOnly?: boolean | undefined; secure?: boolean | undefined; sameSite?: "Strict" | "Lax" | "None" | undefined; }>>; names: z.ZodOptional>; }, "strip", z.ZodTypeAny, { action: "get" | "set" | "delete" | "clear"; browserId?: string | undefined; cookie?: { name: string; value: string; path?: string | undefined; domain?: string | undefined; expires?: number | undefined; httpOnly?: boolean | undefined; secure?: boolean | undefined; sameSite?: "Strict" | "Lax" | "None" | undefined; } | undefined; names?: string[] | undefined; tabId?: string | undefined; }, { action: "get" | "set" | "delete" | "clear"; browserId?: string | undefined; cookie?: { name: string; value: string; path?: string | undefined; domain?: string | undefined; expires?: number | undefined; httpOnly?: boolean | undefined; secure?: boolean | undefined; sameSite?: "Strict" | "Lax" | "None" | undefined; } | undefined; names?: string[] | undefined; tabId?: string | undefined; }>; /** * JavaScript evaluation schemas */ export declare const evaluateParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { script: z.ZodString; }, "strip", z.ZodTypeAny, { script: string; browserId?: string | undefined; tabId?: string | undefined; }, { script: string; browserId?: string | undefined; tabId?: string | undefined; }>; /** * Action chain schemas */ export declare const chainActionSchema: z.ZodObject<{ type: z.ZodEnum<[ActionType, ...ActionType[]]>; params: z.ZodRecord; condition: z.ZodOptional; }, "strip", z.ZodTypeAny, { previousAction: number; expectedStatus: "error" | "success"; }, { previousAction: number; expectedStatus: "error" | "success"; }>>; }, "strip", z.ZodTypeAny, { params: Record; type: ActionType; condition?: { previousAction: number; expectedStatus: "error" | "success"; } | undefined; }, { params: Record; type: ActionType; condition?: { previousAction: number; expectedStatus: "error" | "success"; } | undefined; }>; export declare const chainParamsSchema: z.ZodObject<{ browserId: z.ZodOptional; tabId: z.ZodOptional; } & { actions: z.ZodArray; params: z.ZodRecord; condition: z.ZodOptional; }, "strip", z.ZodTypeAny, { previousAction: number; expectedStatus: "error" | "success"; }, { previousAction: number; expectedStatus: "error" | "success"; }>>; }, "strip", z.ZodTypeAny, { params: Record; type: ActionType; condition?: { previousAction: number; expectedStatus: "error" | "success"; } | undefined; }, { params: Record; type: ActionType; condition?: { previousAction: number; expectedStatus: "error" | "success"; } | undefined; }>, "many">; stopOnError: z.ZodOptional; }, "strip", z.ZodTypeAny, { actions: { params: Record; type: ActionType; condition?: { previousAction: number; expectedStatus: "error" | "success"; } | undefined; }[]; browserId?: string | undefined; stopOnError?: boolean | undefined; tabId?: string | undefined; }, { actions: { params: Record; type: ActionType; condition?: { previousAction: number; expectedStatus: "error" | "success"; } | undefined; }[]; browserId?: string | undefined; stopOnError?: boolean | undefined; tabId?: string | undefined; }>; /** * Register tools with the MCP server * @param server MCP server instance * @param tools Array of Tool instances */ export declare function registerToolsList(server: McpServer, tools: Tool[]): void; //# sourceMappingURL=register.d.ts.map