Skip to main content
Glama
zazencodes

Unit Converter MCP

by zazencodes

list_supported_units

Identify all available units for specific or general conversion types, including length, temperature, and volume, to ensure accurate unit selection and compatibility.

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.

Implementation Reference

  • The handler function for the 'list_supported_units' tool, decorated with @app.tool() which registers it with the FastMCP server. Implements the core logic by retrieving supported units via get_args on imported unit type literals.
    @app.tool() 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' input parameter used in the list_supported_units tool schema.
    # 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", ]

Other Tools

Related 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