Skip to main content
Glama
Angeluis001

Playwright MCP

by Angeluis001

browser_close

Destructive

Close the current browser page to manage resources and end automation sessions. Use this Playwright MCP tool to stop web interactions and clean up browser instances.

Instructions

Close the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'browser_close' tool. Closes the browser context using context.close() and returns specific code snippet and flags for execution.
    handle: async context => {
      await context.close();
      return {
        code: [`await page.close()`],
        captureSnapshot: false,
        waitForNetwork: false,
      };
    },
  • Schema definition for the 'browser_close' tool, including 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',
    },
  • Full definition of the 'browser_close' tool using defineTool, which includes schema and handler. This tool object is later exported.
    const close = defineTool({
      capability: 'core',
    
      schema: {
        name: 'browser_close',
        title: 'Close browser',
        description: 'Close the page',
        inputSchema: z.object({}),
        type: 'readOnly',
      },
    
      handle: async context => {
        await context.close();
        return {
          code: [`await page.close()`],
          captureSnapshot: false,
          waitForNetwork: false,
        };
      },
    });
  • Registration of the 'browser_close' tool (as 'close') in the exported array of common tools.
    export default (captureSnapshot: boolean) => [
      close,
      resize(captureSnapshot)
    ];
Behavior4/5

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

Annotations indicate destructiveHint=true and readOnlyHint=false, confirming this is a destructive write operation. The description adds context by specifying 'the page' as the target, which clarifies scope beyond annotations. It doesn't contradict annotations, and while it doesn't detail side effects (e.g., data loss, confirmation dialogs), it provides useful behavioral context that annotations alone don't cover.

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—just three words—and front-loaded with the core action. Every word earns its place by directly conveying the tool's function without any fluff or redundancy, making it highly 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 complexity (simple destructive action), annotations cover safety (destructive) and mutability (not read-only), and there are 0 parameters, the description is minimally adequate. However, it lacks details on output (no schema provided) and could benefit from more context on what 'page' refers to (e.g., current tab vs. browser window). It meets basic needs but has gaps in completeness.

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% coverage, so no parameter documentation is needed. The description doesn't add parameter details, but this is appropriate given the lack of parameters. Baseline is 4 for 0 parameters, as the description doesn't need to compensate for any gaps.

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' clearly states the action (close) and target (page), but it's somewhat vague about scope—does it close the current tab, the entire browser, or something else? It distinguishes from siblings like browser_navigate or browser_tabs by focusing on termination rather than navigation or inspection, but lacks specificity on what exactly is being closed.

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 explicit guidance on when to use this tool versus alternatives is provided. The description doesn't mention prerequisites (e.g., needing an open page), exclusions, or comparisons to siblings like browser_tabs (which might list tabs) or browser_navigate_back (for navigation). Usage is implied by the action alone, with no contextual advice.

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

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