Skip to main content
Glama

measure_spacing

Read-onlyIdempotent

Measures the gap, overlap, and distance between two elements in CSS pixels, factoring their margins and paddings from the current layout. Use it to verify spacing without altering the page.

Instructions

Measure the gap, overlap and distance in CSS pixels between two elements, with their margins and paddings. Read-only. Values come from the current layout, so zoom and viewport size change them: viewport_resize({zoom:1}) and a fixed viewport_resize make results comparable across runs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tab_idNoTarget tab; omitted = last tab navigated in this session, else the active one
selector1YesFirst element; distances are measured from its box
selector2YesSecond element; ">>>" pierces shadow DOM

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.10.0
    • addedInput schema / properties / selector1 / description
      Added value: +"First element; distances are measured from its box"
    • addedInput schema / properties / selector2 / description
      Added value: +"Second element; \">>>\" pierces shadow DOM"
    • addedInput schema / properties / tab_id / description
      Added value: +"Target tab; omitted = last tab navigated in this session, else the active one"
  2. First observedv1.8.0

TDQS

A4.4/5.0
Behavior4/5

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

The description states 'Read-only' and explains that values depend on the current layout, zoom, and viewport size, which is important behavioral context. The annotations (readOnlyHint, destructiveHint false) align perfectly. It does not mention potential errors or edge cases, but the most critical behavioral traits are disclosed.

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

Conciseness4/5

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

The description is slightly longer than strictly necessary, containing about 40 words, but every sentence contributes valuable information: metrics, units, read‑only nature, layout dependence, and normalization advice. The structure is clear and front‑loaded with the core purpose.

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

Completeness4/5

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

Without an output schema, the description implies that the tool returns numeric values for gap, overlap, and distance, but it does not explicitly describe the return format or whether additional data (e.g., margins) is included. Given the tool's simplicity, the essential context is present, though a brief note about the exact return shape would make it fully complete.

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

Parameters5/5

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

Every parameter has a meaningful description: `tab_id` explains its fallback behavior, `selector1` and `selector2` both clarify how distances are measured from their boxes and that `>>>` pierces shadow DOM. This adds semantic depth beyond simple name/type information and covers 100% of the parameters.

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

Purpose5/5

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

The description clearly states a specific action (measure), a specific resource (two elements), and the exact metrics (gap, overlap, distance) along with units (CSS pixels). It also includes the relevant scope (margins and paddings) and notes about layout dependence. This leaves no ambiguity about what the tool does.

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

Usage Guidelines4/5

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

The description provides practical guidance for obtaining consistent results by recommending `viewport_resize({zoom:1})` for comparability across runs. While it does not explicitly contrast with alternatives (none of the siblings perform measurements), it effectively communicates how to use the tool correctly in a layout‑dependent context.

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