rivian_get_user_info
Retrieve Rivian account details including vehicle information, software versions, and user profile data through the Rivian MCP server.
Instructions
Look up your Rivian account — your vehicles, software versions, and account details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp-server.js:454-466 (registration)MCP server tool registration for 'rivian_get_user_info' - defines the tool name, description, and async handler that calls rivian.getUserInfo() and formats the response.server.tool( 'rivian_get_user_info', 'Look up your Rivian account — your vehicles, software versions, and account details.', {}, async () => { try { requireAuth(); return text(formatUserInfo(await rivian.getUserInfo())); } catch (err) { return text(err.message); } }, );
- lib/rivian.js:114-157 (handler)Core implementation of getUserInfo() - constructs and executes a GraphQL query to fetch current user data including vehicles, their details, and OTA information from the Rivian API.export async function getUserInfo() { const body = { operationName: 'getUserInfo', query: `query getUserInfo { currentUser { __typename id firstName lastName email vehicles { id vin name roles state createdAt updatedAt vas { __typename vasVehicleId vehiclePublicKey } vehicle { __typename id vin modelYear make model expectedBuildDate plannedBuildDate otaEarlyAccessStatus currentOTAUpdateDetails { url version locale } availableOTAUpdateDetails { url version locale } vehicleState { supportedFeatures { __typename name status } } } } registrationChannels { type } } }`, variables: null, }; return (await gql(GRAPHQL_GATEWAY, body, authHeaders())).currentUser; }
- mcp-server.js:64-95 (helper)formatUserInfo() helper function - formats the raw user info data into human-readable text, displaying user details and vehicle information including model, VIN, OTA status, and software versions.function formatUserInfo(user) { const lines = [`${user.firstName} ${user.lastName} (${user.email})`, '']; if (!user.vehicles?.length) { lines.push('No vehicles on this account.'); return lines.join('\n'); } for (const v of user.vehicles) { const car = v.vehicle; lines.push(v.name || car.model); lines.push(` ${car.modelYear} ${car.make} ${car.model}`); lines.push(` VIN: ${v.vin}`); lines.push(` Vehicle ID: ${v.id}`); if (car.otaEarlyAccessStatus) { lines.push(` OTA early access: ${car.otaEarlyAccessStatus === 'OPTED_IN' ? 'Yes' : 'No'}`); } if (car.currentOTAUpdateDetails) { lines.push(` Software: v${car.currentOTAUpdateDetails.version}`); } if (car.availableOTAUpdateDetails) { lines.push(` Update available: v${car.availableOTAUpdateDetails.version}`); lines.push(` Release notes: ${car.availableOTAUpdateDetails.url}`); } else { lines.push(' Software is up to date'); } lines.push(''); } return lines.join('\n').trim(); }
- lib/rivian.js:284-311 (helper)gql() helper function - handles HTTP POST requests to the Rivian GraphQL API, including header construction, error handling, and response parsing.async function gql(url, body, extraHeaders = {}) { const res = await fetch(url, { method: 'POST', headers: { ...BASE_HEADERS, 'dc-cid': `m-ios-${crypto.randomUUID()}`, ...extraHeaders, }, body: JSON.stringify(body), }); const json = await res.json(); if (json.errors?.length) { const e = json.errors[0]; const msg = e.message || e.extensions?.code || 'Unknown GraphQL error'; const err = new Error(msg); err.code = e.extensions?.code; err.reason = e.extensions?.reason; throw err; } if (!res.ok) { throw new Error(`HTTP ${res.status}`); } return json.data; }
- lib/rivian.js:276-278 (helper)authHeaders() helper function - constructs authentication headers using session tokens (A-Sess and U-Sess) required for authenticated API requests.function authHeaders() { return { 'A-Sess': appSessionToken, 'U-Sess': userSessionToken }; }