Skip to main content
Glama

scroll

Automate page scrolling in specified directions (up, down, left, right) with customizable pixel counts and smooth or auto behaviors using the MCP Browser Server.

Instructions

Scroll the page in the specified direction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
behaviorNoScrolling behaviorauto
directionNoDirection to scrolldown
pixelsNoNumber of pixels to scroll (optional)

Implementation Reference

  • The main handler for the 'scroll' tool. Parses input using ScrollSchema, calculates scroll distance (default 100px), executes scrolling via page.evaluate using window.scrollTo based on direction.
    case 'scroll': {
      if (!currentPage) {
        throw new Error('No browser page available. Launch a browser first.');
      }
    
      const params = ScrollSchema.parse(args);
      const { direction, pixels, behavior } = params;
    
      // Determine scroll distance
      const scrollDistance = pixels !== undefined ? pixels : 100;
    
      // Scroll the page
      await currentPage.evaluate(({ direction, scrollDistance, behavior }) => {
        let newX = window.scrollX;
        let newY = window.scrollY;
        
        switch (direction) {
          case 'down':
            newY += scrollDistance;
            break;
          case 'up':
            newY -= scrollDistance;
            break;
          case 'right':
            newX += scrollDistance;
            break;
          case 'left':
            newX -= scrollDistance;
            break;
        }
        
        window.scrollTo({
          top: newY,
          left: newX,
          behavior: behavior
        });
      }, { direction, scrollDistance, behavior });
    
      return {
        content: [
          {
            type: 'text',
            text: `Scrolled ${direction} by ${scrollDistance} pixels`
          }
        ]
      };
    }
  • Zod schema for validating 'scroll' tool inputs: direction (up/down/left/right, default 'down'), optional pixels, behavior (auto/smooth, default 'auto').
    const ScrollSchema = z.object({
      direction: z.enum(['up', 'down', 'left', 'right']).default('down'),
      pixels: z.number().optional(),
      behavior: z.enum(['auto', 'smooth']).default('auto')
    });
  • src/index.ts:363-386 (registration)
    Tool registration in the ListTools response, defining name 'scroll', description, and inputSchema matching ScrollSchema.
      name: 'scroll',
      description: 'Scroll the page in the specified direction',
      inputSchema: {
        type: 'object',
        properties: {
          direction: {
            type: 'string',
            enum: ['up', 'down', 'left', 'right'],
            default: 'down',
            description: 'Direction to scroll'
          },
          pixels: {
            type: 'number',
            description: 'Number of pixels to scroll (optional)'
          },
          behavior: {
            type: 'string',
            enum: ['auto', 'smooth'],
            default: 'auto',
            description: 'Scrolling behavior'
          }
        }
      }
    },
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 mentions scrolling direction but lacks details on behavioral traits such as whether it requires a loaded page, if it's synchronous/asynchronous, error handling for unscrollable pages, or default scroll amounts. This leaves significant gaps for an agent to understand how to use it effectively.

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, clear sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and efficient, making it easy for an agent to parse quickly.

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?

Given the complexity of a scrolling action with no annotations and no output schema, the description is incomplete. It doesn't cover key aspects like what happens after scrolling (e.g., does it wait for page updates?), error conditions, or interaction with sibling tools, leaving the agent with insufficient context for reliable use.

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%, so the schema fully documents parameters like 'behavior', 'direction', and 'pixels'. The description adds no additional meaning beyond implying directionality, which is already covered. Baseline 3 is appropriate as the schema handles parameter semantics adequately.

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 target ('the page'), with the direction specified as a parameter. It's specific about what the tool does, though it doesn't explicitly differentiate from sibling tools like 'check_scrollability' or 'navigate' beyond the core action.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention when scrolling is appropriate compared to navigation or checking scrollability, nor does it address prerequisites like needing an active browser session.

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

Related 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/Wladastic/mcp-browser-server'

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