Skip to main content
Glama
cloudflare

Cloudflare Playwright MCP

Official
by cloudflare

browser_tab_select

Read-only

Switch to a specific browser tab by its index to manage multiple web pages during automated testing using Cloudflare Playwright MCP.

Instructions

Select a tab by index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYesThe index of the tab to select

Implementation Reference

  • The tool handler for 'browser_tab_select' that invokes context.selectTab(index) and returns a mock code execution result.
    handle: async (context, params) => {
      await context.selectTab(params.index);
      const code = [
        `// <internal code to select tab ${params.index}>`,
      ];
    
      return {
        code,
        captureSnapshot,
        waitForNetwork: false
      };
    },
  • Zod schema definition for the 'browser_tab_select' tool input, requiring a numeric index.
    schema: {
      name: 'browser_tab_select',
      title: 'Select a tab',
      description: 'Select a tab by index',
      inputSchema: z.object({
        index: z.coerce.number().describe('The index of the tab to select'),
      }),
      type: 'readOnly',
    },
  • Core implementation of tab selection in the Context class: sets the current tab by index and brings the page to front using Playwright.
    async selectTab(index: number) {
      this._currentTab = this._tabs[index - 1];
      await this._currentTab.page.bringToFront();
    }
  • The tabs tools module exports a function returning an array of tools, including the selectTab tool factory invoked with captureSnapshot parameter.
    export default (captureSnapshot: boolean) => [
      listTabs,
      newTab(captureSnapshot),
      selectTab(captureSnapshot),
      closeTab(captureSnapshot),
    ];
  • src/tools.ts:35-50 (registration)
    Top-level registration of snapshotTools array which includes tabs(true), thereby registering browser_tab_select among other tools.
    export const snapshotTools: Tool<any>[] = [
      ...common(true),
      ...console,
      ...dialogs(true),
      ...files(true),
      ...install,
      ...keyboard(true),
      ...navigate(true),
      ...network,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs(true),
      ...testing,
      ...wait(true),
    ];
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate readOnlyHint=true, destructiveHint=false, and openWorldHint=true, which already convey that this is a safe, non-destructive operation with open-world semantics. The description adds minimal behavioral context beyond this, as 'select' implies changing focus but doesn't detail effects (e.g., switching browser context) or constraints (e.g., index bounds). It doesn't contradict annotations, but adds little value over them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with 'Select a tab by index', a single sentence that front-loads the core action and method. There is no wasted text, and it efficiently communicates the tool's purpose without unnecessary details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no output schema) and rich annotations (readOnlyHint, destructiveHint, openWorldHint), the description is minimally complete. It states what the tool does but lacks context on usage scenarios, error handling, or integration with sibling tools (e.g., browser_tab_list). For a simple selection tool, this is adequate but leaves gaps in practical guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'index' fully documented as 'The index of the tab to select'. The description 'Select a tab by index' aligns with this but adds no extra semantic meaning (e.g., index format, zero-based vs. one-based, or valid ranges). Baseline score of 3 is appropriate since the schema handles parameter documentation effectively.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Select a tab by index' clearly states the action (select) and resource (tab), with the method (by index) specified. It distinguishes from siblings like browser_tab_list (list tabs) and browser_tab_close (close tabs), though it doesn't explicitly mention this distinction. The purpose is specific but could be slightly more explicit about sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an open browser or existing tabs), when not to use it (e.g., if no tabs exist), or direct alternatives (like browser_tab_list for listing tabs first). Usage is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cloudflare/playwright-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server