get_efficiency_by_month_and_temperature
Analyze how seasonal temperature changes affect vehicle efficiency by retrieving monthly efficiency data correlated with temperature for each car.
Instructions
Get the efficiency by month and temperature for each car. Analyzes how seasonal temperature changes affect vehicle efficiency.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main_remote.py:118-127 (handler)Core handler function for executing predefined tools like get_efficiency_by_month_and_temperature. Retrieves the tool definition and executes the associated SQL query asynchronously using the database pool.async def execute_predefined_tool(tool_name: str) -> List[Dict[str, Any]]: """Execute a predefined tool by name""" if not app_context: raise RuntimeError("Application context not initialized") tool = get_tool_by_name(tool_name) return await app_context.db_manager.execute_query_async( tool.sql_file, app_context.db_pool )
- main.py:22-28 (handler)Factory that creates synchronous handler functions for each predefined tool by wrapping the database sync query execution for the specific SQL file.def create_tool_handler(sql_file: str): """Factory function to create tool handlers""" def handler() -> List[Dict[str, Any]]: return db_manager.execute_query_sync(sql_file) return handler
- main.py:32-39 (registration)Registration loop that dynamically creates and registers individual handler functions for each tool, including get_efficiency_by_month_and_temperature, using FastMCP's @tool decorator.for tool_def in TOOL_DEFINITIONS: tool_func = create_tool_handler(tool_def.sql_file) tool_func.__doc__ = tool_def.description tool_func.__name__ = tool_def.name # Register the tool with the MCP server mcp.tool()(tool_func)
- src/tools.py:67-71 (schema)Tool schema definition specifying the name, description, and SQL query file for the get_efficiency_by_month_and_temperature tool.ToolDefinition( name="get_efficiency_by_month_and_temperature", description="Get the efficiency by month and temperature for each car. Analyzes how seasonal temperature changes affect vehicle efficiency.", sql_file="efficiency_by_month_and_temperature.sql", ),
- main_remote.py:178-186 (registration)Registration of predefined tools in the list_tools() method for the remote HTTP MCP server, including the tool with empty input schema (no parameters).# Add all predefined tools for tool_def in TOOL_DEFINITIONS: tools.append( types.Tool( name=tool_def.name, description=tool_def.description, inputSchema={"type": "object", "properties": {}}, ) )