get_basic_car_information
Retrieve basic vehicle details like VIN, model, and firmware version from your TeslaMate database for Tesla car information access.
Instructions
Get the basic car information for each car. Returns VIN, model, firmware version, and other vehicle details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:22-28 (handler)Factory function that creates the anonymous handler for the tool, which executes the SQL query from the tool's sql_file using the database manager.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:27-31 (schema)ToolDefinition dataclass instance defining the tool's name, description, and associated SQL query file.ToolDefinition( name="get_basic_car_information", description="Get the basic car information for each car. Returns VIN, model, firmware version, and other vehicle details.", sql_file="basic_car_information.sql", ),
- main.py:32-38 (registration)Loop that dynamically creates and registers the handler for each tool, including 'get_basic_car_information', with the FastMCP 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)
- src/database.py:27-33 (helper)DatabaseManager method that loads the SQL from the file and executes it synchronously, returning results as list of dicts. This is called by the tool handler.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()