navigate
Loads a webpage completely by navigating to a specified URL, waiting for the page to fully render before proceeding with debugging tasks.
Instructions
Navega para uma URL específica e carrega a página completamente
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | Timeout em milissegundos (padrão: 30000) | |
| url | Yes | URL completa para navegar (deve incluir http:// ou https://) | |
| waitUntil | No | Condição de espera (padrão: networkidle2) | networkidle2 |
Implementation Reference
- src/browserTools.ts:50-83 (handler)The handleNavigate function that executes the 'navigate' tool: validates args, clears logs/network, navigates to URL with options, gets title and final URL, returns success response.export async function handleNavigate(args: unknown, currentPage: Page): Promise<ToolResponse> { const typedArgs = args as unknown as NavigateArgs; const { url, waitUntil = 'networkidle2', timeout = 30000 } = typedArgs; // Limpar logs e requisições clearConsoleLogs(); clearNetworkRequests(); await currentPage.goto(url, { waitUntil: waitUntil, timeout: timeout, }); const title = await currentPage.title(); const finalUrl = currentPage.url(); return { content: [ { type: 'text', text: JSON.stringify( { success: true, title: title, url: finalUrl, message: `Navegado para ${finalUrl}`, }, null, 2 ), }, ], }; }
- src/types.ts:28-32 (schema)TypeScript interface defining the input arguments for the navigate tool.export interface NavigateArgs { url: string; waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2'; timeout?: number; }
- src/tools.ts:2-26 (registration)Tool registration object in the tools array, including name 'navigate', description, and JSON inputSchema for MCP listing.{ name: 'navigate', description: 'Navega para uma URL específica e carrega a página completamente', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL completa para navegar (deve incluir http:// ou https://)', }, waitUntil: { type: 'string', enum: ['load', 'domcontentloaded', 'networkidle0', 'networkidle2'], description: 'Condição de espera (padrão: networkidle2)', default: 'networkidle2', }, timeout: { type: 'number', description: 'Timeout em milissegundos (padrão: 30000)', default: 30000, }, }, required: ['url'], }, },
- src/index.ts:67-70 (registration)Dispatch case in the MCP CallToolRequestSchema handler that initializes browser page and calls handleNavigate for 'navigate' tool.case 'navigate': { const currentPage = await initBrowser(); return await handleNavigate(args, currentPage); }
- src/index.ts:44-46 (registration)MCP server registration for ListToolsRequestSchema, returning the tools array that includes 'navigate'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });