custom-emission-calculation
Calculate carbon emissions by entering an activity ID, value, and unit. Use this tool for precise emission calculations with specific factors, enabling tailored climate impact insights.
Instructions
Calculate emissions using any specific emission factor identified by its activity_id, allowing for precise and flexible carbon calculations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activity_id | Yes | Emission factor activity ID (found via search-emission-factors) | |
| unit | Yes | Activity unit (e.g., kWh, km, kg, etc.) | |
| value | Yes | Activity value (amount of the activity) |
Implementation Reference
- Handler dispatch point for the 'custom-emission-calculation' tool within the MCP server's call_tool handler. It invokes the specific tool function with configuration, arguments, server context, and the API request helper.elif name == "custom-emission-calculation": result_text, result, cache_id = await custom_emission_calculation_tool(config, arguments, server, climatiq_request)
- src/climatiq_mcp_server/server.py:32-44 (registration)Import of the custom_emission_calculation_tool function from the tools module, along with other tool handlers and get_tool_definitions (likely containing schemas).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 )
- utils/llm_example_client.py:317-333 (helper)Client-side helper method demonstrating usage of the 'custom-emission-calculation' tool, showing expected input parameters: activity_id, value, unit.async def calculate_custom_emission(self, activity_id, value, unit): """Calculate emissions using a specific emission factor by activity ID""" try: logger.debug(f"Custom emission calculation request: activity_id={activity_id}, value={value}, unit={unit}") result = await self.session.call_tool( "custom-emission-calculation", { "activity_id": activity_id, "value": value, "unit": unit } ) return self._parse_text_content(result) except Exception as e: logger.error(f"Error in custom emission calculation: {e}") return f"Error calculating custom emissions: {e}"