Skip to main content
Glama

CSS unit converter

css_units
Read-onlyIdempotent

Convert CSS lengths between px, rem, em, %, pt, pc, in, cm, mm, vw, vh, vmin and vmax using custom font and viewport sizes, returning all units rounded to your chosen decimal places.

Instructions

Convert a CSS length between px, rem, em, %, pt, pc, in, cm, mm, vw, vh, vmin and vmax, using a root font size, parent font size and viewport size (defaults 16px / 16px / 1440×900). Uses the CSS definition of 96px per inch. Returns every unit, rounded to 4 decimals by default. Web version: https://s3eidat.github.io/css-units/

Input Schema

NameRequiredDescriptionDefault
unitNoUnit of "value". Default px.px
valueYesThe length to convert, e.g. 24.
decimalsNoDecimal places to round to. Default 4.
rootFontSizeNoRoot (html) font size in px, for rem. Default 16.
viewportWidthNoViewport width in px, for vw/vmin/vmax. Default 1440.
parentFontSizeNoParent element font size in px, for em and %. Default 16.
viewportHeightNoViewport height in px, for vh/vmin/vmax. Default 900.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already establish this as a safe, idempotent, closed-world read, so the bar is lower; the description still adds the non-obvious conversion rule (96px per inch), the exact return shape ('returns every unit'), and default rounding to 4 decimals, which an agent cannot infer from annotations alone.

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 core purpose is front-loaded in a single dense sentence, followed by the unit-definition and return-format notes, with no filler; every clause (units, defaults, 96px/inch, rounding, web version) earns its place.

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?

With 7 params, full schema coverage, and no output schema, the description is complete: it discloses defaults, conversion semantics, and the return behavior ('returns every unit, rounded to 4 decimals'), so an agent needs nothing more to call it correctly.

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 schema already documents each parameter's role and constraints; the description restates the default triple (16px/16px/1440×900) and mentions rounding but adds no syntax or edge-case detail the schema lacks, meriting the baseline 3.

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 announces a precise verb and resource ('Convert a CSS length') and enumerates all supported units, making the tool unambiguously distinct from siblings like css_clamp (clamp generation) and calc_unit_convert (general-purpose conversion).

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?

It provides the contextual defaults (root font 16px, parent font 16px, viewport 1440×900) that implicitly tell an agent when the parameters matter, but it never states when to prefer this over calc_unit_convert or other conversion tools, and no exclusions are given.

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

Deploy Server

Other Tools