Skip to main content
Glama
cobanov

teslamate-mcp

get_daily_driving_patterns

Retrieve daily driving patterns for each vehicle connected to TeslaMate, enabling insights into usage trends and behavior analysis.

Instructions

Get the daily driving patterns for each car.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool schema definition specifying the name, description, and associated SQL query file for executing daily driving patterns analysis.
    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)
    Generic handler factory that creates the execution function for the tool by calling execute_query_sync on the tool's SQL file. Used for local STDIO transport.
    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)
    Dynamically registers the handler for 'get_daily_driving_patterns' (via TOOL_DEFINITIONS) with the MCP server using the @mcp.tool decorator for local transport.
    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)
  • Handler that resolves the tool definition by name and executes its SQL query asynchronously for remote HTTP transport.
    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 (name, description, empty input schema) in the list_tools response 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": {}}, ) )

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/cobanov/teslamate-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server