Skip to main content
Glama

browser_scroll_by_pixels

Control browser scrolling precisely by specifying exact pixel amounts horizontally and vertically for automated web testing and interaction.

Instructions

Scroll by a specific number of pixels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesNumber of pixels to scroll horizontally
yYesNumber of pixels to scroll vertically

Implementation Reference

  • Registers the 'browser_scroll_by_pixels' MCP tool, including input schema (x, y pixels), description, and handler function that uses ActionService to perform the scroll.
    server.tool(
      'browser_scroll_by_pixels',
      'Scroll by a specific number of pixels',
      {
        x: z.number().describe('Number of pixels to scroll horizontally'),
        y: z.number().describe('Number of pixels to scroll vertically'),
      },
      async ({ x, y }) => {
        try {
          const driver = stateManager.getDriver();
          const actionService = new ActionService(driver);
          await actionService.scrollByPixels(x, y);
          return {
            content: [{ type: 'text', text: `Scrolled by pixels (${x}, ${y})` }],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error scrolling by pixels: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • The MCP tool handler function that executes the scroll by instantiating ActionService and calling scrollByPixels.
    async ({ x, y }) => {
      try {
        const driver = stateManager.getDriver();
        const actionService = new ActionService(driver);
        await actionService.scrollByPixels(x, y);
        return {
          content: [{ type: 'text', text: `Scrolled by pixels (${x}, ${y})` }],
        };
      } catch (e) {
        return {
          content: [
            {
              type: 'text',
              text: `Error scrolling by pixels: ${(e as Error).message}`,
            },
          ],
        };
      }
    }
  • Zod input schema defining parameters x (horizontal pixels) and y (vertical pixels) for the tool.
    {
      x: z.number().describe('Number of pixels to scroll horizontally'),
      y: z.number().describe('Number of pixels to scroll vertically'),
    },
  • Supporting method in ActionService that executes the JavaScript window.scrollBy(x, y) via Selenium WebDriver to perform the actual scrolling.
    async scrollByPixels(x: number, y: number): Promise<void> {
      await this.driver.executeScript(`window.scrollBy(${x}, ${y});`);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action but lacks behavioral details such as whether scrolling is relative to current position or absolute, if it works in all browser contexts, potential side effects, or error conditions. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words. It front-loads the core action ('scroll') and efficiently specifies the mechanism ('by a specific number of pixels'), making it easy to parse and understand immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavior, error handling, and interaction with other browser tools, failing to provide the context needed for safe and effective use in a complex browser automation environment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for 'x' and 'y' parameters. The description adds no additional semantic context beyond implying pixel-based scrolling, which is already covered by the schema. Baseline score of 3 is appropriate as the schema adequately documents parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('scroll') and the mechanism ('by a specific number of pixels'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling scrolling tools like 'browser_scroll_to_bottom' or 'browser_scroll_to_coordinates', which would require a more specific comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling scrolling tools available (e.g., 'browser_scroll_to_bottom', 'browser_scroll_to_coordinates'), there is no indication of preferred contexts, prerequisites, or exclusions, leaving usage ambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pshivapr/selenium-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server