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();
      });
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, and openWorldHint=true, covering safety and scope. The description adds minimal behavioral context beyond this, not explaining what 'close' entails (e.g., whether it terminates a session or just a tab) or any side effects, but doesn't contradict annotations.

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, front-loaded sentence that directly conveys the action without any wasted words, making it efficient and easy to parse.

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 the tool's simplicity (0 parameters, no output schema) and annotations covering key behavioral traits, the description is minimally adequate. However, it lacks details on what 'close' means operationally (e.g., closes current tab vs. entire browser) and how it interacts with siblings, leaving some contextual gaps.

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?

With 0 parameters and 100% schema coverage, the baseline is 4 as no parameter documentation is needed. The description doesn't add parameter details, which is appropriate given the empty schema.

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 page' clearly states the action (close) and target (the page), which is specific and unambiguous. However, it doesn't differentiate from sibling 'browser_tab_close' which might have similar functionality, preventing a perfect score.

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 like 'browser_tab_close' or when not to use it (e.g., if no page is open). It lacks context about prerequisites or exclusions, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.