Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/playwright/src/mcp/browser/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ async function resolveFile(config: FullConfig, clientInfo: ClientInfo, fileName:
fileName = fileName.split('\\').join('/');
const resolvedFile = path.resolve(dir, fileName);
if (!resolvedFile.startsWith(path.resolve(dir) + path.sep))
throw new Error(`Resolved file path for ${fileName} is outside of the output directory`);
throw new Error(`Resolved file path ${resolvedFile} is outside of the output directory ${dir}. Use relative file names to stay within the output directory.`);
return resolvedFile;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/mcp/browser/tools/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as javascript from '../codegen';
import { dateAsFileName } from './utils';

const pdfSchema = z.object({
filename: z.string().optional().describe('File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified.'),
filename: z.string().optional().describe('File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified. Prefer relative file names to stay within the output directory.'),
});

const pdf = defineTabTool({
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/mcp/browser/tools/screenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type * as playwright from 'playwright-core';

const screenshotSchema = z.object({
type: z.enum(['png', 'jpeg']).default('png').describe('Image format for the screenshot. Default is png.'),
filename: z.string().optional().describe('File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified.'),
filename: z.string().optional().describe('File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified. Prefer relative file names to stay within the output directory.'),
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.'),
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.'),
fullPage: z.boolean().optional().describe('When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.'),
Expand Down