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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to load in a new page. | |
| timeout | No | Maximum wait time in milliseconds. If set to 0, the default timeout will be used. |
Implementation Reference
- src/tools/pages.ts:88-98 (handler)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); },
- src/tools/pages.ts:84-87 (schema)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); }
- src/McpContext.ts:141-148 (helper)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; }