Skip to main content
Glama
jagan-shanmugam

Climatiq MCP Server

freight-emission

Calculate carbon emissions for freight transportation by inputting mode, weight, and distance to assess environmental impact.

Instructions

Calculate emissions from freight transportation across different modes (truck, rail, ship, air) based on weight and distance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYesFreight mode (truck, rail, ship, air)
weightYesWeight of goods transported
weight_unitNoWeight unit (t, kg)t
distanceYesDistance transported
distance_unitNoDistance unit (km, mi)km

Implementation Reference

  • The handler function that executes the freight-emission tool: parses arguments, maps mode to Climatiq activity_id, calls the API, processes and caches the result.
    async def freight_emission_tool(config, arguments, server, climatiq_request):
        """
        Calculate carbon emissions from freight transportation.
        
        This tool estimates greenhouse gas emissions from moving goods via different freight modes:
        - Truck/road freight
        - Rail freight
        - Sea/shipping freight
        - Air freight
        
        The calculation considers:
        - The weight of goods being transported
        - The distance traveled
        - The specific transport mode
        
        It's especially useful for logistics companies, supply chain operations, and 
        organizations looking to understand and reduce their shipping-related carbon footprint.
        """
        mode = arguments.get("mode")
        weight = arguments.get("weight")
        weight_unit = arguments.get("weight_unit", "t")
        distance = arguments.get("distance")
        distance_unit = arguments.get("distance_unit", "km")
        
        if not mode or not weight or not distance:
            raise ValueError("Missing required parameters for freight emission calculation")
            
        # Different activity IDs based on freight mode
        activity_id = ""
        
        if mode.lower() == "truck" or mode.lower() == "road":
            activity_id = "freight_vehicle-vehicle_type_truck-fuel_source_na-vehicle_weight_na-vehicle_age_na"
        elif mode.lower() == "rail":
            activity_id = "freight_train-route_type_na-fuel_source_na"
        elif mode.lower() in ["ship", "sea", "marine"]:
            activity_id = "sea_freight-vessel_type_na-route_type_na-fuel_source_na"
        elif mode.lower() in ["air", "plane", "aircraft"]:
            activity_id = "air_freight-route_type_na-distance_na"
        else:
            raise ValueError(f"Unsupported freight mode: {mode}")
            
        # Construct the request to the Climatiq API
        request_data = {
            "emission_factor": {
                "activity_id": activity_id,
                "data_version": config["data_version"]
            },
            "parameters": {
                "weight": weight,
                "weight_unit": weight_unit,
                "distance": distance,
                "distance_unit": distance_unit
            }
        }
        
        result = await climatiq_request("/data/v1/estimate", request_data)
        
        # Store in cache
        cache_id = f"freight_{mode}_{weight}_{weight_unit}_{distance}_{distance_unit}_{id(result)}"
        
        co2e = result.get("co2e", 0)
        co2e_unit = result.get("co2e_unit", "kg")
        
        mode_display = mode.capitalize()
        result_text = f"{mode_display} freight of {weight} {weight_unit} over {distance} {distance_unit} "
        result_text += f"results in {co2e} {co2e_unit} of CO2e emissions."
        result_text += f"\n\nDetailed results are available as a resource with ID: {cache_id}"
        
        return result_text, result, cache_id
  • Defines the tool schema including name, description, and inputSchema with properties for mode, weight, distance, units.
    types.Tool(
        name="freight-emission",
        description="Calculate emissions from freight transportation across different modes (truck, rail, ship, air) based on weight and distance.",
        inputSchema={
            "type": "object",
            "properties": {
                "mode": {"type": "string", "description": "Freight mode (truck, rail, ship, air)"},
                "weight": {"type": "number", "description": "Weight of goods transported"},
                "weight_unit": {"type": "string", "description": "Weight unit (t, kg)", "default": "t"},
                "distance": {"type": "number", "description": "Distance transported"},
                "distance_unit": {"type": "string", "description": "Distance unit (km, mi)", "default": "km"},
            },
            "required": ["mode", "weight", "distance"],
        },
    ),
  • Tool dispatch in handle_call_tool: routes 'freight-emission' calls to the freight_emission_tool handler.
    elif name == "freight-emission":
        result_text, result, cache_id = await freight_emission_tool(config, arguments, server, climatiq_request)
  • Registers all MCP tools (including freight-emission) via server.list_tools() by returning get_tool_definitions().
    @server.list_tools()
    async def handle_list_tools() -> list[types.Tool]:
        """
        List available tools for interacting with the Climatiq API.
        """
        return get_tool_definitions()
  • Imports the freight_emission_tool handler and get_tool_definitions from tools.py for use in server.
    from climatiq_mcp_server.tools import (
        set_api_key_tool,
        electricity_emission_tool,
        travel_emission_tool,
        search_emission_factors_tool,
        custom_emission_calculation_tool,
        cloud_computing_emission_tool,
        freight_emission_tool,
        procurement_emission_tool,
        hotel_emission_tool,
        travel_spend_tool,
        get_tool_definitions
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. It states what the tool does (calculates emissions) but doesn't describe behavioral traits like whether it's a read-only calculation, what units the output uses, error conditions, or any rate limits. For a calculation tool with zero annotation coverage, 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose upfront. There's no wasted language or unnecessary elaboration. However, it could be slightly more structured by separating purpose from scope or adding a brief note about output.

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

Completeness2/5

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

For a calculation tool with 5 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the output represents (e.g., CO2 equivalent, units), whether it uses specific emission factors, or how the calculation is performed. The lack of output schema means the description should ideally cover return values, which it doesn't.

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%, so the schema already documents all 5 parameters thoroughly. The description mentions 'based on weight and distance' which aligns with the schema but adds no additional semantic meaning beyond what's in the parameter descriptions. It doesn't explain relationships between parameters or calculation methodology.

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: 'Calculate emissions from freight transportation' with specific resources (freight transportation) and modes (truck, rail, ship, air). It distinguishes from some siblings like 'electricity-emission' or 'hotel-emission' by focusing on freight, but doesn't explicitly differentiate from 'travel-emission' which might also involve transportation. The verb 'calculate' is specific and actionable.

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 like 'custom-emission-calculation' or 'search-emission-factors' that might be relevant for emission calculations. There's no context about prerequisites, limitations, or scenarios where this tool is preferred over others in the server.

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/jagan-shanmugam/climatiq-mcp-server'

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