Skip to main content
Playwright MCP provides a unified tool for managing browser tabs. This allows you to work with multiple pages simultaneously, which is useful for workflows that require comparing content across different pages or managing multiple web applications.

browser_tabs

List, create, close, or select a browser tab.
action
string
required
Operation to perform. Available actions:
  • list - List all open tabs
  • create - Create a new tab
  • close - Close a tab
  • select - Switch to a specific tab
index
number
Tab index, used for close/select actions. If omitted for close, current tab is closed.
Read-only: No

Usage Examples

List All Tabs

Get a list of all currently open tabs with their indexes and URLs:
{
  "tool": "browser_tabs",
  "arguments": {
    "action": "list"
  }
}
Response example:
Open tabs:
0: https://example.com (current)
1: https://github.com
2: https://playwright.dev

Create a New Tab

Open a new blank tab:
{
  "tool": "browser_tabs",
  "arguments": {
    "action": "create"
  }
}
The new tab will become the active tab. You can then use browser_navigate to navigate to a URL.

Switch to a Specific Tab

Switch to a tab by its index:
{
  "tool": "browser_tabs",
  "arguments": {
    "action": "select",
    "index": 1
  }
}
Use the list action first to see the available tab indexes before switching.

Close a Specific Tab

Close a tab by its index:
{
  "tool": "browser_tabs",
  "arguments": {
    "action": "close",
    "index": 2
  }
}

Close the Current Tab

Close the currently active tab without specifying an index:
{
  "tool": "browser_tabs",
  "arguments": {
    "action": "close"
  }
}
If you close the last remaining tab, the browser context will remain open but empty. You can create a new tab to continue working.

Common Workflows

Compare Content Across Multiple Pages

  1. Navigate to the first page
  2. Create a new tab
  3. Navigate to the second page
  4. Take snapshots or screenshots of both
  5. Switch between tabs to compare
// Navigate to first page
{ "tool": "browser_navigate", "arguments": { "url": "https://example.com/page1" } }

// Create new tab
{ "tool": "browser_tabs", "arguments": { "action": "create" } }

// Navigate to second page
{ "tool": "browser_navigate", "arguments": { "url": "https://example.com/page2" } }

// Switch back to first tab
{ "tool": "browser_tabs", "arguments": { "action": "select", "index": 0 } }

Managing Multiple Workflows

When working with multiple web applications or workflows:
// List current tabs to see what's open
{ "tool": "browser_tabs", "arguments": { "action": "list" } }

// Switch to admin panel tab
{ "tool": "browser_tabs", "arguments": { "action": "select", "index": 1 } }

// Perform admin actions...

// Switch back to main application
{ "tool": "browser_tabs", "arguments": { "action": "select", "index": 0 } }

// Close unused tabs to clean up
{ "tool": "browser_tabs", "arguments": { "action": "close", "index": 2 } }

Best Practices

Tab indexes can change when tabs are closed. Always use the list action to get current indexes before performing select or close operations.
Close tabs when you’re done with them to avoid confusion and reduce resource usage.
When working with multiple tabs, maintain a clear mental model or documentation of which tab contains what content.

Core Automation

Navigate and interact with pages in tabs

Page Snapshot

Capture content from different tabs