get_daily_driving_patterns
Analyze daily driving habits and patterns by weekday and time to understand vehicle usage trends.
Instructions
Get the daily driving patterns for each car. Shows driving habits and patterns by day of week and time.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.py:57-61 (schema)Tool schema definition specifying the name, description, and SQL file path for the get_daily_driving_patterns tool.ToolDefinition( name="get_daily_driving_patterns", description="Get the daily driving patterns for each car. Shows driving habits and patterns by day of week and time.", sql_file="daily_driving_patterns.sql", ),
- main.py:22-28 (handler)Factory function that creates the handler for get_daily_driving_patterns (and other tools), which executes the SQL query from the specified file synchronously.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-38 (registration)Dynamically registers the handler for get_daily_driving_patterns (and all tools) with the FastMCP server using the 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)
- main_remote.py:118-127 (handler)Async handler function for executing predefined tools like get_daily_driving_patterns in the remote HTTP MCP server.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_remote.py:179-186 (registration)Registers the tool schema for get_daily_driving_patterns (and others) in the list_tools method for the remote MCP server.for tool_def in TOOL_DEFINITIONS: tools.append( types.Tool( name=tool_def.name, description=tool_def.description, inputSchema={"type": "object", "properties": {}}, ) )