Skip to main content
Glama

rivian_submit_otp

Submit verification codes to complete Rivian account authentication and access vehicle monitoring tools.

Instructions

Complete Rivian sign-in with the verification code sent to your phone or email.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
otp_codeYesThe verification code

Implementation Reference

  • mcp-server.js:426-450 (registration)
    Tool registration for 'rivian_submit_otp' - defines the tool name, description, input schema (otp_code parameter), and the async handler that orchestrates OTP validation by calling rivian.validateOtp() and saving the session.
    server.tool(
      'rivian_submit_otp',
      'Complete Rivian sign-in with the verification code sent to your phone or email.',
      { otp_code: z.string().describe('The verification code') },
      async ({ otp_code }) => {
        const email = process.env.RIVIAN_EMAIL;
        if (!email) {
          return text('RIVIAN_EMAIL is not configured.');
        }
    
        if (!rivian.needsOtp()) {
          return text('No pending verification. Start with rivian_login first.');
        }
    
        try {
          await rivian.validateOtp(email, otp_code);
          saveSession();
          return text('Signed in to Rivian successfully.');
        } catch (err) {
          return text(
            `Verification failed: ${err.message}. You may need to start over with rivian_login.`,
          );
        }
      },
    );
  • Core implementation of validateOtp function - executes GraphQL mutation LoginWithOTP to verify the OTP code with Rivian's API, stores the returned access/refresh/user session tokens, and clears the otpToken after successful validation.
    export async function validateOtp(email, otpCode) {
      const data = await gql(
        GRAPHQL_GATEWAY,
        {
          operationName: 'LoginWithOTP',
          query: `mutation LoginWithOTP($email: String!, $otpCode: String!, $otpToken: String!) {
      loginWithOTP(email: $email, otpCode: $otpCode, otpToken: $otpToken) {
        __typename
        ... on MobileLoginResponse {
          __typename
          accessToken
          refreshToken
          userSessionToken
        }
      }
    }`,
          variables: { email, otpCode, otpToken },
        },
        { 'Csrf-Token': csrfToken, 'A-Sess': appSessionToken },
      );
    
      accessToken = data.loginWithOTP.accessToken;
      refreshToken = data.loginWithOTP.refreshToken;
      userSessionToken = data.loginWithOTP.userSessionToken;
      otpToken = '';
    }
  • needsOtp helper function - checks if an OTP token is currently pending, used by the tool handler to determine if a verification is waiting for completion.
    export const needsOtp = () => !!otpToken;
    export const isAuthenticated = () => !!accessToken;

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