Skip to main content
Glama
zazencodes

Unit Converter MCP

by zazencodes

list_supported_units

Discover available measurement units for conversion types like length, temperature, and volume to ensure compatibility before performing calculations.

Instructions

List all supported units for each conversion type or for a specific type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
unit_typeNoSpecific unit type to get supported units for. If not specified, returns all supported units.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_supported_units' tool. It lists all supported units for unit conversion categories or for a specific category if provided. Uses get_args on imported unit type literals to dynamically retrieve the list of units.
    def list_supported_units(
        unit_type: Annotated[
            UNIT_TYPE | None,
            Field(
                description="Specific unit type to get supported units for. If not specified, returns all supported units.",
                default=None,
            ),
        ],
    ) -> dict:
        """List all supported units for each conversion type or for a specific type."""
        all_units = {
            "angle": get_args(ANGLE_UNIT),
            "area": get_args(AREA_UNIT),
            "computer_data": get_args(COMPUTER_DATA_UNIT),
            "density": get_args(DENSITY_UNIT),
            "energy": get_args(ENERGY_UNIT),
            "force": get_args(FORCE_UNIT),
            "temperature": get_args(TEMPERATURE_UNIT),
            "length": get_args(LENGTH_UNIT),
            "mass": get_args(MASS_UNIT),
            "power": get_args(POWER_UNIT),
            "pressure": get_args(PRESSURE_UNIT),
            "speed": get_args(SPEED_UNIT),
            "time": get_args(TIME_UNIT),
            "volume": get_args(VOLUME_UNIT),
        }
    
        if unit_type is not None:
            return {unit_type: all_units[unit_type]}
    
        return all_units
  • Pydantic/Literal type definition for the 'unit_type' parameter in list_supported_units, enumerating all supported unit categories.
    # Unit type literal for list_supported_units function
    UNIT_TYPE = Literal[
        "angle",
        "area",
        "computer_data",
        "density",
        "energy",
        "force",
        "length",
        "mass",
        "power",
        "pressure",
        "speed",
        "temperature",
        "time",
        "volume",
    ]
  • FastMCP decorator that registers the list_supported_units function as a tool in the MCP server.
    @app.tool()
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool lists units but doesn't disclose behavioral traits like whether it's read-only (implied but not stated), response format, pagination, rate limits, or authentication needs. For a tool with no annotations, this leaves significant gaps in understanding how it behaves.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to understand quickly.

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?

Given the tool's low complexity (one optional parameter) and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the basic purpose and parameter intent. However, with no annotations, it could benefit from more behavioral context, but the output schema mitigates this gap.

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%, with the parameter 'unit_type' well-documented in the schema. The description adds minimal value beyond the schema, only implying that omitting the parameter returns all units. Since the schema already covers this thoroughly, the baseline score of 3 is appropriate.

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 clearly states the tool's purpose with a specific verb ('List') and resource ('supported units'), and specifies scope ('for each conversion type or for a specific type'). However, it doesn't explicitly differentiate from sibling tools like the various 'convert_' tools, which perform actual conversions rather than listing units.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools, prerequisites, or specific scenarios where listing units is appropriate versus performing conversions. The only implied usage is when unit information is needed, but this is too vague.

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/zazencodes/unit-converter-mcp'

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