Skip to main content
Glama

new_page

Load a specified URL in a new Chrome browser page for automation, debugging, or testing purposes using Chrome DevTools.

Instructions

Creates a new page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to load in a new page.
timeoutNoMaximum wait time in milliseconds. If set to 0, the default timeout will be used.

Implementation Reference

  • The handler function for the 'new_page' tool. It creates a new page using context.newPage(), navigates to the provided URL with optional timeout, waits for post-navigation events, and includes updated pages in the response.
    handler: async (request, response, context) => { const page = await context.newPage(); await context.waitForEventsAfterAction(async () => { await page.goto(request.params.url, { timeout: request.params.timeout, }); }); response.setIncludePages(true); },
  • The input schema for the 'new_page' tool, defining the required 'url' parameter and optional 'timeout' from timeoutSchema.
    schema: { url: z.string().describe('URL to load in a new page.'), ...timeoutSchema, },
  • src/main.ts:307-320 (registration)
    Global registration of all tools into the MCP server, including the new_page tool via pagesTools module.
    const tools = [ ...Object.values(consoleTools), ...Object.values(emulationTools), ...Object.values(inputTools), ...Object.values(networkTools), ...Object.values(pagesTools), ...Object.values(performanceTools), ...Object.values(screenshotTools), ...Object.values(scriptTools), ...Object.values(snapshotTools), ]; for (const tool of tools) { registerTool(tool as unknown as ToolDefinition); }
  • The McpContext.newPage() helper method called by the tool handler. Creates a new browser page, updates the pages snapshot, sets it as selected, adds collectors, and returns the page.
    async newPage(): Promise<Page> { const page = await this.browser.newPage(); const pages = await this.createPagesSnapshot(); this.setSelectedPageIdx(pages.indexOf(page)); this.#networkCollector.addPage(page); this.#consoleCollector.addPage(page); return page; }

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/SHAY5555-gif/chrome-devtools-mcp'

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