scroll_down
Scrolls down a web page by one viewport height to view content below the current screen position during browser automation.
Instructions
向下滚动页面一个视口高度
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": "scroll_down"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/browserSession.ts:507-511 (handler)The main handler function scrollDown that executes the downward scrolling by calling doAction with scrollPage.
async scrollDown(): Promise<BrowserActionResult> { return this.doAction(async (page) => { await this.scrollPage(page, "down"); }); } - src/index.ts:110-117 (schema)Tool schema definition in the listTools response, including name, description, and empty input schema.
{ name: "scroll_down", description: "向下滚动页面一个视口高度", inputSchema: { type: "object", properties: {}, }, }, - src/index.ts:203-205 (registration)Registration and dispatch in the CallToolRequestSchema handler switch statement.
case "scroll_down": result = await this.browserSession.scrollDown(); break; - src/browserSession.ts:490-502 (helper)Helper function scrollPage that performs the actual scrolling logic using page.evaluate and window.scrollBy.
private async scrollPage(page: Page, direction: "up" | "down"): Promise<void> { const { height } = this.getViewport(); const scrollAmount = direction === "down" ? height : -height; await page.evaluate((scrollHeight) => { window.scrollBy({ top: scrollHeight, behavior: "auto", }); }, scrollAmount); await delay(300); }