playwright-mcp

v0.0.86
io.github.microsoft/playwright-mcp Checked 2 hours ago Published 12 days ago

Playwright Tools for MCP

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

browser_close

Close the browser and all open tabs.

browser_resize

Resize the browser window

ParameterTypeDescription
height *numberHeight of the browser window
width *numberWidth of the browser window

browser_console_messages

Returns all console messages

ParameterTypeDescription
level *stringLevel of the console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
allbooleanReturn all console messages since the beginning of the session, not just since the last navigation. Defaults to false.
filenamestringFile name to save the console messages to. Relative file names are resolved against the workspace root. If not provided, messages are returned as text.

browser_handle_dialog

Handle a dialog

ParameterTypeDescription
accept *booleanWhether to accept the dialog.
promptTextstringThe text of the prompt in case of a prompt dialog.

browser_emulate_media

Emulate CSS media features for the page, for example switch between the light and dark color scheme. Omitted parameters are left unchanged; null clears an override.

ParameterTypeDescription
colorSchemeEmulates the prefers-color-scheme media feature
contrastEmulates the prefers-contrast media feature
forcedColorsEmulates the forced-colors media feature
mediaChanges the CSS media type of the page
reducedMotionEmulates the prefers-reduced-motion media feature

browser_evaluate

Evaluate JavaScript expression on page or element

ParameterTypeDescription
function *string() => { /* code */ } or (element) => { /* code */ } when element is provided
elementstringHuman-readable element description used to obtain permission to interact with the element
filenamestringFile name to save the result to. Relative file names are resolved against the workspace root. If not provided, result is returned as text.
targetstringExact target element reference from the page snapshot, or a unique element selector

browser_file_upload

Upload one or multiple files

ParameterTypeDescription
pathsarrayThe absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.

browser_drop

Drop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.

ParameterTypeDescription
target *stringExact target element reference from the page snapshot, or a unique element selector
dataobjectData to drop, as a map of MIME type to string value (e.g. {"text/plain": "hello", "text/uri-list": "https://example.com"}).
elementstringHuman-readable element description used to obtain permission to interact with the element
pathsarrayAbsolute paths to files to drop onto the element.

browser_find

Search the accessibility snapshot of the current page for text or a regular expression. Returns matching snapshot nodes with a few lines of surrounding context (like search snippets), each shown under its path from the root of the tree, which is cheaper than capturing the whole snapshot when you only need to locate an element and its ref.

ParameterTypeDescription
filenamestringSave results to a file instead of returning them in the response. Relative file names are resolved against the workspace root.
maxResultsnumberMaximum number of matching items to return. Defaults to returning all matches.
regexstringRegular expression to search for in the page snapshot. Matching is case-sensitive by default; wrap the pattern in slashes to add flags, e.g. "/error/i" for case-insensitive. Provide either text or reg…
textstringPlain text to search for in the page snapshot (case-insensitive substring match). Provide either text or regex, not both.

browser_fill_form

Fill multiple form fields

ParameterTypeDescription
fields *arrayFields to fill in

browser_press_key

Press a key on the keyboard

ParameterTypeDescription
key *stringName of the key to press or a character to generate, such as `ArrowLeft` or `a`

browser_type

Type text into editable element

ParameterTypeDescription
target *stringExact target element reference from the page snapshot, or a unique element selector
text *stringText to type into the element
elementstringHuman-readable element description used to obtain permission to interact with the element
slowlybooleanWhether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.
submitbooleanWhether to submit entered text (press Enter after)

browser_navigate

Navigate to a URL

ParameterTypeDescription
url *stringThe URL to navigate to

browser_navigate_back

Go back to the previous page in the history

browser_network_requests

Returns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.

ParameterTypeDescription
static *booleanWhether to include successful static resources like images, fonts, scripts, etc. Defaults to false.
allbooleanReturn all network requests since the beginning of the session, not just since the last navigation. Defaults to false.
filenamestringFile name to save the network requests to. Relative file names are resolved against the workspace root. If not provided, requests are returned as text.
filterstringOnly return requests whose URL matches this regexp (e.g. "/api/.*user").

