Skip to main content
Glama
cobanov

teslamate-mcp

get_all_charging_sessions_summary

Retrieve comprehensive charging session summaries for Tesla vehicles, including total sessions, energy consumption, and cost statistics from TeslaMate data.

Instructions

Get the summary of all charging sessions for each car. Returns charging statistics including total sessions, energy consumed, and costs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Defines the tool's metadata: name, description, and the SQL file containing the query logic for get_all_charging_sessions_summary.
    ToolDefinition( name="get_all_charging_sessions_summary", description="Get the summary of all charging sessions for each car. Returns charging statistics including total sessions, energy consumed, and costs.", sql_file="all_charging_sessions_summary.sql", ),
  • main.py:31-39 (registration)
    Registers the handler for get_all_charging_sessions_summary (via loop over TOOL_DEFINITIONS) with the FastMCP server for local/STDIO transport.
    # 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)
  • main.py:22-28 (handler)
    Factory function that creates the specific handler for the tool, which executes the associated SQL query 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
  • Core execution logic: reads SQL from file and executes the query on the TeslaMate database, returning results.
    def execute_query_sync(self, sql_file_path: str) -> List[Dict[str, Any]]: """Execute SQL query synchronously""" sql_query = self.read_sql_file(sql_file_path) with psycopg.connect(self.connection_string, row_factory=dict_row) as conn: with conn.cursor() as cur: cur.execute(sql_query) return cur.fetchall()
  • main_remote.py:178-186 (registration)
    Registers get_all_charging_sessions_summary in the list_tools() method for the remote/HTTP MCP 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