Symbolic Algebra MCP Server

by sdiehl

convert_to_units

Convert mathematical quantities to specified target units, supporting SI, CGS, and custom systems. Handles compound units, prefixes, and constants like speed_of_light and gravitational_constant, ensuring accurate unit transformations.

Instructions

Converts a quantity to the given target units using sympy.physics.units.convert_to.

Args: expr_key: The key of the expression (previously introduced) to convert. target_units: List of unit names as strings (e.g., ["meter", "1/second"]). unit_system: Optional unit system (from UnitSystem enum). Defaults to SI. The following units are available by default: SI base units: meter, second, kilogram, ampere, kelvin, mole, candela Length: kilometer, millimeter Mass: gram Energy: joule Force: newton Pressure: pascal Power: watt Electric: coulomb, volt, ohm, farad, henry Constants: speed_of_light, gravitational_constant, planck IMPORTANT: For compound units like meter/second, you must separate the numerator and denominator into separate units in the list. For example: - For meter/second: use ["meter", "1/second"] - For newton*meter: use ["newton", "meter"] - For kilogram*meter²/second²: use ["kilogram", "meter**2", "1/second**2"] Example: # Convert speed of light to kilometers per hour expr_key = introduce_expression("speed_of_light") result = convert_to_units(expr_key, ["kilometer", "1/hour"]) # Returns approximately 1.08e9 kilometer/hour # Convert gravitational constant to CGS units expr_key = introduce_expression("gravitational_constant") result = convert_to_units(expr_key, ["centimeter**3", "1/gram", "1/second**2"], UnitSystem.CGS) SI prefixes (femto, pico, nano, micro, milli, centi, deci, deca, hecto, kilo, mega, giga, tera) can be used directly with base units. Returns: A key for the converted expression, or an error message.

Input Schema

NameRequiredDescriptionDefault
expr_keyYes
target_unitsYes
unit_systemNo

Input Schema (JSON Schema)

{ "$defs": { "UnitSystem": { "enum": [ "MKS", "MKSA", "natural", "SI", "cgs" ], "title": "UnitSystem", "type": "string" } }, "properties": { "expr_key": { "title": "Expr Key", "type": "string" }, "target_units": { "items": {}, "title": "Target Units", "type": "array" }, "unit_system": { "anyOf": [ { "$ref": "#/$defs/UnitSystem" }, { "type": "null" } ], "default": null } }, "required": [ "expr_key", "target_units" ], "title": "convert_to_unitsArguments", "type": "object" }

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/sdiehl/sympy-mcp'

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