Skip to content

Tabs & Viewport ​

Tools operate on the session's current tab. Links with target="_blank" open new tabs that you can activate with switch_tab.

list_tabs ​

Example Response:

json
{
  "count": 2,
  "tabs": [
    { "index": 0, "tab_id": "A1B2...", "url": "https://example.com/", "title": "Example", "current": false },
    { "index": 1, "tab_id": "C3D4...", "url": "https://example.com/help", "title": "Help", "current": true }
  ]
}

new_tab ​

Open a new tab (optionally at a URL) and make it current.

NameTypeRequiredDescription
urlstringNoURL to open (subject to the navigation policy)
session_idstringYesSession ID to use

switch_tab ​

Make another tab current, by tab_id (from list_tabs) or zero-based index.

NameTypeRequiredDescription
tab_idstringNoTab to activate
indexintegerNoZero-based index (alternative to tab_id)
session_idstringYesSession ID to use

close_tab ​

Close a tab (the current one by default). The last remaining tab cannot be closed; closing the current tab activates the first remaining one.

NameTypeRequiredDescription
tab_idstringNoTab to close (default: current)
indexintegerNoZero-based index (alternative to tab_id)
session_idstringYesSession ID to use

set_viewport ​

NameTypeRequiredDescription
widthintegerYesViewport width in pixels
heightintegerYesViewport height in pixels
scale_factornumberNoDevice scale factor (0 keeps the default)
mobilebooleanNoEmulate a mobile device (default: false)
session_idstringYesSession ID to use

Released under the MIT License.