Skip to content

Latest commit

 

History

History
362 lines (220 loc) · 10.9 KB

File metadata and controls

362 lines (220 loc) · 10.9 KB

Chrome DevTools MCP Tool Reference (~6182 cl100k_base tokens)

Input automation

click

Description: Clicks on an element.

Parameters:

  • uid (string) (required): uid of element from snapshot.
  • dblClick (boolean) (optional): true for double click. Default: false.
  • includeSnapshot (boolean) (optional): Include snapshot in response. Default: false.

drag

Description: Drags an element onto another element.

Parameters:

  • from_uid (string) (required): uid of element to drag.
  • to_uid (string) (required): uid of element to drop into.
  • includeSnapshot (boolean) (optional): Include snapshot in response. Default: false.

fill

Description: Types text into an input, textarea or selects an option from a <select> element.

Parameters:

  • uid (string) (required): uid of element from snapshot.
  • value (string) (required): Value to fill.
  • includeSnapshot (boolean) (optional): Include snapshot in response. Default: false.

fill_form

Description: Fills out multiple form elements at once.

Parameters:

  • elements (array) (required): Elements from snapshot to fill.
  • includeSnapshot (boolean) (optional): Include snapshot in response. Default: false.

handle_dialog

Description: Handles an open browser dialog.

Parameters:

  • action (enum: "accept", "dismiss") (required): Dialog action: accept or dismiss.
  • promptText (string) (optional): Optional prompt text for dialog.

hover

Description: Hovers over an element.

Parameters:

  • uid (string) (required): uid of element from snapshot.
  • includeSnapshot (boolean) (optional): Include snapshot in response. Default: false.

press_key

Description: Presses a key or key combination. Use this when other input methods like fill() cannot be used (e.g., keyboard shortcuts, navigation keys, or special key combinations).

Parameters:

  • key (string) (required): Key or combination (e.g., "Enter", "Control+A"). Modifiers: Control, Shift, Alt, Meta.
  • includeSnapshot (boolean) (optional): Include snapshot in response. Default: false.

upload_file

Description: Uploads a file through a provided element.

Parameters:

  • filePath (string) (required): Local path of file to upload.
  • uid (string) (required): uid of file input or element that opens file chooser.
  • includeSnapshot (boolean) (optional): Include snapshot in response. Default: false.

Navigation automation

close_page

Description: Closes a page by its index. The last open page cannot be closed.

Parameters:

  • pageId (number) (required): ID of page to close. Use list_pages.

list_pages

Description: Get a list of open pages.

Parameters: None


navigate_page

Description: Navigates to a URL.

Parameters:

  • handleBeforeUnload (enum: "accept", "decline") (optional): Auto-handle beforeunload dialogs. Default: accept.
  • ignoreCache (boolean) (optional): Ignore cache on reload.
  • initScript (string) (optional): JS script to run on new documents for next navigation.
  • timeout (integer) (optional): Max wait time in ms. 0 for default.
  • type (enum: "url", "back", "forward", "reload") (optional): Navigation type: url, back, forward, or reload.
  • url (string) (optional): Target URL (for type=url).

new_page

Description: Creates a new page.

Parameters:

  • url (string) (required): URL for new page.
  • background (boolean) (optional): Open in background. Default: false.
  • isolatedContext (string) (optional): Name for isolated browser context. Pages in same context share cookies/storage.
  • timeout (integer) (optional): Max wait time in ms. 0 for default.

select_page

Description: Select a page as a context for future calls.

Parameters:

  • pageId (number) (required): ID of page to select. Use list_pages to list pages.
  • bringToFront (boolean) (optional): Focus the page and bring it to top.

wait_for

Description: Waits for a text to appear.

Parameters:

  • text (string) (required): Text to find on the page.
  • timeout (integer) (optional): Max wait time in ms. 0 for default.

Emulation

emulate

Description: Emulates various features.

