Skip to main content
Glama

new_page

Create a new browser page for automation tasks using Playwright MCP server to control web interactions programmatically.

Instructions

Create a new browser page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idYes

Implementation Reference

  • Handler for the 'new_page' tool. Validates the provided page_id, creates a new Playwright page using the browser context, stores it in the global pages dictionary, sets it as the current page, and returns a confirmation 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}")]
  • Registration of the 'new_page' tool in the list_tools handler, including its schema definition which requires 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"],
        },
    ),

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