Skip to main content
Glama

rivian_get_charging_session

Monitor active charging sessions to track power usage, battery level, time remaining, and cost for your Rivian vehicle.

Instructions

Check on an active charging session — power, battery level, time remaining, and cost.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vehicle_idYesVehicle ID from your account info

Implementation Reference

  • The core implementation of getLiveChargingSession that executes a GraphQL query to the Rivian charging API, retrieving live charging session data including power, battery level, time remaining, cost, and other charging metrics.
    export async function getLiveChargingSession(vehicleId) {
      const body = {
        operationName: 'getLiveSessionData',
        query: `query getLiveSessionData($vehicleId: ID!) {
      getLiveSessionData(vehicleId: $vehicleId) {
        __typename
        chargerId
        current { __typename value updatedAt }
        currentCurrency
        currentMiles { __typename value updatedAt }
        currentPrice
        isFreeSession
        isRivianCharger
        kilometersChargedPerHour { __typename value updatedAt }
        locationId
        power { __typename value updatedAt }
        rangeAddedThisSession { __typename value updatedAt }
        soc { __typename value updatedAt }
        startTime
        timeElapsed
        timeRemaining { __typename value updatedAt }
        totalChargedEnergy { __typename value updatedAt }
        vehicleChargerState { __typename value updatedAt }
      }
    }`,
        variables: { vehicleId },
      };
    
      return (await gql(GRAPHQL_CHARGING, body, chargingHeaders())).getLiveSessionData;
    }
  • mcp-server.js:505-519 (registration)
    The MCP server tool registration for 'rivian_get_charging_session', defining the tool schema (accepts vehicle_id parameter) and the handler function that authenticates, calls getLiveChargingSession, and formats the response.
    server.tool(
      'rivian_get_charging_session',
      'Check on an active charging session — power, battery level, time remaining, and cost.',
      {
        vehicle_id: z.string().describe('Vehicle ID from your account info'),
      },
      async ({ vehicle_id }) => {
        try {
          requireAuth();
          return text(formatChargingSession(await rivian.getLiveChargingSession(vehicle_id)));
        } catch (err) {
          return text(err.message);
        }
      },
    );
  • The formatChargingSession helper function that formats the raw charging session data from the API into a human-readable text format with battery level, power, range added, energy charged, time, cost, and charger state.
    function formatChargingSession(data) {
      if (!data) return 'No active charging session.';
    
      const lines = ['Charging Session'];
    
      const add = (label, entry, suffix = '') => {
        const value = entry?.value;
        if (value !== undefined && value !== null) lines.push(`  ${label}: ${value}${suffix}`);
      };
    
      add('Battery', data.soc, '%');
      add('Power', data.power, ' kW');
      add('Range added', data.rangeAddedThisSession, ' miles');
      add('Energy charged', data.totalChargedEnergy, ' kWh');
      add('Current', data.current, ' A');
      if (data.timeElapsed) lines.push(`  Time elapsed: ${data.timeElapsed}`);
      add('Time remaining', data.timeRemaining, ' min');
    
      if (data.isRivianCharger) lines.push('  Network: Rivian Adventure Network');
      if (data.isFreeSession) {
        lines.push('  Cost: Free');
      } else if (data.currentPrice) {
        lines.push(`  Cost so far: ${data.currentCurrency || '$'}${data.currentPrice}`);
      }
    
      add('Charger state', data.vehicleChargerState);
    
      return lines.join('\n');
    }
  • The chargingHeaders helper function that provides the authentication headers required for API calls to the Rivian charging GraphQL endpoint.
    function chargingHeaders() {
      return { 'U-Sess': userSessionToken };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions checking metrics but lacks behavioral details like whether it requires authentication, has rate limits, returns real-time or cached data, or handles errors. The description does not contradict annotations.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the purpose and lists key metrics without unnecessary details. Every word contributes to understanding the tool's function.

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

Completeness2/5

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

Given no annotations, no output schema, and a single parameter, the description is incomplete. It lacks details on authentication requirements, response format, error handling, and how it differs from sibling tools, making it inadequate for full contextual understanding.

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

Parameters3/5

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

The input schema has 100% coverage with a clear description for 'vehicle_id'. The description adds no parameter-specific semantics beyond implying the tool operates on a vehicle, which is already covered by the schema. With high schema coverage, the baseline score of 3 is appropriate.

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 with a specific verb ('Check') and resource ('active charging session'), listing key metrics like power, battery level, time remaining, and cost. It distinguishes itself from siblings by focusing on charging sessions, but does not explicitly contrast with similar tools like 'rivian_get_vehicle_state'.

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 implies usage for monitoring active charging sessions, but provides no explicit guidance on when to use this tool versus alternatives (e.g., 'rivian_get_vehicle_state' might also provide battery info). There are no prerequisites mentioned, such as requiring an active session or authentication state.

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/PatrickHeneise/rivian-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server