55 */
66
77import type { ElementHandle } from 'puppeteer-core' ;
8- import z from 'zod' ;
98
109import type { McpContext , TextSnapshotNode } from '../McpContext.js' ;
10+ import { zod } from '../third_party/modelcontextprotocol-sdk/index.js' ;
1111
1212import { ToolCategories } from './categories.js' ;
1313import { defineTool } from './ToolDefinition.js' ;
@@ -20,12 +20,12 @@ export const click = defineTool({
2020 readOnlyHint : false ,
2121 } ,
2222 schema : {
23- uid : z
23+ uid : zod
2424 . string ( )
2525 . describe (
2626 'The uid of an element on the page from the page content snapshot' ,
2727 ) ,
28- dblClick : z
28+ dblClick : zod
2929 . boolean ( )
3030 . optional ( )
3131 . describe ( 'Set to true for double clicks. Default is false.' ) ,
@@ -59,7 +59,7 @@ export const hover = defineTool({
5959 readOnlyHint : false ,
6060 } ,
6161 schema : {
62- uid : z
62+ uid : zod
6363 . string ( )
6464 . describe (
6565 'The uid of an element on the page from the page content snapshot' ,
@@ -143,12 +143,12 @@ export const fill = defineTool({
143143 readOnlyHint : false ,
144144 } ,
145145 schema : {
146- uid : z
146+ uid : zod
147147 . string ( )
148148 . describe (
149149 'The uid of an element on the page from the page content snapshot' ,
150150 ) ,
151- value : z . string ( ) . describe ( 'The value to fill in' ) ,
151+ value : zod . string ( ) . describe ( 'The value to fill in' ) ,
152152 } ,
153153 handler : async ( request , response , context ) => {
154154 await context . waitForEventsAfterAction ( async ( ) => {
@@ -171,8 +171,8 @@ export const drag = defineTool({
171171 readOnlyHint : false ,
172172 } ,
173173 schema : {
174- from_uid : z . string ( ) . describe ( 'The uid of the element to drag' ) ,
175- to_uid : z . string ( ) . describe ( 'The uid of the element to drop into' ) ,
174+ from_uid : zod . string ( ) . describe ( 'The uid of the element to drag' ) ,
175+ to_uid : zod . string ( ) . describe ( 'The uid of the element to drop into' ) ,
176176 } ,
177177 handler : async ( request , response , context ) => {
178178 const fromHandle = await context . getElementByUid ( request . params . from_uid ) ;
@@ -200,11 +200,11 @@ export const fillForm = defineTool({
200200 readOnlyHint : false ,
201201 } ,
202202 schema : {
203- elements : z
203+ elements : zod
204204 . array (
205- z . object ( {
206- uid : z . string ( ) . describe ( 'The uid of the element to fill out' ) ,
207- value : z . string ( ) . describe ( 'Value for the element' ) ,
205+ zod . object ( {
206+ uid : zod . string ( ) . describe ( 'The uid of the element to fill out' ) ,
207+ value : zod . string ( ) . describe ( 'Value for the element' ) ,
208208 } ) ,
209209 )
210210 . describe ( 'Elements from snapshot to fill out.' ) ,
@@ -232,12 +232,12 @@ export const uploadFile = defineTool({
232232 readOnlyHint : false ,
233233 } ,
234234 schema : {
235- uid : z
235+ uid : zod
236236 . string ( )
237237 . describe (
238238 'The uid of the file input element or an element that will open file chooser on the page from the page content snapshot' ,
239239 ) ,
240- filePath : z . string ( ) . describe ( 'The local path of the file to upload' ) ,
240+ filePath : zod . string ( ) . describe ( 'The local path of the file to upload' ) ,
241241 } ,
242242 handler : async ( request , response , context ) => {
243243 const { uid, filePath} = request . params ;
0 commit comments