Skip to main content
Glama

browser_wait_for

Pauses browser automation until specific conditions are met, such as waiting for text to appear or disappear, or for a set duration to pass.

Instructions

Wait for condition

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeNo
textNo
textGoneNo

Implementation Reference

  • index.js:424-432 (registration)
    Registration of the browser_wait_for tool in the MCP server. It delegates the execution to proxyToolCall.
    server.tool('browser_wait_for', 'Wait for condition', {
      time: z.number().optional(),
      text: z.string().optional(),
      textGone: z.string().optional()
    }, async (args) => {
      const check = requireActivePage();
      if (check) return check;
      return proxyToolCall('browser_wait_for', args);
    });
  • The proxyToolCall function acts as a wrapper that forwards tool execution requests to an underlying MCP client instance.
    async function proxyToolCall(toolName, args) {
      log(`[proxyToolCall] ${toolName} with args: ${JSON.stringify(args)}`);
      const { client } = await getOrCreateInstance();
      log(`[proxyToolCall] got client for port ${assignedPort}`);
    
      // Update last used
      if (assignedPort && instances.has(assignedPort)) {
        instances.get(assignedPort).lastUsed = Date.now();
      }
    
      try {
        log(`[proxyToolCall] Calling client.callTool...`);
        const result = await client.callTool({ name: toolName, arguments: args || {} });
        log(`[proxyToolCall] Result type: ${typeof result}`);
        log(`[proxyToolCall] Result: ${JSON.stringify(result).slice(0, 500)}`);
    
        // The SDK returns { content: [...], isError?: boolean }
        // We need to return this same format
        if (result && result.content) {
          return result;
        }
    
        // Fallback: wrap in content array if needed
        return {
          content: [{ type: 'text', text: JSON.stringify(result) }]
        };
      } catch (error) {
        log(`[proxyToolCall] ERROR: ${error.message}\n${error.stack}`);
        return {

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/OMGEverdo/browser-pool-mcp'

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