Skip to content

Commit 3131053

Browse files
committed
patch(playwright-mcp): prevent errors in playground.ai
https://playground.ai.cloudflare.com passes "null" as values in element and ref for browser_take_screenshot
1 parent 6d6d6f1 commit 3131053

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tools/snapshot.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ const selectOption = defineTool({
212212

213213
const screenshotSchema = z.object({
214214
raw: z.coerce.boolean().optional().describe('Whether to return without compression (in PNG format). Default is false, which returns a JPEG image.'),
215-
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.'),
216-
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.'),
215+
element: z.string().optional().transform(v => v === 'null' ? undefined : v).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.'),
216+
ref: z.string().optional().transform(v => v === 'null' ? undefined : v).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.'),
217217
}).refine(data => {
218218
return !!data.element === !!data.ref;
219219
}, {

0 commit comments

Comments
 (0)