Skip to main content
Glama
VikashLoomba

MCP-Server-Playwright

browser_select

Select dropdown options on web pages using CSS selectors to automate form interactions and data entry in browser environments.

Instructions

Select an element on the page with Select tag using CSS selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for element to select
valueYesValue to select

Implementation Reference

  • Handler implementation for the 'browser_select' tool within the handleToolCall switch statement. It selects an option in a select element using the provided CSS selector and value, includes error handling for strict mode violations with a retry on the first matching element.
    case ToolName.BrowserSelect:
      try {
        await page.locator(args.selector).selectOption(args.value);
        return {
          content: [{
            type: "text",
              text: `Selected ${args.selector} with: ${args.value}`,
            }],
          isError: false,
        };
      } catch (error) {
        if((error as Error).message.includes("strict mode violation")) {
            console.log("Strict mode violation, retrying on first element...");
            try {
                await page.locator(args.selector).first().selectOption(args.value);
                return {
                    content: [{
                        type: "text",
                        text: `Selected ${args.selector} with: ${args.value}`,
                    }],
                    isError: false,
                };
            } catch (error) {
                return {
                    content: [{
                        type: "text",
                        text: `Failed (twice) to select ${args.selector}: ${(error as Error).message}`,
                    }],
                    isError: true,
                };
            }
        }
        return {
          content: [{
            type: "text",
              text: `Failed to select ${args.selector}: ${(error as Error).message}`,
            }],
          isError: true,
        };
      }
  • Input schema definition for the 'browser_select' tool, specifying required 'selector' (CSS selector) and 'value' (option value) parameters.
    inputSchema: {
      type: "object",
      properties: {
        selector: { type: "string", description: "CSS selector for element to select" },
        value: { type: "string", description: "Value to select" },
      },
      required: ["selector", "value"],
    },
  • index.ts:95-106 (registration)
    Tool registration object for 'browser_select' (ToolName.BrowserSelect) in the TOOLS array, including name, description, and input schema. This array is used in the ListToolsRequest handler.
    {
      name: ToolName.BrowserSelect,
      description: "Select an element on the page with Select tag using CSS selector",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string", description: "CSS selector for element to select" },
          value: { type: "string", description: "Value to select" },
        },
        required: ["selector", "value"],
      },
    },
  • Enum definition including ToolName.BrowserSelect = 'browser_select', used throughout for tool name references.
    enum ToolName {
      BrowserNavigate = "browser_navigate",
      BrowserScreenshot = "browser_screenshot",
      BrowserClick = "browser_click",
      BrowserClickText = "browser_click_text",
      BrowserFill = "browser_fill",
      BrowserSelect = "browser_select",
      BrowserSelectText = "browser_select_text",
      BrowserHover = "browser_hover",
      BrowserHoverText = "browser_hover_text",
      BrowserEvaluate = "browser_evaluate"
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'select an element' but doesn't clarify what happens after selection - whether this triggers UI events, changes form state, or requires specific page conditions. For a browser interaction tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a simple browser interaction tool and gets straight to the point without unnecessary elaboration.

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

Completeness2/5

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

For a browser interaction tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'select' means in browser context, what happens after selection, potential errors, or return values. Given the complexity of browser automation and lack of structured metadata, more context is needed.

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?

Schema description coverage is 100%, with both parameters ('selector' and 'value') clearly documented in the schema. The description adds minimal value beyond what the schema provides, only reinforcing that CSS selectors are used. Baseline 3 is appropriate when the schema does the heavy lifting.

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 clearly states the action ('Select an element') and target ('on the page with Select tag using CSS selector'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'browser_select_text' or explain what makes 'select' different from 'click' operations on select elements.

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. There are multiple browser interaction siblings (click, fill, hover, etc.), but no indication of when selection is appropriate versus clicking or filling, or when to use 'browser_select' versus 'browser_select_text'.

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

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/VikashLoomba/MCP-Server-Playwright'

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