Skip to main content
Glama
MesuterPikin

Browserbase MCP Server

by MesuterPikin

browserbase_stagehand_observe

Locate interactive web page elements by providing specific visual or functional descriptions, enabling precise identification for subsequent automation actions.

Instructions

Find interactive elements on the page from an instruction; optionally return an action.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instructionYesDetailed instruction for what specific elements or components to observe on the web page. This instruction must be extremely specific and descriptive. For example: 'Find the red login button in the top right corner', 'Locate the search input field with placeholder text', or 'Identify all clickable product cards on the page'. The more specific and detailed your instruction, the better the observation results will be. Avoid generic instructions like 'find buttons' or 'see elements'. Instead, describe the visual characteristics, location, text content, or functionality of the elements you want to observe. This tool is designed to help you identify interactive elements that you can later use with the act tool for performing actions like clicking, typing, or form submission.

Implementation Reference

  • The handleObserve function that executes the tool's logic: retrieves Stagehand from context, performs observation based on the instruction, and returns the observations as JSON string in text content.
    async function handleObserve(
      context: Context,
      params: ObserveInput,
    ): Promise<ToolResult> {
      const action = async (): Promise<ToolActionResult> => {
        try {
          const stagehand = await context.getStagehand();
    
          const observations = await stagehand.observe(params.instruction);
    
          return {
            content: [
              {
                type: "text",
                text: `Observations: ${JSON.stringify(observations)}`,
              },
            ],
          };
        } catch (error) {
          const errorMsg = error instanceof Error ? error.message : String(error);
          throw new Error(`Failed to observe: ${errorMsg}`);
        }
      };
    
      return {
        action,
        waitForNetwork: false,
      };
    }
  • The tool schema defining the name 'browserbase_stagehand_observe', description, and input schema (ObserveInputSchema defined earlier with 'instruction' field).
    const observeSchema: ToolSchema<typeof ObserveInputSchema> = {
      name: "browserbase_stagehand_observe",
      description: `Find interactive elements on the page from an instruction; optionally return an action.`,
      inputSchema: ObserveInputSchema,
    };
  • Defines the complete observeTool object combining schema and handler, exported for use in tools index and MCP server registration.
    const observeTool: Tool<typeof ObserveInputSchema> = {
      capability: "core",
      schema: observeSchema,
      handle: handleObserve,
    };
    
    export default observeTool;
  • Registers the observeTool (imported from ./observe.js) in the TOOLS array used by the MCP server.
    export const TOOLS = [
      ...sessionTools,
      navigateTool,
      actTool,
      extractTool,
      observeTool,
      screenshotTool,
      getUrlTool,
      agentTool,
    ];
  • src/index.ts:168-198 (registration)
    The MCP server loop that registers all tools from TOOLS, including browserbase_stagehand_observe, by calling server.tool with the schema name and a wrapper around context.run.
    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?

No annotations are provided, so the description carries the full burden. It mentions that the tool 'optionally return an action,' which hints at behavioral output, but it doesn't disclose key traits like whether it's read-only or destructive, how it handles errors, or what the 'action' entails (e.g., format, conditions). This leaves significant gaps for a tool interacting with web pages.

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 concise and front-loaded with the core purpose in the first sentence. The second sentence elaborates on the 'optionally return an action' aspect, which is relevant but could be slightly more integrated. Overall, it's efficient with minimal waste, though not perfectly structured.

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 web interaction tools, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., element details, actions), how it handles failures, or prerequisites (e.g., requires an active session). This leaves the agent with insufficient context for reliable 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?

The schema description coverage is 100%, with the parameter 'instruction' fully documented in the schema. The description adds minimal value beyond the schema by reiterating the need for specificity (e.g., 'detailed instruction'), but it doesn't provide additional semantic context or examples not already in the schema. This meets the baseline for high schema coverage.

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: 'Find interactive elements on the page from an instruction; optionally return an action.' This specifies the verb ('find'), resource ('interactive elements'), and scope ('from an instruction'), though it doesn't explicitly differentiate from sibling tools like 'browserbase_stagehand_extract' or 'browserbase_stagehand_act' beyond mentioning the latter. It avoids tautology and is not misleading.

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 by stating it's for finding interactive elements to later use with the 'act' tool, but it doesn't explicitly say when to use this tool versus alternatives like 'browserbase_stagehand_extract' or 'browserbase_screenshot'. It provides some context (e.g., for identifying elements for actions) but lacks clear exclusions or direct comparisons to siblings.

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