Skip to main content
Glama
cobanov

teslamate-mcp

get_total_distance_and_efficiency

Retrieve lifetime distance traveled and energy efficiency statistics for Tesla vehicles from TeslaMate data.

Instructions

Get the total distance and efficiency for each car. Provides lifetime statistics for distance traveled and energy efficiency.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:22-28 (handler)
    Factory function that creates the anonymous handler for executing the specific tool's SQL query synchronously via 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
  • main.py:31-39 (registration)
    Dynamic registration of all tools, including get_total_distance_and_efficiency, by creating and decorating their handler functions with mcp.tool().
    # 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)
  • Tool schema definition specifying the name, description, and SQL query file for the get_total_distance_and_efficiency tool.
    ToolDefinition(
        name="get_total_distance_and_efficiency",
        description="Get the total distance and efficiency for each car. Provides lifetime statistics for distance traveled and energy efficiency.",
        sql_file="total_distance_and_efficiency.sql",
    ),
  • Async handler function that executes predefined tools, including get_total_distance_and_efficiency, by resolving the tool definition and running its SQL query asynchronously.
    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)
    Registration of tool schemas (name and description) for all predefined tools, including get_total_distance_and_efficiency, in the list_tools method for the remote 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": {}},
            )
        )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It states what the tool does ('Get... statistics') but lacks critical behavioral details: it doesn't specify if this is a read-only operation, whether it requires authentication, how data is returned (e.g., format, pagination), or any rate limits. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that directly state the tool's function and scope ('lifetime statistics'). It's front-loaded with the core purpose, and every sentence adds value without redundancy. Minor improvement could be made by integrating the two sentences more tightly, but it's efficient overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and siblings offering similar data, it lacks completeness in behavioral context (e.g., safety, performance) and usage differentiation. It meets basic needs but leaves gaps for an agent to operate effectively in this crowded toolset.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description adds no parameter information, which is appropriate here. Baseline is 4 for 0 parameters, as no compensation is needed, and the description doesn't introduce confusion about inputs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the total distance and efficiency for each car' with the verb 'Get' and resources 'distance and efficiency for each car'. It distinguishes from siblings by specifying 'lifetime statistics', unlike tools focused on daily/monthly patterns or specific conditions. However, it doesn't explicitly differentiate from all siblings (e.g., 'get_basic_car_information' might overlap).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'lifetime statistics', which implies a broad historical scope, but doesn't specify use cases, prerequisites, or exclusions compared to siblings like 'get_monthly_driving_summary' or 'get_efficiency_by_month_and_temperature'. Without explicit when/when-not instructions, the agent must infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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