Skip to main content
Glama
VikashLoomba

MCP-Server-Playwright

browser_select_text

Select a dropdown option by matching its visible text, then apply the specified value.

Instructions

Select an element on the page with Select tag by its text content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText content of the element to select
valueYesValue to select

Implementation Reference

  • index.ts:29-29 (registration)
    Enum entry registering the tool name 'browser_select_text'
    BrowserSelectText = "browser_select_text",
  • Tool schema definition for BrowserSelectText, specifying input validation with 'text' and 'value' required string properties
    {
      name: ToolName.BrowserSelectText,
      description: "Select an element on the page with Select tag by its text content",
      inputSchema: {
        type: "object",
        properties: {
          text: { type: "string", description: "Text content of the element to select" },
          value: { type: "string", description: "Value to select" },
        },
        required: ["text", "value"],
      },
    },
  • Handler implementation for BrowserSelectText: finds element by text content using page.getByText(), then selects the specified option value. Includes retry logic with .first() for strict mode violations.
    case ToolName.BrowserSelectText:
      try {
        await page.getByText(args.text).selectOption(args.value);
        return {
          content: [{
            type: "text",
            text: `Selected element with text ${args.text} with value: ${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.getByText(args.text).first().selectOption(args.value);
                return {
                    content: [{
                        type: "text",
                        text: `Selected element with text ${args.text} with value: ${args.value}`,
                    }],
                    isError: false,
                };
            } catch (error) {
                return {
                    content: [{
                        type: "text",
                        text: `Failed (twice) to select element with text ${args.text}: ${(error as Error).message}`,
                    }],
                    isError: true,
                };
            }
        }
        return {
          content: [{
            type: "text",
            text: `Failed to select element with text ${args.text}: ${(error as Error).message}`,
          }],
          isError: true,
        };
      }
Behavior2/5

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

With no annotations, the description must disclose behavioral traits, but it does not. It doesn't mention side effects, such as whether the page is modified, or error handling if the text or value is not found. This leaves the agent unsure of the tool's impact.

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

Conciseness3/5

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

The description is a single sentence, which is concise but overly vague. It lacks structure and fails to front-load key information. While short, it sacrifices clarity for brevity.

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 tool with no output schema and two parameters, the description is insufficient. It does not explain how the two parameters relate (text identifies the element, value selects the option). The agent lacks a complete understanding of the tool's behavior.

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%, but the parameter descriptions are tautological (e.g., 'Text content of the element to select'). The tool description itself does not add any meaning beyond the input schema. Baseline 3 applies due to high coverage, but no extra value is provided.

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

Purpose2/5

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

The description states 'Select an element on the page with Select tag by its text content,' which is vague and potentially misleading. It does not clearly explain that the tool likely selects an option from a dropdown based on text, especially confusing given the 'value' parameter. It barely distinguishes from sibling tool 'browser_select' only by name.

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?

No guidance on when to use this tool versus alternatives like 'browser_select' or 'browser_click_text'. The description lacks any context about prerequisites, such as whether the page must be loaded or the element must exist.

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