browser_navigate
Navigate to specified web pages using browser automation to access online content and perform web-based tasks within Windows systems.
Instructions
导航到网页
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | 网页 URL | |
| sessionId | No | 会话 ID(可选) |
Input Schema (JSON Schema)
{
"properties": {
"sessionId": {
"description": "会话 ID(可选)",
"type": "string"
},
"url": {
"description": "网页 URL",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
}
Implementation Reference
- src/tools/browser.js:169-183 (handler)The handler function that executes the browser_navigate tool. Uses Puppeteer to navigate to the given URL, waits for network idle, retrieves page title, and returns success status.async navigate(url, sessionId = 'default') { try { const page = this.pages.get(sessionId); if (!page) { return { success: false, error: '浏览器未启动,请先调用 browser_launch' }; } await page.goto(url, { waitUntil: 'networkidle2' }); const title = await page.title(); return { success: true, url, title, message: '导航成功' }; } catch (error) { return { success: false, error: error.message }; } }
- src/tools/browser.js:38-49 (schema)Schema definition for the browser_navigate tool, specifying input parameters: required 'url' and optional 'sessionId'.{ name: 'browser_navigate', description: '导航到网页', inputSchema: { type: 'object', properties: { url: { type: 'string', description: '网页 URL' }, sessionId: { type: 'string', description: '会话 ID(可选)' }, }, required: ['url'], }, },
- src/tools/browser.js:129-130 (registration)Registration of the browser_navigate handler within the executeTool method's switch statement, delegating to the navigate function.case 'browser_navigate': return await this.navigate(args.url, args.sessionId);
- src/server.js:51-52 (registration)Instantiation of BrowserTools class in the main server, enabling registration of its tools including browser_navigate.browser: new BrowserTools(), };
- src/server.js:23-23 (registration)Import of BrowserTools, prerequisite for tool registration.import { BrowserTools } from './tools/browser.js';