Skip to main content
Glama

search-emission-factors

Search for emission factors by keyword, category, region, year, or source to enable accurate carbon emissions calculations using Climatiq's extensive database.

Instructions

Search Climatiq's database for emission factors by keyword, category, region, year, source, and other metadata to find appropriate factors for calculations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoCategory of emission factors (e.g., 'Energy', 'Transport')
data_versionNoData version of emission factors
queryYesSearch query for emission factors (e.g., 'electricity', 'flight', 'truck')
regionNoRegion code to filter results (e.g., 'US', 'EU')
sourceNoSource organization of emission factors (e.g., 'IPCC', 'EPA', 'BEIS')
unit_typeNoUnit type of emission factors (e.g., 'energy', 'distance', 'weight')
yearNoYear of emission factors

Implementation Reference

  • Dispatch point in the MCP call_tool handler that routes 'search-emission-factors' tool calls to the specific implementation function search_emission_factors_tool.
    elif name == "search-emission-factors": result_text, result, cache_id = await search_emission_factors_tool(config, arguments, server, climatiq_request)
  • The @server.list_tools() handler returns tool definitions (including schema for search-emission-factors) via get_tool_definitions().
    async def handle_list_tools() -> list[types.Tool]: """ List available tools for interacting with the Climatiq API. """ return get_tool_definitions()
  • Helper function to make authenticated requests to the Climatiq API, used by all tool implementations including search-emission-factors.
    async def climatiq_request(endpoint: str, json_data: dict, method: str = "POST") -> dict: """Make a request to the Climatiq API.""" if not config["api_key"]: raise ValueError("Climatiq API key not set. Please configure it using the set-api-key tool.") url = f"{config['base_url']}{endpoint}" headers = { "Authorization": f"Bearer {config['api_key']}", "Content-Type": "application/json" } logger.debug(f"Request URL: {url}") logger.debug(f"Request method: {method}") logger.debug(f"Request headers: {headers}") logger.debug(f"Request data: {json.dumps(json_data, indent=2)}") try: async with httpx.AsyncClient(timeout=60.0) as client: if method.upper() == "POST": response = await client.post(url, headers=headers, json=json_data) else: response = await client.get(url, headers=headers, params=json_data) logger.debug(f"Response status code: {response.status_code}") if response.status_code != 200: error_detail = response.text try: error_json = response.json() if "error" in error_json: error_detail = error_json["error"] elif "message" in error_json: error_detail = error_json["message"] except: pass logger.error(f"API request failed with status {response.status_code}: {error_detail}") raise ValueError(f"API request failed with status {response.status_code}: {error_detail}") result = response.json() logger.debug(f"Response data: {json.dumps(result, indent=2)}") return result except httpx.TimeoutException: logger.error("Request to Climatiq API timed out") raise ValueError("Request to Climatiq API timed out. Please try again later.") except httpx.RequestError as e: logger.error(f"Request error: {str(e)}") raise ValueError(f"Failed to connect to Climatiq API: {str(e)}") except Exception as e: logger.error(f"Unexpected error during API request: {str(e)}", exc_info=True) raise ValueError(f"Error during Climatiq API request: {str(e)}")
  • Import of the search_emission_factors_tool function and get_tool_definitions, registering the tool availability in the 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 )

Other Tools

Related 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