Skip to main content
Glama
zazencodes

Unit Converter MCP

by zazencodes

convert_area

Convert area measurements between units like acres, hectares, square meters, and square feet. Input a value with source and target units for accurate conversion.

Instructions

Convert area between units.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYesArea value to convert
from_unitYesSource unit
to_unitYesTarget unit

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler function 'convert_area' that performs the area unit conversion by calling the core convert_area_tool and formats the response.
    @app.tool()
    def convert_area(
        value: Annotated[float, Field(description="Area value to convert")],
        from_unit: Annotated[AREA_UNIT, Field(description="Source unit")],
        to_unit: Annotated[AREA_UNIT, Field(description="Target unit")],
    ) -> dict:
        """Convert area between units."""
        converted_value = convert_area_tool(value, from_unit, to_unit)
        return {
            "original_value": value,
            "original_unit": from_unit,
            "converted_value": converted_value,
            "converted_unit": to_unit,
            "conversion_type": "area",
        }
  • Type definition (Literal) for supported area units used in input validation.
    AREA_UNIT = Literal[
        "acre",
        "are",
        "hectare",
        "square centimeter",
        "square foot",
        "square inch",
        "square kilometer",
        "square meter",
        "square mile",
        "square millimeter",
        "square yard",
    ]
  • Core helper function implementing the area conversion logic by normalizing to square meters.
    def convert_area_tool(
        value: float,
        from_unit: AREA_UNIT,
        to_unit: AREA_UNIT,
    ) -> float:
        """Convert area between units."""
    
        # Convert to square meters first
        to_square_meters = {
            "acre": 4046.8564224,
            "are": 100.0,
            "hectare": 10_000.0,
            "square centimeter": 0.0001,
            "square foot": 0.09290304,
            "square inch": 0.00064516,
            "square kilometer": 1_000_000.0,
            "square meter": 1.0,
            "square mile": 2_589_988.110336,
            "square millimeter": 1e-6,
            "square yard": 0.83612736,
        }
    
        square_meters = value * to_square_meters[from_unit]
        return square_meters / to_square_meters[to_unit]
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states the basic function ('Convert area between units') without any information about error handling, precision, rate limits, authentication needs, or what the output looks like. For a tool with no annotations, this is insufficient to inform the agent about how the tool behaves beyond its core purpose.

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 extremely concise ('Convert area between units.')—just four words that directly state the tool's purpose. It's front-loaded with no wasted words, making it easy for an agent to parse quickly. Every sentence (in this case, the single sentence) earns its place by clearly defining the tool's function.

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 that there's an output schema (implied by 'Has output schema: true'), the description doesn't need to explain return values. However, with no annotations and a simple but functional purpose (area conversion), the description is minimal but adequate for basic understanding. It covers the 'what' but lacks depth on 'how' and 'when', making it just barely sufficient for a straightforward conversion tool.

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 input schema has 100% description coverage, with clear descriptions for all three parameters (value, from_unit, to_unit) and enum values for units. The description adds no additional parameter semantics beyond what's in the schema. According to the rules, with high schema coverage (>80%), the baseline is 3 even with no param info in the description, which applies here.

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: 'Convert area between units.' This is a specific verb ('convert') with a clear resource ('area') and distinguishes it from other conversion tools (e.g., convert_length, convert_volume). However, it doesn't explicitly differentiate from the generic 'convert_batch' sibling, which might also handle area conversions, so it's not a perfect 5.

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 when to prefer this over 'convert_batch' for area conversions, or how it relates to 'list_supported_units'. There's no context about prerequisites, limitations, or typical use cases, 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