get_page_content
Extract HTML content from the current webpage using Chrome debugging for browser automation and persistent sessions.
Instructions
获取当前页面的HTML内容
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_page_content"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/browserSession.ts:554-574 (handler)The handler function that executes the get_page_content tool logic. It retrieves the HTML content of the current page using Puppeteer's page.content() and returns it in the logs field of BrowserActionResult.
async getPageContent(): Promise<BrowserActionResult> { if (!this.page) { return { success: false, error: "浏览器未启动或页面不存在" }; } try { const content = await this.page.content(); return { success: true, logs: content }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } - src/index.ts:225-227 (registration)Registration/dispatch point in the CallToolRequestSchema handler where the get_page_content tool call is routed to BrowserSession.getPageContent().
case "get_page_content": result = await this.browserSession.getPageContent(); break; - src/index.ts:154-162 (schema)Tool schema definition including name, description, and empty input schema (no parameters required) registered in the ListToolsRequestSchema handler.
{ name: "get_page_content", description: "获取当前页面的HTML内容", inputSchema: { type: "object", properties: {}, }, }, ] as Tool[], - src/index.ts:321-322 (helper)Helper function to generate success message for the get_page_content tool.
case "get_page_content": return "✅ 页面内容获取完成";