Skip to main content
Glama

measure_text

Verify text fits within container constraints by measuring height, line count, overflow, and breakpoints for responsive design.

Instructions

Predict text layout — height, line count, overflow, breakpoint behavior — via Node canvas. No browser, Figma, or AI needed.

Returns: { height, lineCount, lines[] }; plus { overflow } when containerHeight is given; plus { breakpoints: { mobile, tablet, desktop } } when checkBreakpoints=true. Never throws (0 height / 1 line for unparseable fonts). Use to verify labels or body copy fit fixed containers or maxLines constraints before generating designs or code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fontNoCSS font shorthand string used for measurement (e.g. '16px Inter', 'bold 14px sans-serif', '500 13px/1.4 system-ui'). Use the same font as your target UI for accurate results.16px sans-serif
textYesThe text content to measure. Include all characters including newlines if the source content has them.
maxWidthYesMaximum container width in pixels for line wrapping calculations.
lineHeightNoLine height in pixels. Defaults to fontSize × 1.5 if omitted. Provide this to match your Tailwind leading-* or Figma line height setting.
containerHeightNoIf provided, checks whether the measured text fits within this height (in pixels) and reports overflow. Omit if you only need dimensions.
checkBreakpointsNoIf true, also measures text at mobile (375px), tablet (768px), and desktop (1280px) widths in addition to maxWidth. Useful for responsive overflow detection.
Behavior5/5

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

With no annotations provided, the description fully discloses behavioral traits: never throws, returns 0 height/1 line for unparseable fonts, and details conditional return fields (overflow, breakpoints). It honestly sets expectations.

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?

Two efficient paragraphs: first explains function and returns, second gives use case. No wasted words; every sentence adds value.

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

Completeness5/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 fully explains return values and conditions. Covers behavior, usage, and parameter hints. Complete for a simple prediction tool.

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 baseline is 3. The description adds some context (e.g., use same font as target UI) but mostly repeats schema info. Does not significantly extend understanding beyond schema.

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 verb 'predict' and the resource 'text layout', and distinguishes itself from sibling tools by focusing on pure text measurement without browser, Figma, or AI dependencies.

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?

Explicitly states when to use ('to verify labels or body copy fit fixed containers or maxLines constraints before generating designs or code'), but does not mention when not to use or explicitly compare to alternatives. Implicit differentiation is clear given no sibling does the same.

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/sarveshsea/memi'

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