Parameters:

  • colorScheme (enum: "dark", "light", "auto") (optional): Emulate dark or light mode. "auto" to reset.
  • cpuThrottlingRate (number) (optional): CPU slowdown factor. 1 to disable. Omit to keep unchanged.
  • geolocation (unknown) (optional): Geolocation to emulate. null to clear override.
  • networkConditions (enum: "No emulation", "Offline", "Slow 3G", "Fast 3G", "Slow 4G", "Fast 4G") (optional): Throttle network. "No emulation" to disable. Omit to keep unchanged.
  • userAgent (unknown) (optional): User agent to emulate. null to clear override.
  • viewport (unknown) (optional): Viewport to emulate. null to reset.

resize_page

Description: Resizes the page's window to a specified dimension.

Parameters:

  • height (number) (required): Page height.
  • width (number) (required): Page width.

Performance

performance_analyze_insight

Description: Provides more details on a specific Performance Insight.

Parameters:

  • insightName (string) (required): Name of the insight, e.g., "DocumentLatency" or "LCPBreakdown".
  • insightSetId (string) (required): ID of the insight set from the "Available insight sets" list.

performance_start_trace

Description: Starts a performance trace recording to find performance problems and insights.

Parameters:

  • autoStop (boolean) (required): Auto-stop trace recording.
  • reload (boolean) (required): Auto-reload page on trace start. Use navigate_page first if needed.
  • filePath (string) (optional): Path to save raw trace data, e.g., trace.json or trace.json.gz.

performance_stop_trace

Description: Stops the active performance trace recording.

Parameters:

  • filePath (string) (optional): Path to save raw trace data, e.g., trace.json or trace.json.gz.

take_memory_snapshot

Description: Capture a memory heapsnapshot for memory leak debugging.

Parameters:

  • filePath (string) (required): Path to a .heapsnapshot file.

Network

get_network_request

Description: Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.

Parameters:

  • reqid (number) (optional): reqid of network request. Omit for selected in DevTools.
  • requestFilePath (string) (optional): Path to save request body. Omit for inline.
  • responseFilePath (string) (optional): Path to save response body. Omit for inline.

list_network_requests

Description: List all requests since the last navigation.

Parameters:

  • includePreservedRequests (boolean) (optional): Set to true for preserved requests over last 3 navigations.
  • pageIdx (integer) (optional): 0-based page number. Omit for first page.
  • pageSize (integer) (optional): Max requests to return. Omit for all.
  • resourceTypes (array) (optional): Filter by resource type. Omit or empty for all.

Debugging

evaluate_script

Description: Evaluate a JavaScript function. Returns the response as JSON, so returned values have to be JSON-serializable.

Parameters:

  • function (string) (required): JS function to run on the page. Ex: () => document.title, or with args: (el) => el.innerText.
  • args (array) (optional): Optional arguments for the function.

get_console_message

Description: Gets a console message by its ID. You can get all messages by calling list_console_messages.

Parameters:

  • msgid (number) (required): msgid of a console message from listed messages

list_console_messages

Description: List all console messages since the last navigation.

Parameters:

  • includePreservedMessages (boolean) (optional): Set to true for preserved messages over last 3 navigations.
  • pageIdx (integer) (optional): 0-based page number. Omit for first page.
  • pageSize (integer) (optional): Max messages to return. Omit for all.
  • types (array) (optional): Filter by message type. Omit or empty for all.

take_screenshot

Description: Takes a screenshot of the page or an element.

Parameters:

  • filePath (string) (optional): Path to save screenshot. If omitted, attaches to response.
  • format (enum: "png", "jpeg", "webp") (optional): Screenshot format. Default: "png".
  • fullPage (boolean) (optional): true for full page screenshot. Incompatible with uid.
  • quality (number) (optional): JPEG/WebP quality (0-100). Higher is better. Ignored for PNG.
  • uid (string) (optional): uid of element from snapshot. Omit for page screenshot.

take_snapshot

Description: Take a text snapshot based on the a11y tree.

Parameters:

  • filePath (string) (optional): Path to save snapshot. If omitted, attaches to response.
  • verbose (boolean) (optional): Include all info from the a11y tree. Default: false.