Skip to main content
Glama

rivian_login

Initiate Rivian account authentication to access vehicle data, requiring a verification code sent to your phone or email for completion.

Instructions

Log in to your Rivian account. Rivian will send a verification code to your phone or email — use rivian_submit_otp to complete sign-in.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • mcp-server.js:395-424 (registration)
    Tool registration for rivian_login using server.tool() with empty schema (no parameters) and async handler function that coordinates the login process.
    server.tool(
      'rivian_login',
      'Log in to your Rivian account. Rivian will send a verification code to your phone or email — use rivian_submit_otp to complete sign-in.',
      {},
      async () => {
        const email = process.env.RIVIAN_EMAIL;
        const password = process.env.RIVIAN_PASSWORD;
        if (!email || !password) {
          return text(
            'Rivian credentials are not configured. Set RIVIAN_EMAIL and RIVIAN_PASSWORD in your MCP server settings.',
          );
        }
    
        try {
          await rivian.createCsrfToken();
          const { mfa } = await rivian.login(email, password);
          saveSession();
    
          if (mfa) {
            return text(
              "A verification code has been sent to your phone or email. Tell me the code and I'll complete the sign-in.",
            );
          }
    
          return text('Signed in to Rivian successfully.');
        } catch (err) {
          return text(`Couldn't sign in: ${err.message}`);
        }
      },
    );
  • Handler function that retrieves RIVIAN_EMAIL and RIVIAN_PASSWORD from environment, calls rivian.createCsrfToken() and rivian.login(), saves session, and returns appropriate success or OTP prompt message.
    async () => {
      const email = process.env.RIVIAN_EMAIL;
      const password = process.env.RIVIAN_PASSWORD;
      if (!email || !password) {
        return text(
          'Rivian credentials are not configured. Set RIVIAN_EMAIL and RIVIAN_PASSWORD in your MCP server settings.',
        );
      }
    
      try {
        await rivian.createCsrfToken();
        const { mfa } = await rivian.login(email, password);
        saveSession();
    
        if (mfa) {
          return text(
            "A verification code has been sent to your phone or email. Tell me the code and I'll complete the sign-in.",
          );
        }
    
        return text('Signed in to Rivian successfully.');
      } catch (err) {
        return text(`Couldn't sign in: ${err.message}`);
      }
    },
  • createCsrfToken() helper that makes a GraphQL mutation to obtain a CSRF token and app session token required for authentication.
    export async function createCsrfToken() {
      const data = await gql(GRAPHQL_GATEWAY, {
        operationName: 'CreateCSRFToken',
        query: `mutation CreateCSRFToken {
      createCsrfToken {
        __typename
        csrfToken
        appSessionToken
      }
    }`,
        variables: null,
      });
      csrfToken = data.createCsrfToken.csrfToken;
      appSessionToken = data.createCsrfToken.appSessionToken;
    }
  • login(email, password) helper that performs the actual login via GraphQL mutation, handling both MFA (returns mfa: true with otpToken) and direct login (stores access/refresh tokens).
    export async function login(email, password) {
      const data = await gql(
        GRAPHQL_GATEWAY,
        {
          operationName: 'Login',
          query: `mutation Login($email: String!, $password: String!) {
      login(email: $email, password: $password) {
        __typename
        ... on MobileLoginResponse {
          __typename
          accessToken
          refreshToken
          userSessionToken
        }
        ... on MobileMFALoginResponse {
          __typename
          otpToken
        }
      }
    }`,
          variables: { email, password },
        },
        { 'Csrf-Token': csrfToken, 'A-Sess': appSessionToken },
      );
    
      if (data.login.otpToken) {
        otpToken = data.login.otpToken;
        return { mfa: true };
      }
    
      accessToken = data.login.accessToken;
      refreshToken = data.login.refreshToken;
      userSessionToken = data.login.userSessionToken;
      return { mfa: false };
    }
  • saveSession() helper that persists the rivian session state to a JSON file in the user's home directory for restoration across server restarts.
    function saveSession() {
      mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
      chmodSync(CONFIG_DIR, 0o700);
      const session = { ...rivian.exportSession(), savedAt: Date.now() };
      writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2), { mode: 0o600 });
      chmodSync(SESSION_FILE, 0o600);
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the authentication flow (Rivian sends verification code to phone/email) and the multi-step process, which is crucial context for an agent. However, it doesn't mention potential rate limits, timeout behavior, or error conditions.

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 perfectly concise with two sentences that each serve distinct purposes: the first states the core function, the second explains the workflow and references the complementary tool. There is zero wasted text.

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

Completeness4/5

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

For a zero-parameter authentication tool with no annotations or output schema, the description provides good contextual completeness by explaining the multi-step verification process. However, it doesn't specify what happens after successful login (e.g., session tokens, subsequent tool usage) or potential failure modes.

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 baseline is 4. The description appropriately doesn't discuss parameters since none exist, focusing instead on the authentication process.

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

Purpose5/5

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

The description clearly states the specific action ('Log in to your Rivian account') and identifies the resource ('Rivian account'), making the purpose explicit. It distinguishes this tool from its siblings by focusing on authentication rather than data retrieval or vehicle operations.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool (for logging in) and when to use an alternative (use rivian_submit_otp to complete sign-in after receiving verification). It clearly establishes the workflow relationship between these two tools.

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