Skip to main content
Glama

screens.guide

Convert between pt, dp and px

convert_units
Read-onlyIdempotent

Converts lengths on one device between its layout unit (pt on iOS, dp on Android) and physical pixels (px), at the device's measured scale or density. For dp to px on Android it also gives the whole pixel Compose's Dp.roundToPx() returns.

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": {
      "device": "<device>",
      "values": "<values>",
      "from": "<from>",
      "to": "<to>"
    },
    "name": "convert_units"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYes
fromYes
deviceYesA device id from list_devices, such as iphone-17 or pixel-8.
valuesYes

Output Schema

NameRequiredDescriptionDefault
unitYes
deviceYes
valuesYes
datasetYes
pixelsPerUnitYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and openWorldHint=false, so safety is covered. The description goes beyond them by disclosing where the conversion factor comes from (measured scale or density) and an extra behavior: for dp→px on Android it also returns the whole pixel from Compose's Dp.roundToPx(), which an agent would not otherwise expect.

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 sentences, front-loaded with the core verb and resource, followed by the device-scale qualifier and the Android rounding detail. No filler or repetition.

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?

With an output schema present, return values need not be explained, and the annotations cover safety. The description supplies the platform-unit mapping and conversion basis; the only gaps are batch/limit semantics for values and behavior when from/to don't match the device platform, which are minor for a pure-function converter.

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 only 25% (only 'device' is annotated), so the description must compensate. It does clarify the unit semantics — pt is the iOS layout unit, dp the Android one, px is physical pixels — which helps an agent pick valid from/to combinations, but it says nothing about the values array (1–1000 batched numbers) or what happens on platform/unit mismatches.

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?

States a concrete verb and resource (convert lengths between layout units and physical pixels) with platform-specific precision (pt on iOS, dp on Android). The scope 'on one device ... at the device's measured scale or density' makes clear this is a device-bound unit conversion, which no sibling (check_layout, compare_devices, get_device, list_devices) provides.

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?

The description establishes clear usage context: conversion happens per-device, at that device's measured scale or density, implying the device must already be identified. It offers no explicit exclusions (e.g., cross-device comparison) but there is no competing sibling performing conversions, so the context is sufficient.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.