Skip to main content
Glama

check_scrollability

Determine if a web page is scrollable in a specified direction (vertical, horizontal, or both) using the MCP Browser Server to automate web interaction and analysis.

Instructions

Check if the page is scrollable in the specified direction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionNoDirection to check for scrollabilityboth

Implementation Reference

  • Handler for 'check_scrollability' tool: evaluates page scroll dimensions and viewport to determine vertical/horizontal scrollability, current position, and possible scroll directions. Returns formatted text response.
              case 'check_scrollability': {
                if (!currentPage) {
                  throw new Error('No browser page available. Launch a browser first.');
                }
    
                const params = CheckScrollabilitySchema.parse(args);
                const { direction } = params;
    
                // Check scrollability with proper typing
                const scrollInfo = await currentPage.evaluate((dir) => {
                  const documentHeight = Math.max(
                    document.body.scrollHeight,
                    document.body.offsetHeight,
                    document.documentElement.clientHeight,
                    document.documentElement.scrollHeight,
                    document.documentElement.offsetHeight
                  );
                  
                  const documentWidth = Math.max(
                    document.body.scrollWidth,
                    document.body.offsetWidth,
                    document.documentElement.clientWidth,
                    document.documentElement.scrollWidth,
                    document.documentElement.offsetWidth
                  );
                  
                  const viewportHeight = window.innerHeight;
                  const viewportWidth = window.innerWidth;
                  
                  const verticalScrollable = documentHeight > viewportHeight;
                  const horizontalScrollable = documentWidth > viewportWidth;
                  
                  const currentScrollY = window.scrollY;
                  const currentScrollX = window.scrollX;
                  const maxScrollY = Math.max(0, documentHeight - viewportHeight);
                  const maxScrollX = Math.max(0, documentWidth - viewportWidth);
                  
                  const verticalInfo = {
                    scrollable: verticalScrollable,
                    currentPosition: currentScrollY,
                    maxScroll: maxScrollY,
                    canScrollDown: currentScrollY < maxScrollY,
                    canScrollUp: currentScrollY > 0
                  };
                  
                  const horizontalInfo = {
                    scrollable: horizontalScrollable,
                    currentPosition: currentScrollX,
                    maxScroll: maxScrollX,
                    canScrollRight: currentScrollX < maxScrollX,
                    canScrollLeft: currentScrollX > 0
                  };
                  
                  return {
                    direction: dir,
                    vertical: verticalInfo,
                    horizontal: horizontalInfo,
                    anyScrollable: verticalScrollable || horizontalScrollable
                  };
                }, direction);
    
                // Format the response message based on direction
                let message = '';
                
                if (direction === 'both') {
                  const v = scrollInfo.vertical;
                  const h = scrollInfo.horizontal;
                  message = `Page scrollability status:
    Vertical: ${v.scrollable ? 'Scrollable' : 'Not scrollable'}${v.scrollable ? ` (${v.currentPosition}/${v.maxScroll})` : ''}
    Horizontal: ${h.scrollable ? 'Scrollable' : 'Not scrollable'}${h.scrollable ? ` (${h.currentPosition}/${h.maxScroll})` : ''}
    Overall: ${scrollInfo.anyScrollable ? 'Page is scrollable' : 'Page is not scrollable'}`;
                } else if (direction === 'vertical') {
                  const v = scrollInfo.vertical;
                  message = `Vertical scrolling: ${v.scrollable ? 'Available' : 'Not available'}`;
                  if (v.scrollable) {
                    message += `\nPosition: ${v.currentPosition}/${v.maxScroll}`;
                    message += `\nCan scroll up: ${v.canScrollUp}`;
                    message += `\nCan scroll down: ${v.canScrollDown}`;
                  }
                } else {
                  const h = scrollInfo.horizontal;
                  message = `Horizontal scrolling: ${h.scrollable ? 'Available' : 'Not available'}`;
                  if (h.scrollable) {
                    message += `\nPosition: ${h.currentPosition}/${h.maxScroll}`;
                    message += `\nCan scroll left: ${h.canScrollLeft}`;
                    message += `\nCan scroll right: ${h.canScrollRight}`;
                  }
                }
    
                return {
                  content: [
                    {
                      type: 'text',
                      text: message
                    }
                  ]
                };
              }
  • Zod schema defining input for check_scrollability: optional direction ('vertical', 'horizontal', 'both').
    const CheckScrollabilitySchema = z.object({
      direction: z.enum(['vertical', 'horizontal', 'both']).default('both')
    });
  • src/index.ts:387-400 (registration)
    Tool registration in ListTools response: defines name, description, and inputSchema for check_scrollability.
    {
      name: 'check_scrollability',
      description: 'Check if the page is scrollable in the specified direction',
      inputSchema: {
        type: 'object',
        properties: {
          direction: {
            type: 'string',
            enum: ['vertical', 'horizontal', 'both'],
            default: 'both',
            description: 'Direction to check for scrollability'
          }
        }
      }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool checks scrollability but doesn't explain what 'scrollable' means (e.g., based on content overflow, CSS properties), how it performs the check (e.g., via JavaScript evaluation), or what the output might be (e.g., boolean, details). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 function without unnecessary words. It's front-loaded with the core action ('Check if the page is scrollable'), making it easy to parse. Every part of the sentence contributes to understanding, earning its place efficiently.

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 tool's moderate complexity (checking scrollability involves page state) and lack of annotations and output schema, the description is incomplete. It doesn't cover what the tool returns (e.g., success/failure, scroll dimensions), how it interacts with the page (e.g., requires a loaded page), or potential errors. For a tool with no structured output, more descriptive context is needed.

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?

The input schema has 100% description coverage, with the 'direction' parameter well-documented via enum and description. The description adds minimal value beyond the schema by implying the parameter's purpose ('in the specified direction'), but it doesn't provide additional context like default behavior implications or edge cases. Baseline 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose: 'Check if the page is scrollable in the specified direction.' It specifies the verb ('check') and resource ('page'), making the action explicit. However, it doesn't distinguish this tool from siblings like 'scroll' or 'get_page_info', which might also relate to page navigation or properties, leaving room for ambiguity in sibling differentiation.

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. It doesn't mention prerequisites (e.g., needing an active browser session), exclusions, or compare it to siblings like 'scroll' (for scrolling) or 'get_page_info' (which might include scroll info). Without such context, an agent must infer usage from the tool name alone.

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