browser_network_request

Returns full details (headers and body) of a single network request, or a single part if `part` is set. Use the number from browser_network_requests.

ParameterTypeDescription
index *integer1-based index of the request, as printed by browser_network_requests.
filenamestringFile name to save the result to. Relative file names are resolved against the workspace root. If not provided, output is returned as text.
partstringReturn only this part of the request. Omit to return full details.

browser_run_code_unsafe

Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.

ParameterTypeDescription
codestringA JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: `async (page) => { await page.get…
filenamestringLoad code from the specified file. Relative file names are resolved against the workspace root. If both code and filename are provided, code will be ignored.

browser_take_screenshot

Take a screenshot of the current page. Use browser_snapshot for actions by default. With the vision capability enabled, use screenshot coordinates with the coordinate-based mouse tools for elements not exposed in the accessibility snapshot.

ParameterTypeDescription
scale *stringImage resolution scale. "css" produces a screenshot sized in CSS pixels (smaller, consistent across devices). "device" produces a high-resolution screenshot using device pixels (larger, accounts for t…
elementstringHuman-readable element description used to obtain permission to interact with the element
filenamestringFile name to save the screenshot to. Relative file names are resolved against the workspace root. If not specified, the screenshot is saved into the output directory as `page-{timestamp}.{png|jpeg|web…
fullPagebooleanWhen true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.
targetstringExact target element reference from the page snapshot, or a unique element selector
typestringImage format for the screenshot. If unset, inferred from the filename extension, otherwise png.

browser_snapshot

Capture accessibility snapshot of the current page, this is better than screenshot

ParameterTypeDescription
boxesbooleanInclude each element's bounding box as [box=x,y,width,height] in the snapshot. Coordinates are viewport-relative, in CSS pixels (Element.getBoundingClientRect)
depthnumberLimit the depth of the snapshot tree
filenamestringSave snapshot to a file instead of returning it in the response. Relative file names are resolved against the workspace root.
targetstringExact target element reference from the page snapshot, or a unique element selector

browser_click

Perform click on a web page

ParameterTypeDescription
target *stringExact target element reference from the page snapshot, or a unique element selector
buttonstringButton to click, defaults to left
doubleClickbooleanWhether to perform a double click instead of a single click
elementstringHuman-readable element description used to obtain permission to interact with the element
modifiersarrayModifier keys to press

browser_drag

Perform drag and drop between two elements

ParameterTypeDescription
endTarget *stringExact target element reference from the page snapshot, or a unique element selector
startTarget *stringExact target element reference from the page snapshot, or a unique element selector
endElementstringHuman-readable target element description used to obtain the permission to interact with the element
startElementstringHuman-readable source element description used to obtain the permission to interact with the element

browser_hover

Hover over element on page

ParameterTypeDescription
target *stringExact target element reference from the page snapshot, or a unique element selector
elementstringHuman-readable element description used to obtain permission to interact with the element

browser_select_option

Select an option in a dropdown

ParameterTypeDescription
target *stringExact target element reference from the page snapshot, or a unique element selector
values *arrayArray of values to select in the dropdown. This can be a single value or multiple values.
elementstringHuman-readable element description used to obtain permission to interact with the element

browser_tabs

List, create, close, or select a browser tab.

ParameterTypeDescription
action *stringOperation to perform
indexnumberTab index, used for close/select. If omitted for close, current tab is closed.
isolatedContextstringName of an isolated browser context to create the new tab in, used for new. Tabs in the same isolated context share cookies and storage, tabs in different contexts are fully isolated. If omitted or "d…
urlstringURL to navigate to in the new tab, used for new.

browser_wait_for

Wait for text to appear or disappear or a specified time to pass. When both text and textGone are provided, waits for the first one to happen

ParameterTypeDescription
textstringThe text to wait for
textGonestringThe text to wait for to disappear
timenumberThe time to wait in seconds, at most 30. When combined with text or textGone, serves as a timeout for them instead of the default action timeout