Skip to main content
Glama
cobanov

teslamate-mcp

get_battery_health_summary

Retrieve detailed battery health summaries for Tesla vehicles to monitor performance and longevity using the TeslaMate MCP server.

Instructions

Get the battery health summary for each car.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:22-29 (handler)
    Factory that creates the synchronous handler function for executing the tool's SQL query via the database manager. This is used to generate the specific handler for get_battery_health_summary.
    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
  • ToolDefinition specifying the name, description, and SQL file for the get_battery_health_summary tool.
    ToolDefinition( name="get_battery_health_summary", description="Get the battery health summary for each car. Provides current battery health status and statistics.", sql_file="battery_health_summary.sql", ),
  • main.py:32-38 (registration)
    Loop that dynamically creates and registers the handler for each tool, including get_battery_health_summary, with the MCP server using mcp.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)
  • Asynchronous handler function that retrieves the tool definition and executes the associated SQL query for predefined tools like get_battery_health_summary in the remote 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:178-186 (registration)
    Loop in list_tools() that registers all predefined tools, including get_battery_health_summary, by adding their Tool objects with name and description to the MCP tools list.
    # 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