Skip to main content
Glama

browser_close

Close the current browser page in Playwright MCP to end web automation sessions and manage browser resources.

Instructions

Close the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handle function for the 'browser_close' tool. It closes the current browser context using context.close() and returns a code snippet indicating page.close() without capturing a snapshot or waiting for network events.
    handle: async context => { await context.close(); return { code: [`await page.close()`], captureSnapshot: false, waitForNetwork: false, }; },
  • Schema definition for the 'browser_close' tool, specifying its name, title, description, empty input schema (no parameters), 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)
    Registration of browser_close tool as part of snapshotTools array via spreading common(true), which includes the close tool.
    export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...video, ...wait(true), ];
  • src/tools.ts:54-69 (registration)
    Registration of browser_close tool as part of visionTools array via spreading common(false), which includes the close tool.
    export const visionTools: Tool<any>[] = [ ...common(false), ...console, ...dialogs(false), ...files(false), ...install, ...keyboard(false), ...navigate(false), ...network, ...pdf, ...tabs(false), ...testing, ...video, ...vision, ...wait(false), ];
  • Final registration where snapshotTools or visionTools (containing browser_close) are selected as allTools, filtered, and passed to the Context used by the MCP server.
    const allTools = config.vision ? visionTools : snapshotTools; const tools = allTools.filter(tool => !config.capabilities || tool.capability === 'core' || config.capabilities.includes(tool.capability)); validateConfig(config); const context = new Context(tools, config, browserContextFactory);

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

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