Skip to main content
Glama

new_page

Launch a new browser page with a specified ID for automation tasks using Playwright MCP, enabling precise control over browser interactions.

Instructions

Create a new browser page

Input Schema

NameRequiredDescriptionDefault
page_idYes

Input Schema (JSON Schema)

{ "properties": { "page_id": { "type": "string" } }, "required": [ "page_id" ], "type": "object" }

Implementation Reference

  • Handler implementation for the 'new_page' tool within the @server.call_tool() function. Validates the page_id argument, creates a new Playwright BrowserContext page, stores it in the global 'pages' dictionary, sets it as the current page, and returns a success message.
    elif name == "new_page": page_id = arguments.get("page_id") if not page_id: raise ValueError("Page ID is required") if page_id in pages: raise ValueError(f"Page ID '{page_id}' already exists") new_page = await context.new_page() pages[page_id] = new_page current_page_id = page_id return [types.TextContent(type="text", text=f"Created new page with ID: {page_id}")]
  • Schema definition and registration of the 'new_page' tool in the @server.list_tools() response. Specifies the tool name, description, and input schema requiring a 'page_id' string.
    types.Tool( name="new_page", description="Create a new browser page", inputSchema={ "type": "object", "properties": { "page_id": {"type": "string"}, }, "required": ["page_id"], }, ),

Other Tools

Related 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/misanthropic-ai/playwrite-mcp'

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