Skip to main content
Glama

browser_close

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) ];

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