Skip to main content
Glama

browser_close

Read-only

Close the current browser page to manage resources and end web interactions when automation tasks are complete.

Instructions

Close the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'browser_close' tool. It closes the browser context, instructs the response to include tabs, and adds a code snippet for closing the page.
    handle: async (context, params, response) => {
      await context.closeBrowserContext();
      response.setIncludeTabs();
      response.addCode(`await page.close()`);
    },
  • The schema definition for the 'browser_close' tool, specifying name, title, description, empty input schema, and readOnly type.
    schema: {
      name: 'browser_close',
      title: 'Close browser',
      description: 'Close the page',
      inputSchema: z.object({}),
      type: 'readOnly',
    },
  • src/tools.ts:36-52 (registration)
    Registers the 'browser_close' tool (via ...common import) into the central allTools array used by the backend.
    export const allTools: Tool<any>[] = [
      ...common,
      ...console,
      ...dialogs,
      ...evaluate,
      ...files,
      ...install,
      ...keyboard,
      ...navigate,
      ...network,
      ...mouse,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs,
      ...wait,
    ];
  • The MCP server backend's tools() method exposes the tool schemas, including 'browser_close', to the MCP protocol.
    tools(): mcpServer.ToolSchema<any>[] {
      return this._tools.map(tool => tool.schema);
  • The implementation of closing the browser context, called by the tool handler via context.closeBrowserContext().
    private async _closeBrowserContextImpl() {
      if (!this._browserContextPromise)
        return;
    
      testDebug('close context');
    
      const promise = this._browserContextPromise;
      this._browserContextPromise = undefined;
    
      await promise.then(async ({ browserContext, close }) => {
        if (this.config.saveTrace)
          await browserContext.tracing.stop();
        await close();
      });
    }
Behavior4/5

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

Annotations indicate readOnlyHint=true, destructiveHint=false, and openWorldHint=true, which already inform the agent that this is a safe, non-destructive operation with open-world assumptions. The description adds minimal behavioral context beyond this, but it doesn't contradict annotations, and the low parameter count reduces the need for extensive disclosure.

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 with 'Close the page', a single sentence that directly states the action. It's front-loaded and wastes no words, making it efficient for an agent to parse, though it may be overly brief for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 0 parameters, no output schema, and annotations covering safety and world assumptions, the description is minimally adequate. However, it lacks details on scope (e.g., current page vs. all pages) and doesn't differentiate from siblings, leaving gaps in contextual understanding for effective tool selection.

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 input schema has 0 parameters with 100% description coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is acceptable here, but it could have clarified implicit aspects like which page is closed, though the baseline for 0 params is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Close the page' states a clear action (close) and resource (page), but it's vague about scope—it doesn't specify whether it closes the current page, a specific page, or the entire browser. It also doesn't distinguish from sibling tools like 'browser_tab_close', which suggests potential overlap without clarification.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'browser_tab_close' and 'browser_navigate_back', the description lacks context on appropriate use cases, prerequisites, or exclusions, leaving the agent to guess based on tool names alone.

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/maywzh/playwright-mcp'

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