scroll_up
Scrolls a webpage up by one viewport height in Chrome during debugging sessions, enabling automated navigation without manual interaction.
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_up"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/browserSession.ts:516-520 (handler)The main handler function for the scroll_up tool. It uses doAction to execute the scrollPage helper with 'up' direction on the current page.
async scrollUp(): Promise<BrowserActionResult> { return this.doAction(async (page) => { await this.scrollPage(page, "up"); }); } - src/index.ts:118-125 (schema)Tool schema definition in the list of tools returned by ListToolsRequestSchema handler, specifying name, description, and empty input schema (no parameters required).
{ name: "scroll_up", description: "向上滚动页面一个视口高度", inputSchema: { type: "object", properties: {}, }, }, - src/index.ts:207-209 (registration)Dispatch/registration in the CallToolRequestSchema switch statement, invoking the browserSession.scrollUp() handler.
case "scroll_up": result = await this.browserSession.scrollUp(); break; - src/browserSession.ts:490-502 (helper)Supporting helper function that performs the actual page scrolling by one viewport height in the specified direction, used by both scrollUp and scrollDown.
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); }