Skip to main content
Glama

browser_scroll_to_coordinates

Scroll the browser viewport to specific X and Y coordinates for precise positioning during web automation and testing.

Instructions

Scroll to specific coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate

Implementation Reference

  • Registration of the 'browser_scroll_to_coordinates' tool using McpServer.tool(), including schema and inline handler function that calls ActionService.scrollToCoordinates.
      'browser_scroll_to_coordinates',
      'Scroll to specific coordinates',
      {
        x: z.number().describe('X coordinate'),
        y: z.number().describe('Y coordinate'),
      },
      async ({ x, y }) => {
        try {
          const driver = stateManager.getDriver();
          const actionService = new ActionService(driver);
          await actionService.scrollToCoordinates(x, y);
          return {
            content: [{ type: 'text', text: `Scrolled to coordinates (${x}, ${y})` }],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error scrolling to coordinates: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • The core handler logic delegated from the tool handler: executes JavaScript to scroll the window to the specified (x, y) coordinates using Selenium WebDriver.
    async scrollToCoordinates(x: number, y: number): Promise<void> {
      await this.driver.executeScript(`window.scrollTo(${x}, ${y});`);
    }
  • Helper method in ActionService that implements the scrolling by injecting JavaScript `window.scrollTo(x, y)`.
    async scrollToCoordinates(x: number, y: number): Promise<void> {
      await this.driver.executeScript(`window.scrollTo(${x}, ${y});`);
    }
  • Input schema using Zod: requires x and y as numbers with descriptions.
    {
      x: z.number().describe('X coordinate'),
      y: z.number().describe('Y coordinate'),
    },
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action without disclosing behavioral traits. It doesn't mention side effects (e.g., page reloads), error conditions (e.g., invalid coordinates), or performance aspects (e.g., smooth vs. instant scrolling). 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, efficient sentence with zero wasted words, front-loading the core action. It's appropriately sized for a simple tool, making it easy 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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It lacks behavioral context (e.g., what happens on success/failure), doesn't explain the return values, and offers minimal guidance despite the tool's potential complexity in a browser 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 parameter descriptions for 'x' and 'y'. The description adds no additional meaning beyond the schema, such as coordinate origin (e.g., top-left corner) or units (e.g., pixels). Baseline 3 is appropriate as the schema handles parameter documentation 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 'Scroll to specific coordinates' clearly states the action (scroll) and target (specific coordinates), which distinguishes it from siblings like 'browser_scroll_by_pixels' or 'browser_scroll_to_element'. However, it doesn't explicitly mention the browser context or differentiate from all scrolling alternatives, keeping it at 4 rather than 5.

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 like 'browser_scroll_by_pixels' (relative scrolling) or 'browser_scroll_to_element' (target-based scrolling). It lacks context about prerequisites (e.g., needing an open browser) or exclusions, offering minimal usage direction.

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