Skip to main content
Glama
cobanov

teslamate-mcp

get_drive_summary_per_day

Retrieve daily driving statistics for Tesla vehicles, including distance traveled, duration, and energy efficiency metrics from TeslaMate data.

Instructions

Get the drive summary per day for each car. Provides daily driving statistics including distance, duration, and efficiency.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/tools.py:62-66 (registration)
    ToolDefinition registering the 'get_drive_summary_per_day' tool with its description and associated SQL query file.
    ToolDefinition( name="get_drive_summary_per_day", description="Get the drive summary per day for each car. Provides daily driving statistics including distance, duration, and efficiency.", sql_file="drive_summary_per_day.sql", ),
  • main.py:22-28 (handler)
    Handler factory that creates the execution function for the tool, which runs 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:31-39 (registration)
    Dynamic registration loop that creates and registers the handler for each tool, including 'get_drive_summary_per_day', with the MCP server.
    # Register all tools from definitions 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)
  • Async handler function for executing predefined tools by name, including 'get_drive_summary_per_day', using the async database query execution.
    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:178-186 (registration)
    Registration of all predefined tools, including schema (empty input), in the list_tools MCP method for the remote HTTP server.
    # 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": {}}, ) )

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