get_current_car_status
Retrieve real-time status updates for each Tesla vehicle connected to your TeslaMate database, enabling immediate access to car analytics and monitoring.
Instructions
Get the current car status for each car.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.py:47-51 (schema)Defines the schema for the 'get_current_car_status' tool, specifying its name, description, and the SQL file containing the query logic.ToolDefinition( name="get_current_car_status", description="Get the current car status for each car. Returns real-time vehicle status including location, battery level, and state.", sql_file="current_car_status.sql", ),
- main.py:22-28 (handler)Factory that creates the handler function for each tool, including 'get_current_car_status', which executes the tool's 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
- main.py:31-39 (registration)Registers the 'get_current_car_status' tool (and others) with the MCP server by creating and decorating the handler function.# 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_remote.py:118-127 (handler)Handler function that executes predefined tools like 'get_current_car_status' asynchronously by retrieving and running the associated SQL query.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)Registers the tool schema for 'get_current_car_status' (and others) in the MCP server's list_tools 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": {}}, ) )