Skip to main content
Glama
MesuterPikin

Browserbase MCP Server

by MesuterPikin

browserbase_stagehand_act

Execute specific web page actions like clicking buttons or typing text through browser automation commands.

Instructions

Perform a single action on the page (e.g., click, type).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe action to perform. Should be as atomic and specific as possible, i.e. 'Click the sign in button' or 'Type 'hello' into the search input'.
variablesNoVariables used in the action template. ONLY use variables if you're dealing with sensitive data or dynamic content. When using variables, you MUST have the variable key in the action template. ie: {"action": "Fill in the password", "variables": {"password": "123456"}}

Implementation Reference

  • The main handler function for the 'browserbase_stagehand_act' tool. It retrieves the stagehand from context and executes the act action with provided parameters.
    async function handleAct(
      context: Context,
      params: ActInput,
    ): Promise<ToolResult> {
      const action = async (): Promise<ToolActionResult> => {
        try {
          const stagehand = await context.getStagehand();
    
          await stagehand.act(params.action, {
            variables: params.variables,
          });
    
          return {
            content: [
              {
                type: "text",
                text: `Action performed: ${params.action}`,
              },
            ],
          };
        } catch (error) {
          const errorMsg = error instanceof Error ? error.message : String(error);
          throw new Error(`Failed to perform action: ${errorMsg}`);
        }
      };
    
      return {
        action,
        waitForNetwork: false,
      };
    }
  • The schema definition for the tool, including name, description, and input schema reference.
    const actSchema: ToolSchema<typeof ActInputSchema> = {
      name: "browserbase_stagehand_act",
      description: `Perform a single action on the page (e.g., click, type).`,
      inputSchema: ActInputSchema,
    };
  • The Zod input schema defining the expected parameters: action (string) and optional variables (object).
    const ActInputSchema = z.object({
      action: z.string().describe(
        `The action to perform. Should be as atomic and specific as possible,
          i.e. 'Click the sign in button' or 'Type 'hello' into the search input'.`,
      ),
      variables: z
        .object({})
        .optional()
        .describe(
          `Variables used in the action template. ONLY use variables if you're dealing
          with sensitive data or dynamic content. When using variables, you MUST have the variable
          key in the action template. ie: {"action": "Fill in the password", "variables": {"password": "123456"}}`,
        ),
    });
  • src/tools/act.ts:68-74 (registration)
    The tool object that combines the schema and handler, exported for registration in the MCP server.
    const actTool: Tool<typeof ActInputSchema> = {
      capability: "core",
      schema: actSchema,
      handle: handleAct,
    };
    
    export default actTool;
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. It mentions performing actions but omits critical details: whether this requires an active session, what happens on failure (e.g., if element not found), side effects, or error handling. This is inadequate for a tool that likely interacts with a live browser.

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 that front-loads the core purpose with illustrative examples. Every word earns its place, and there's no redundancy or fluff.

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?

Given the complexity of browser automation (no annotations, no output schema), the description is insufficient. It doesn't cover session dependencies, error behavior, or result formats, leaving significant gaps for an agent to use this tool safely and effectively.

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 fully documents both parameters. The description adds no additional meaning about parameters beyond implying they're used for actions like 'click' or 'type'. This meets the baseline for high schema coverage but doesn't enhance understanding.

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 verb ('perform') and resource ('single action on the page'), with examples ('click, type') that illustrate the scope. It distinguishes this from sibling tools like 'screenshot' or 'navigate' by focusing on atomic page interactions, though it doesn't explicitly name alternatives.

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

Usage Guidelines3/5

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

The description implies usage for atomic page actions, but provides no explicit guidance on when to use this versus alternatives like 'stagehand_agent' or 'stagehand_extract'. The context of 'single action' suggests it's for basic interactions, but lacks clear boundaries or prerequisites.

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/MesuterPikin/mcp-server-browserbase'

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