Skip to main content
Glama

browser_surface

Control browser automation in parallel AI agent workspaces to open pages, interact with elements, execute scripts, and capture screenshots.

Instructions

Interact with a browser surface (open, navigate, snapshot, click, type, eval, wait)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesBrowser action to perform
surfaceNoTarget surface ref
workspaceNoTarget workspace ref
urlNoURL for open/goto actions
selectorNoCSS selector for click/type/wait actions
textNoText for type action
scriptNoJavaScript for eval action
timeout_msNoTimeout for wait action

Implementation Reference

  • The handler for the browser_surface tool. It processes the action and arguments, prepares command-line arguments for the browser client, and executes the call.
    async (args) => {
      try {
        const browserArgs: string[] = [];
        if (args.surface) {
          browserArgs.push("--surface", args.surface);
        }
    
        switch (args.action) {
          case "open":
            browserArgs.push("open");
            if (args.url) {
              browserArgs.push(args.url);
            }
            break;
          case "goto":
            requireValue(args.surface, "surface is required for goto");
            requireValue(args.url, "url is required for goto");
            browserArgs.push("goto", args.url);
            break;
          case "snapshot":
            requireValue(args.surface, "surface is required for snapshot");
            browserArgs.push("snapshot");
            break;
          case "click":
            requireValue(args.surface, "surface is required for click");
            requireValue(args.selector, "selector is required for click");
            browserArgs.push("click", args.selector);
            break;
          case "type":
            requireValue(args.surface, "surface is required for type");
            requireValue(args.selector, "selector is required for type");
            requireValue(args.text, "text is required for type");
            browserArgs.push("type", args.selector, args.text);
            break;
          case "eval":
            requireValue(args.surface, "surface is required for eval");
            requireValue(args.script, "script is required for eval");
            browserArgs.push("eval", args.script);
            break;
          case "wait":
            requireValue(args.surface, "surface is required for wait");
            if (!args.selector && !args.text && !args.timeout_ms) {
              throw new Error(
                "wait requires at least one of selector, text, or timeout_ms",
              );
            }
            browserArgs.push("wait");
            if (args.selector) {
              browserArgs.push("--selector", args.selector);
            }
            if (args.text) {
              browserArgs.push("--text", args.text);
            }
            if (args.timeout_ms) {
              browserArgs.push("--timeout-ms", String(args.timeout_ms));
            }
            break;
          case "url":
            requireValue(args.surface, "surface is required for url");
            browserArgs.push("url");
            break;
        }
    
        const result = await client.browser(browserArgs);
        // browser_surface actions map to cmux browser-surface subcommands
        return ok({
          action: args.action,
          surface: args.surface,
          result,
        });
      } catch (e) {
        return err(e);
      }
    },
  • src/server.ts:511-543 (registration)
    Registration and schema definition for the browser_surface tool.
    // 10. browser_surface
    server.tool(
      "browser_surface",
      "Interact with a browser surface (open, navigate, snapshot, click, type, eval, wait)",
      {
        action: z
          .enum([
            "open",
            "goto",
            "snapshot",
            "click",
            "type",
            "eval",
            "wait",
            "url",
          ])
          .describe("Browser action to perform"),
        surface: z.string().optional().describe("Target surface ref"),
        workspace: z.string().optional().describe("Target workspace ref"),
        url: z.string().optional().describe("URL for open/goto actions"),
        selector: z
          .string()
          .optional()
          .describe("CSS selector for click/type/wait actions"),
        text: z.string().optional().describe("Text for type action"),
        script: z.string().optional().describe("JavaScript for eval action"),
        timeout_ms: z
          .number()
          .int()
          .positive()
          .optional()
          .describe("Timeout for wait action"),
      },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it lists action types, it doesn't explain what 'surface' and 'workspace' refs are, whether actions are synchronous/asynchronous, error handling, or performance characteristics. For a complex 8-parameter tool with multiple action types, this is insufficient behavioral context.

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 - a single sentence that efficiently lists all available actions. It's front-loaded with the core purpose and wastes no words. Every element earns its place in this compact format.

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 complex tool with 8 parameters, multiple action types, no annotations, and no output schema, the description is inadequate. It doesn't explain return values, error conditions, or the relationships between parameters for different actions. The agent would struggle to use this tool correctly without significant trial and error.

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 all parameters thoroughly. The description adds minimal value by listing action names that correspond to the 'action' enum values, but doesn't provide additional semantic context beyond what's in the schema. Baseline 3 is appropriate when 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 tool's purpose with a specific verb ('Interact') and resource ('browser surface'), and lists the available actions. However, it doesn't explicitly differentiate this tool from sibling tools like 'send_input', 'send_key', or 'read_screen' which might have overlapping browser interaction capabilities.

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. With multiple sibling tools that might handle browser interactions (send_input, send_key, read_screen, wait_for), there's no indication of when this multi-action browser tool is preferred over more specialized tools or vice versa.

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/EtanHey/cmuxlayer'

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