Skip to main content
Glama

browserbase_stagehand_act

Execute specific browser actions like clicking buttons or typing text to automate web interactions and perform tasks on web pages.

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 handler function that executes the core logic of the 'browserbase_stagehand_act' tool. It retrieves the Stagehand instance from context and calls stagehand.act() with the action and optional variables.
    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,
      };
    }
  • Defines the Zod input schema (ActInputSchema) and the tool schema (actSchema) including the unique name 'browserbase_stagehand_act'.
    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"}}`,
        ),
    });
    
    type ActInput = z.infer<typeof ActInputSchema>;
    
    const actSchema: ToolSchema<typeof ActInputSchema> = {
      name: "browserbase_stagehand_act",
      description: `Perform a single action on the page (e.g., click, type).`,
      inputSchema: ActInputSchema,
    };
  • Registers the actTool (browserbase_stagehand_act) in the TOOLS export array, which collects all tools for use in the MCP server.
    export const TOOLS = [
      ...sessionTools,
      navigateTool,
      actTool,
      extractTool,
      observeTool,
      screenshotTool,
      getUrlTool,
    ];
  • src/index.ts:186-216 (registration)
    Final MCP server registration: loops over TOOLS (including browserbase_stagehand_act) and calls server.tool() with the schema name, description, and a handler that invokes context.run(tool, params).
    const tools: MCPToolsArray = [...TOOLS];
    
    // Register each tool with the Smithery server
    tools.forEach((tool) => {
      if (tool.schema.inputSchema instanceof z.ZodObject) {
        server.tool(
          tool.schema.name,
          tool.schema.description,
          tool.schema.inputSchema.shape,
          async (params: z.infer<typeof tool.schema.inputSchema>) => {
            try {
              const result = await context.run(tool, params);
              return result;
            } catch (error) {
              const errorMessage =
                error instanceof Error ? error.message : String(error);
              process.stderr.write(
                `[Smithery Error] ${new Date().toISOString()} Error running tool ${tool.schema.name}: ${errorMessage}\n`,
              );
              throw new Error(
                `Failed to run tool '${tool.schema.name}': ${errorMessage}`,
              );
            }
          },
        );
      } else {
        console.warn(
          `Tool "${tool.schema.name}" has an input schema that is not a ZodObject. Schema type: ${tool.schema.inputSchema.constructor.name}`,
        );
      }
    });
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. While 'Perform a single action' implies a write/mutation operation, it doesn't specify whether this requires specific page states, what happens on failure, or any rate limits. The description lacks crucial behavioral context for a tool that modifies page state.

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 with parenthetical examples. Every word earns its place, and the core purpose is front-loaded 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 tool that performs page actions (likely mutations) with no annotations and no output schema, the description is insufficient. It doesn't explain what constitutes a valid action, what the tool returns, error conditions, or how it relates to other browser automation tools. The context signals indicate complexity (nested objects) that isn't addressed.

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?

The description adds no parameter information beyond what's already in the schema, which has 100% coverage. The schema descriptions thoroughly explain both 'action' and 'variables' parameters, including usage examples and constraints. The description doesn't compensate with additional semantic context, so baseline 3 is appropriate.

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 as 'Perform a single action on the page' with examples (click, type), which is a specific verb+resource combination. However, it doesn't explicitly distinguish this from sibling tools like browserbase_stagehand_extract or browserbase_stagehand_observe, which likely involve different types of page interactions.

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's no mention of when this tool is appropriate compared to other stagehand tools or browserbase_screenshot, nor any prerequisites or exclusions for its use.

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/kolbertistvan2/stagehand-mcp-server'

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