rivian_get_drivers_and_keys
Retrieve a list of drivers, phone keys, and key fobs that have access to your Rivian vehicle.
Instructions
See who has access to your vehicle — drivers, phone keys, and key fobs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp-server.js:221-234 (registration)Registration of the 'rivian_get_drivers_and_keys' tool on the MCP server, with schema (empty) and the handler callback.
server.tool( 'rivian_get_drivers_and_keys', 'See who has access to your vehicle — drivers, phone keys, and key fobs.', {}, async () => { try { requireAuth() const vehicleId = await resolveVehicleId() return text(format.formatDriversAndKeys(await rivian.getDriversAndKeys(vehicleId))) } catch (err) { return text(err.message) } }, ) - lib/rivian-api.js:281-305 (handler)The 'getDriversAndKeys' function that executes the GraphQL query (DriversAndKeys) to fetch invited users, their devices (phone keys, fobs), and provisioning status from the Rivian API.
export async function getDriversAndKeys(vehicleId) { const body = { operationName: 'DriversAndKeys', query: `query DriversAndKeys($vehicleId: String) { getVehicle(id: $vehicleId) { __typename id vin invitedUsers { __typename ... on ProvisionedUser { firstName lastName email roles userId devices { type mappedIdentityId id hrid deviceName isPaired isEnabled } } ... on UnprovisionedUser { email inviteId status } } } }`, variables: { vehicleId }, } return (await gql(GRAPHQL_GATEWAY, body, authHeaders())).getVehicle } - lib/format.js:636-671 (helper)Formatting helper that transforms the raw API response into a human-readable string showing drivers, their roles, and paired/enabled phone keys and fobs.
export function formatDriversAndKeys(data) { const lines = [] if (data.vin) lines.push(section(`Vehicle ${data.vin}`)) else lines.push(section('Drivers & Keys')) if (!data.invitedUsers?.length) { lines.push(c.dim('No drivers or keys found.')) return lines.join('\n') } lines.push('') for (const user of data.invitedUsers) { if (user.firstName) { lines.push(` ${c.bold(`${user.firstName} ${user.lastName}`)} ${c.dim(`(${user.email})`)}`) if (user.roles?.length) lines.push(kv('Roles', user.roles.join(', '))) if (user.devices?.length) { for (const d of user.devices) { const name = d.deviceName || d.type const paired = d.isPaired ? c.green('paired') : c.red('not paired') const enabled = d.isEnabled ? c.green('enabled') : c.red('disabled') lines.push(` ${c.dim('└')} ${name} — ${paired}, ${enabled}`) } } } else { lines.push(` ${c.dim('○')} ${user.email} ${c.dim(`(invited, ${user.status})`)}`) } lines.push('') } return lines .filter((l) => l !== null) .join('\n') .trim() }