Skip to main content
Glama
jagan-shanmugam

Climatiq MCP Server

hotel-emission

Calculate carbon emissions from hotel stays using location and nights stayed to assess environmental impact.

Instructions

Calculate carbon emissions from hotel stays based on the number of nights stayed and the location of the hotel.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hotel_nightsYesNumber of nights stayed
locationYesLocation of the hotel
yearNoYear of the hotel stay

Implementation Reference

  • The `hotel_emission_tool` function implements the core logic for calculating CO2e emissions from hotel stays using the Climatiq API.
    async def hotel_emission_tool(config, arguments, server, climatiq_request):
        """
        Calculate carbon emissions from hotel stays.
        
        This tool estimates the greenhouse gas emissions associated with hotel accommodations
        based on the number of nights stayed and the location of the hotel. It provides
        valuable data for calculating business travel emissions.
        """
        hotel_nights = arguments.get("hotel_nights")
        location = arguments.get("location")
        year = arguments.get("year")
        
        if not hotel_nights or not location:
            raise ValueError("Missing required parameters for hotel emission calculation")
            
        # Construct the request to the Climatiq API
        request_data = {
            "hotel_nights": hotel_nights,
            "location": location
        }
        
        if year:
            request_data["year"] = year
            
        try:
            result = await climatiq_request("/travel/v1-preview1/hotel", request_data)
            
            # Store in cache
            cache_id = f"hotel_{hotel_nights}_{id(result)}"
            
            co2e = result.get("co2e", 0)
            co2e_unit = result.get("co2e_unit", "kg")
            location_name = result.get("location", {}).get("name", "unknown location")
            
            result_text = f"Hotel stay for {hotel_nights} nights in {location_name} "
            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
            
        except ValueError as e:
            error_text = f"Error calculating hotel emissions: {str(e)}"
            return error_text, None, None
  • Tool registration in `get_tool_definitions()` including name, description, and input schema.
    types.Tool(
        name="hotel-emission",
        description="Calculate carbon emissions from hotel stays based on the number of nights stayed and the location of the hotel.",
        inputSchema={
            "type": "object",
            "properties": {
                "hotel_nights": {"type": "number", "description": "Number of nights stayed"},
                "location": {"type": "string", "description": "Location of the hotel"},
                "year": {"type": "number", "description": "Year of the hotel stay"},
            },
            "required": ["hotel_nights", "location"],
        },
    ),
  • Input schema definition for the hotel-emission tool, specifying required parameters: hotel_nights and location.
    types.Tool(
        name="hotel-emission",
        description="Calculate carbon emissions from hotel stays based on the number of nights stayed and the location of the hotel.",
        inputSchema={
            "type": "object",
            "properties": {
                "hotel_nights": {"type": "number", "description": "Number of nights stayed"},
                "location": {"type": "string", "description": "Location of the hotel"},
                "year": {"type": "number", "description": "Year of the hotel stay"},
            },
            "required": ["hotel_nights", "location"],
        },
    ),
  • Dispatch logic in `@server.call_tool()` handler that routes 'hotel-emission' calls to the hotel_emission_tool function.
    elif name == "hotel-emission":
        result_text, result, cache_id = await hotel_emission_tool(config, arguments, server, climatiq_request)
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 the calculation purpose but lacks details on what the calculation returns (units, format), whether it's an estimate or exact, data sources, accuracy limitations, or error handling. For a calculation tool with zero annotation coverage, this is a significant gap in behavioral context.

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 front-loads the core purpose and key parameters without any wasted words. Every element earns its place, making it appropriately sized and well-structured for quick understanding.

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?

Given the complexity of an emission calculation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., CO2 equivalent in kg), how results are derived, or any assumptions/limitations. For a tool that likely involves environmental data and calculations, this leaves significant gaps for an AI agent.

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 three parameters thoroughly. The description adds minimal value by mentioning nights and location as key inputs, but doesn't provide additional syntax, format details, or constraints beyond what the schema provides. The baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('calculate carbon emissions') and resource ('from hotel stays'), with explicit parameters ('based on the number of nights stayed and the location of the hotel'). It distinguishes from sibling tools like 'travel-emission' or 'electricity-emission' by focusing specifically on hotel stays.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through its parameter focus (nights and location), but does not explicitly state when to use this tool versus alternatives like 'travel-emission' or 'custom-emission-calculation'. No exclusions or prerequisites are mentioned, leaving usage guidance at an implied level.

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