new_page
Open a new browser tab and navigate to a specified URL for testing, scraping, or browser automation tasks. Returns the tab index for further interaction.
Instructions
Open a new tab and navigate it to the provided URL. Returns the new tab index in the response.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to load in a new page |
Implementation Reference
- src/tools/pages.ts:122-139 (handler)The main handler function that implements the 'new_page' tool logic: validates the URL argument, obtains Firefox instance, calls createNewPage, and returns success response with new tab index.export async function handleNewPage(args: unknown): Promise<McpToolResponse> { try { const { url } = args as { url: string }; if (!url || typeof url !== 'string') { throw new Error('url parameter is required and must be a string'); } const { getFirefox } = await import('../index.js'); const firefox = await getFirefox(); const newIdx = await firefox.createNewPage(url); return successResponse(`✅ new page [${newIdx}] → ${url}`); } catch (error) { return errorResponse(error as Error); } }
- src/tools/pages.ts:18-31 (schema)The schema definition for the 'new_page' tool, specifying name, description, and inputSchema requiring a 'url' string.export const newPageTool = { name: 'new_page', description: 'Open new tab at URL. Returns tab index.', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'Target URL', }, }, required: ['url'], }, };
- src/index.ts:107-112 (registration)Registration of page tools handlers including 'new_page' in the central toolHandlers Map used by the MCP server.// Pages ['list_pages', tools.handleListPages], ['new_page', tools.handleNewPage], ['navigate_page', tools.handleNavigatePage], ['select_page', tools.handleSelectPage], ['close_page', tools.handleClosePage],
- src/index.ts:151-156 (registration)Inclusion of newPageTool schema in the allTools array provided to the MCP server via listTools.// Pages tools.listPagesTool, tools.newPageTool, tools.navigatePageTool, tools.selectPageTool, tools.closePageTool,