Skip to main content
Glama

browser_select_text

Select dropdown elements by text content during web application penetration testing to automate security vulnerability detection.

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

  • The handler function for 'browser_select_text' tool. It uses Playwright to select an option in a dropdown by finding the select element via text and selecting the specified value, with try-catch error handling and retry logic 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,
        };
      }
  • The input schema definition for the 'browser_select_text' tool, specifying required parameters 'text' and 'value'.
    {
      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"],
      },
  • index.ts:840-842 (registration)
    Registration of the tools list handler, which exposes the TOOLS array containing the 'browser_select_text' tool.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOLS,
    }));
  • index.ts:844-846 (registration)
    Registration of the call tool request handler, which dispatches tool calls (including 'browser_select_text') to the handleToolCall function.
    server.setRequestHandler(CallToolRequestSchema, async (request) =>
      handleToolCall(request.params.name as ToolName, request.params.arguments ?? {})
    );
  • Enum constant definition mapping BrowserSelectText to the tool name string 'browser_select_text'.
    BrowserSelectText = "browser_select_text",
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions selecting by text content but doesn't disclose behavioral traits such as whether this triggers page events, requires the element to be visible, handles multiple matches, or what happens on failure. This is a significant gap for a browser interaction tool.

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

Conciseness4/5

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

The description is a single, straightforward sentence with no wasted words. It could be slightly more specific (e.g., 'HTML <select> element'), but it efficiently conveys the core purpose.

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 incomplete. It doesn't explain what happens after selection (e.g., does it return success/failure, trigger events?), error conditions, or dependencies like requiring a page to be loaded. More context is needed for safe and effective use.

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%, so the schema already documents both parameters (text and value). The description adds minimal value beyond the schema by implying text is used to identify the element and value is what gets selected, but doesn't clarify the relationship between them or provide examples.

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') and target ('element on the page with Select tag'), though it could be more specific about what 'Select tag' means (likely HTML <select> element). It distinguishes from siblings like browser_click or browser_select by focusing on text-based selection rather than clicking or generic selection.

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 explicit guidance on when to use this tool versus alternatives like browser_select (which might select by other criteria) or browser_click_text. The description implies usage for selecting elements by text content, but lacks context on prerequisites or exclusions.

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/9olidity/MCP-Server-Pentest'

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