Skip to main content
Glama
cobanov

teslamate-mcp

get_monthly_driving_summary

Retrieve monthly driving statistics for Tesla vehicles, including distance traveled, energy consumption, and associated costs.

Instructions

Get the monthly driving summary for each car. Provides monthly statistics for distance, energy usage, and costs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Generic asynchronous handler that resolves the tool by name from TOOL_DEFINITIONS and executes its associated SQL query using the DatabaseManager.
    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 function that creates synchronous handler functions for each tool, executing the predefined SQL 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
  • src/tools.py:77-81 (registration)
    Tool registration entry defining the name, description, and SQL file path for the get_monthly_driving_summary tool. Used by both main.py and main_remote.py for registration and execution.
    ToolDefinition( name="get_monthly_driving_summary", description="Get the monthly driving summary for each car. Provides monthly statistics for distance, energy usage, and costs.", sql_file="monthly_driving_summary.sql", ),
  • main.py:32-39 (registration)
    Loop that dynamically registers a handler for each tool defined in TOOL_DEFINITIONS using FastMCP for STDIO 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)
  • main_remote.py:178-181 (registration)
    Loop in list_tools() that registers the schema (empty input, description) for each predefined tool in the MCP server for HTTP transport.
    # Add all predefined tools for tool_def in TOOL_DEFINITIONS: tools.append( types.Tool(

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