Skip to main content
Glama

Measure Text Dimensions

text-measure

Calculate text dimensions for PDF layout planning. Measure width and height based on font, size, and content to ensure proper text fitting and multi-line formatting.

Instructions

Measure text width and height before rendering.

Returns exact dimensions based on font, font size, and text content. Use this to:

  • Calculate text width to set proper container sizes

  • Determine if text will fit in a given space

  • Plan multi-line layouts by specifying width constraint

Width is measured as single-line natural width. Height accounts for text wrapping when width is specified.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYesArray of text items to measure
fontNoFont specification (default: auto). Built-ins: Helvetica, Times-Roman, Courier. Use a path or URL for custom fonts.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
fontYesFont used for measurements
measurementsYes
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by explaining key behaviors: 'Returns exact dimensions', 'Width is measured as single-line natural width', and 'Height accounts for text wrapping when width is specified'. It doesn't mention performance characteristics or error conditions, but covers the core functionality adequately.

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 well-structured and front-loaded with the core purpose. Every sentence earns its place: the opening statement defines the tool, bullet points provide usage guidelines, and the final sentence clarifies measurement behavior. No wasted words.

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?

Given the tool's moderate complexity, 100% schema description coverage, and the presence of an output schema, the description is complete enough. It explains what the tool does, when to use it, and key behavioral aspects without needing to detail return values (handled by output schema).

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 the baseline is 3. The description adds some context about 'font, font size, and text content' and mentions 'width constraint' for multi-line layouts, but doesn't provide additional parameter semantics beyond what's already documented in the 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 tool's purpose with specific verbs ('measure text width and height before rendering') and resources ('text dimensions based on font, font size, and text content'). It distinguishes itself from sibling tools by focusing on measurement rather than document/image creation or layout generation.

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?

The description provides explicit usage scenarios with bullet points: 'Calculate text width to set proper container sizes', 'Determine if text will fit in a given space', and 'Plan multi-line layouts by specifying width constraint'. These give clear guidance on when to use this tool versus alternatives.

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/mcp-z/mcp-pdf'

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