Skip to main content
Glama

measure_text

Read-only

Calculate the pixel dimensions text will occupy before drawing. Use font, size, outline, and shadow options to match the size draw_text produces with antialiasing disabled.

Instructions

Size in pixels that draw_text would paint for this text, without a sprite.

outline_width 0 means no outline, shadow offsets 0, 0 no shadow. Antialiasing can change the size by a pixel, so this matches draw_text with antialias=false.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "text": "<text>"
    },
    "name": "measure_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
boldNoThicken the glyphs by 1 px to the right
fontNoFont name from list_fonts (family, 'Family Style' or file name, any case) or an absolute path to a .ttf/.otf/.ttc file; empty = the built-in font
sizeNoFont size in pixels (FreeType pixel size)
textYesText, at most 2000 characters; '\n' starts a new line
shadow_dxNoShadow offset to the right
shadow_dyNoShadow offset downwards
line_spacingNoExtra px between lines
outline_widthNoOutline thickness; 0 for none
letter_spacingNoExtra px between characters

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

readOnlyHint=true already tells the agent this is a safe pure computation, but the description adds real behavioral context: outline_width 0 disables outline, shadow offsets of 0,0 disable shadow, and results mirror draw_text with antialias=false. The antialiasing caveat (size may differ by a pixel) is a concrete accuracy note not derivable from annotations or schema.

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?

Three short sentences, the core purpose front-loaded and the caveats after. Some wording is awkward ('Size in pixels that draw_text would paint for this text, without a sprite') and the outline/shadow sentence partially duplicates schema defaults, but nothing is padding.

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?

For a 9-parameter read-only measurement tool with a full output schema and 100% schema coverage, the description supplies the key semantic anchor (equivalence to draw_text with antialias=false) and the accuracy caveat. Remaining gaps — such as whether an open document or font loading is required — are minor for a pure calculation.

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 every parameter is already documented, and the description's notes on outline_width and shadow defaults largely restate what the schema says ('0 for none', default 0). The one genuinely additive note ties the whole parameter set to draw_text's antialias=false behavior, which is a modest gain over the schema baseline.

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 states a specific computation: the pixel size draw_text would paint for a given text, explicitly performed without a sprite, which separates it from the sibling draw_text. It is a noun phrase rather than a verb ('measure'/'return'), so the exact return shape is only fully confirmed by the output schema, but the resource and scope are unambiguous.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: an agent can infer this is for pre-computing text size before calling draw_text, and the 'without a sprite' clause signals it can be used outside a document context. There is no explicit when-to-use/when-not clause or named alternative.

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