Skip to main content
Glama
epi-builder
by epi-builder

browser_close

Close the active browser instance to free system resources and complete automation sessions in Playwright MCP Server.

Instructions

Close the browser

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that closes the Playwright browser instance and resets the state, returning a confirmation message.
    private async handleClose() {
      if (this.browserState.browser) {
        await this.browserState.browser.close();
        this.browserState.browser = null;
        this.browserState.page = null;
      }
      
      return {
        content: [
          {
            type: 'text',
            text: 'Browser closed',
          },
        ],
      };
    }
  • The schema definition for the browser_close tool, including name, description, and empty input schema (no parameters required).
    {
      name: 'browser_close',
      description: 'Close the browser',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • src/server.ts:172-173 (registration)
    The switch case that registers and dispatches the browser_close tool call to its handler function.
    case 'browser_close':
      return await this.handleClose();
  • src/server.ts:57-149 (registration)
    The ListToolsRequestHandler that registers the browser_close tool by including it in the list of available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: 'browser_navigate',
            description: 'Navigate to a URL',
            inputSchema: {
              type: 'object',
              properties: {
                url: {
                  type: 'string',
                  description: 'The URL to navigate to',
                },
              },
              required: ['url'],
            },
          },
          {
            name: 'browser_snapshot',
            description: 'Capture accessibility snapshot of the current page',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
          {
            name: 'browser_click',
            description: 'Click on an element',
            inputSchema: {
              type: 'object',
              properties: {
                element: {
                  type: 'string',
                  description: 'Human-readable element description',
                },
                ref: {
                  type: 'string',
                  description: 'Exact target element reference from page snapshot',
                },
              },
              required: ['element', 'ref'],
            },
          },
          {
            name: 'browser_type',
            description: 'Type text into an element',
            inputSchema: {
              type: 'object',
              properties: {
                element: {
                  type: 'string',
                  description: 'Human-readable element description',
                },
                ref: {
                  type: 'string',
                  description: 'Exact target element reference from page snapshot',
                },
                text: {
                  type: 'string',
                  description: 'Text to type into the element',
                },
              },
              required: ['element', 'ref', 'text'],
            },
          },
          {
            name: 'browser_take_screenshot',
            description: 'Take a screenshot of the current page',
            inputSchema: {
              type: 'object',
              properties: {
                filename: {
                  type: 'string',
                  description: 'File name to save the screenshot to',
                },
                fullPage: {
                  type: 'boolean',
                  description: 'Take screenshot of full page',
                },
              },
            },
          },
          {
            name: 'browser_close',
            description: 'Close the browser',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
        ] as Tool[],
      };
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. 'Close the browser' implies a destructive action, but it doesn't disclose behavioral traits like whether it's reversible, if it requires confirmation, what happens to open tabs, or error conditions. For a mutation tool with zero annotation coverage, this is a significant gap.

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 with zero waste. It's appropriately sized and front-loaded, making it easy to parse. Every word earns its place, and there's no 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?

Given the tool's complexity (a destructive action with no annotations and no output schema), the description is incomplete. It lacks details on behavior, side effects, or return values. For a tool that likely terminates a session, more context is needed to ensure safe and correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%. With no parameters to document, the description doesn't need to add parameter semantics. A baseline of 4 is appropriate as the description is complete for a parameterless tool.

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 'Close the browser' clearly states the action (close) and resource (browser). It distinguishes from siblings like browser_navigate (navigation) and browser_snapshot (capturing). However, it doesn't explicitly differentiate from all siblings (e.g., browser_take_screenshot is also a termination action), so it's not a perfect 5.

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. It doesn't mention prerequisites (e.g., browser must be open), consequences (e.g., all tabs closed), or when to avoid it (e.g., if unsaved work exists). With siblings like browser_navigate and browser_snapshot, context is implied but not explicit.

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/epi-builder/mcp-test'

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