Skip to main content
Glama
cloudflare

Cloudflare Playwright MCP

Official
by cloudflare

browser_close

Automatically close web pages during browser automation to manage resources efficiently using Cloudflare Playwright MCP's browser control capabilities.

Instructions

Close the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'browser_close' tool. It closes the current browser context and returns a code snippet simulating 'await page.close()' with flags to disable snapshot and network wait.
    handle: async context => { await context.close(); return { code: [`await page.close()`], captureSnapshot: false, waitForNetwork: false, }; },
  • 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', },
  • Tool registration using defineTool, which defines the 'browser_close' tool with its schema and handler.
    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, }; }, });
  • Export of the tools array including the 'close' (browser_close) tool for registration in the MCP tools system.
    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/cloudflare/playwright-mcp'

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