scroll_up
Scrolls a webpage up by one viewport height using Chrome Debug MCP Server, enabling precise browser automation and navigation during debugging sessions.
Instructions
向上滚动页面一个视口高度
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/browserSession.ts:516-520 (handler)The primary handler function for the 'scroll_up' tool. It invokes the doAction wrapper and calls the scrollPage helper with direction 'up' to scroll the page upward by one viewport height.async scrollUp(): Promise<BrowserActionResult> { return this.doAction(async (page) => { await this.scrollPage(page, "up"); }); }
- src/index.ts:118-125 (schema)The tool schema definition for 'scroll_up', specifying the name, description, and an empty input schema (no parameters required).{ name: "scroll_up", description: "向上滚动页面一个视口高度", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:207-209 (registration)Tool registration/dispatch in the CallToolRequestSchema handler switch statement, which calls browserSession.scrollUp().case "scroll_up": result = await this.browserSession.scrollUp(); break;
- src/browserSession.ts:490-502 (helper)Supporting helper function that implements the actual scrolling logic using window.scrollBy, 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); }