Skip to main content
Glama

browser_close_instance

Close a specific browser instance to manage resources and end sessions in the Concurrent Browser MCP server.

Instructions

Close the specified browser instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceIdYesInstance ID

Implementation Reference

  • Handler case in executeTools method that handles the browser_close_instance tool by calling BrowserManager.closeInstance
    case 'browser_close_instance':
      return await this.browserManager.closeInstance(args.instanceId);
  • src/tools.ts:69-82 (registration)
    Tool registration in getTools() method, defining name, description, and input schema
    {
      name: 'browser_close_instance',
      description: 'Close the specified browser instance',
      inputSchema: {
        type: 'object',
        properties: {
          instanceId: {
            type: 'string',
            description: 'Instance ID'
          }
        },
        required: ['instanceId']
      }
    },
  • Core implementation in BrowserManager that closes the Playwright browser instance and removes it from the instances map
    async closeInstance(instanceId: string): Promise<ToolResult> {
      try {
        const instance = this.instances.get(instanceId);
        if (!instance) {
          return {
            success: false,
            error: `Instance ${instanceId} not found`
          };
        }
    
        await instance.browser.close();
        this.instances.delete(instanceId);
    
        return {
          success: true,
          data: { instanceId, closed: true },
          instanceId
        };
      } catch (error) {
        return {
          success: false,
          error: `Failed to close instance: ${error instanceof Error ? error.message : error}`
        };
      }
    }

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/sailaoda/concurrent-browser-mcp'

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