Skip to main content
Glama
zazencodes

Unit Converter MCP

by zazencodes

convert_computer_data

Convert computer storage values between units like bits, bytes, gigabytes, and terabytes. Input a value with source and target units for accurate conversion.

Instructions

Convert computer storage between units.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYesComputer storage value to convert
from_unitYesSource unit
to_unitYesTarget unit

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'convert_computer_data' that wraps the core conversion logic and formats the response.
    @app.tool()
    def convert_computer_data(
        value: Annotated[float, Field(description="Computer storage value to convert")],
        from_unit: Annotated[COMPUTER_DATA_UNIT, Field(description="Source unit")],
        to_unit: Annotated[COMPUTER_DATA_UNIT, Field(description="Target unit")],
    ) -> dict:
        """Convert computer storage between units."""
        converted_value = convert_computer_data_tool(value, from_unit, to_unit)
        return {
            "original_value": value,
            "original_unit": from_unit,
            "converted_value": converted_value,
            "converted_unit": to_unit,
            "conversion_type": "computer_data",
        }
  • Literal type defining the supported units for computer data conversions (used in type annotations).
    COMPUTER_DATA_UNIT = Literal[
        "bits",
        "bytes",
        "kilobytes",
        "megabytes",
        "gigabytes",
        "terabytes",
        "petabytes",
        "exabytes",
    ]
  • Core helper function implementing the computer data unit conversion logic by normalizing to megabytes.
    def convert_computer_data_tool(
        value: float,
        from_unit: COMPUTER_DATA_UNIT,
        to_unit: COMPUTER_DATA_UNIT,
    ) -> float:
        """Convert computer storage between units."""
    
        # Convert to megabytes first
        to_megabytes = {
            "bits": 1.19209e-07,
            "bytes": 9.53674e-07,
            "kilobytes": 0.0009765625,
            "megabytes": 1.0,
            "gigabytes": 1024.0,
            "terabytes": 1048576.0,
            "petabytes": 1073741824.0,
            "exabytes": 1099511627776.0,
        }
    
        megabytes = value * to_megabytes[from_unit]
        return megabytes / to_megabytes[to_unit]
  • Imports the convert_computer_data_tool and COMPUTER_DATA_UNIT, enabling their use in the server tools.
    from .tools import (
        ANGLE_UNIT,
        AREA_UNIT,
        COMPUTER_DATA_UNIT,
        DENSITY_UNIT,
        ENERGY_UNIT,
        FORCE_UNIT,
        LENGTH_UNIT,
        MASS_UNIT,
        POWER_UNIT,
        PRESSURE_UNIT,
        SPEED_UNIT,
        TEMPERATURE_UNIT,
        TIME_UNIT,
        VOLUME_UNIT,
        convert_angle_tool,
        convert_area_tool,
        convert_batch_tool,
        convert_computer_data_tool,
        convert_density_tool,
        convert_energy_tool,
        convert_force_tool,
        convert_length_tool,
        convert_mass_tool,
        convert_power_tool,
        convert_pressure_tool,
        convert_speed_tool,
        convert_temperature_tool,
        convert_time_tool,
        convert_volume_tool,
    )
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It doesn't mention whether this is a read-only operation, potential precision issues, error conditions, or performance characteristics. The description only states what the tool does, not 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 communicates the core functionality without unnecessary words. It's appropriately sized for a straightforward conversion tool and gets directly to the point with zero wasted verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity, 100% schema coverage, and presence of an output schema, the description is minimally adequate. However, for a tool with no annotations, it should provide more behavioral context about what 'convert' entails operationally. The description meets basic requirements but leaves gaps in understanding the tool's complete behavior.

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?

The description adds no parameter-specific information beyond what's already in the schema, which has 100% coverage with clear descriptions and enums. The baseline score of 3 reflects adequate schema documentation, but the description doesn't provide additional context about unit conversion specifics or edge cases.

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 verb 'convert' and the resource 'computer storage between units', making the purpose immediately understandable. It distinguishes from sibling tools by specifying 'computer storage' rather than other conversion types like angle or temperature, though it doesn't explicitly contrast with them.

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 like 'convert_batch' or 'list_supported_units'. It lacks context about typical use cases, prerequisites, or exclusions, leaving the agent to infer usage from the tool name alone.

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