Skip to main content
Glama

measure_element

Measures the rendered pixel geometry and text ink bounds of an element, revealing sub-pixel centering offsets to diagnose visual alignment issues that CSS box model cannot detect.

Instructions

Deterministic rendered-pixel geometry: an element's content box (WxH @x,y) and the true TEXT INK bounding box of its glyphs (canvas measureText extents, not the advance box), plus a sub-pixel centering verdict — how far the ink sits from the content-box center on each axis, with a padding/line-height fix hint. Reach for this when the caller is fussing over VISUAL alignment that the box model can't see: "the × in the close button looks a bit high/off-center", "the icon is not quite centered", one-off pixel offsets. Pass referenceUid/referenceSelector to also get the center delta between two elements. explain_styles tells you which rule set the value; measure_element tells you whether the painted glyph actually lands where you want.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xNoViewport x coordinate (use with y)
yNoViewport y coordinate (use with x)
uidNoElement uid from a prior page_snapshot (e.g. "e17")
selectorNoCSS selector — first match is used
referenceUidNoOptional reference element uid to measure alignment against (its center)
referenceSelectorNoOptional reference element selector to measure alignment against (its center)
Behavior4/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 discloses determinism, returns content box and ink bounding box dimensions, sub-pixel centering, and alignment delta with reference elements. It does not mention error handling or prerequisites, but for a measurement tool this is adequate. Slightly less transparency due to no mention of what happens with invalid inputs.

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 a single dense paragraph but front-loads the core capability. Every sentence adds value, though it could be more structured (e.g., bullet points). No wasted words, but brevity is slightly sacrificed for thoroughness.

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?

Despite no output schema, the description explains what the tool returns (content box dimensions, ink bounding box, centering verdict). It covers both single-element and two-element comparison use cases. Missing details on edge cases (e.g., element not found) but otherwise complete for a measurement tool with 6 parameters.

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

Parameters4/5

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

Schema coverage is 100%, so baseline 3. The description adds value by contextualizing parameters (e.g., 'x,y' as viewport coordinates, 'uid' from prior page_snapshot, 'referenceUid' for alignment delta). It goes beyond schema by explaining how parameters relate to the tool's purpose and behavior.

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 the tool determines rendered-pixel geometry (content box and true text ink bounding box) and sub-pixel centering. It provides concrete examples like 'the × in the close button looks a bit high' and distinguishes from siblings like explain_styles by focusing on visual alignment invisible to the box model.

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

Usage Guidelines5/5

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

Explicitly states when to use: 'when the caller is fussing over VISUAL alignment that the box model can't see' with specific examples. It also explains how to use referenceUid/referenceSelector for comparing two elements, and differentiates from explain_styles by noting the latter tells which rule set the value while measure_element tells if the painted glyph lands correctly.

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/mi60dev/visionaire-engine'

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