Skip to content

Commit f8ac724

Browse files
committed
chore: coerce input booleans and numbers
1 parent 5c8bb4f commit f8ac724

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/tools/screenshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { generateLocator } from './utils.js';
2424
import type * as playwright from 'playwright';
2525

2626
const screenshotSchema = z.object({
27-
raw: z.boolean().optional().describe('Whether to return without compression (in PNG format). Default is false, which returns a JPEG image.'),
27+
raw: z.coerce.boolean().optional().describe('Whether to return without compression (in PNG format). Default is false, which returns a JPEG image.'),
2828
filename: z.string().optional().describe('File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified.'),
2929
element: z.string().optional().describe('Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too.'),
3030
ref: z.string().optional().describe('Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too.'),

src/tools/snapshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const elementSchema = z.object({
4747
});
4848

4949
const clickSchema = elementSchema.extend({
50-
doubleClick: z.boolean().optional().describe('Whether to perform a double click instead of a single click'),
50+
doubleClick: z.coerce.boolean().optional().describe('Whether to perform a double click instead of a single click'),
5151
});
5252

5353
const click = defineTool({

src/tools/wait.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const wait: ToolFactory = captureSnapshot => defineTool({
2525
title: 'Wait for',
2626
description: 'Wait for text to appear or disappear or a specified time to pass',
2727
inputSchema: z.object({
28-
time: z.number().optional().describe('The time to wait in seconds'),
28+
time: z.coerce.number().optional().describe('The time to wait in seconds'),
2929
text: z.string().optional().describe('The text to wait for'),
3030
textGone: z.string().optional().describe('The text to wait for to disappear'),
3131
}),

0 commit comments

Comments
 (0)