get_sensor_info
Check your active FreeStyle Libre sensor status, serial number, and activation date to determine if the sensor is working properly or requires replacement.
Instructions
Get information about your active FreeStyle Libre sensor including serial number, activation date, and status. Use this to check if sensor is working properly or needs replacement.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:349-365 (handler)The MCP tool handler for 'get_sensor_info'. It checks if the client is initialized, calls client.getSensorInfo(), and returns the formatted response with active_sensors and sensor_count.
case 'get_sensor_info': { if (!client) { throw new Error('LibreLinkUp not configured. Use configure_credentials first.'); } const sensors = await client.getSensorInfo(); return { content: [{ type: 'text', text: JSON.stringify({ active_sensors: sensors, sensor_count: sensors.length }, null, 2) }] }; } - src/index.ts:145-156 (registration)The tool registration definition for 'get_sensor_info'. Declares name, description, empty inputSchema (no parameters), and readOnlyHint annotation in the tools array.
{ name: 'get_sensor_info', description: 'Get information about your active FreeStyle Libre sensor including serial number, activation date, and status. Use this to check if sensor is working properly or needs replacement.', inputSchema: { type: 'object', properties: {}, required: [] }, annotations: { readOnlyHint: true } }, - src/librelink-client.ts:428-450 (helper)The getSensorInfo() method on LibreLinkClient. Fetches graph data, maps activeSensors to SensorInfo objects computing activation and expiration timestamps assuming 15-day sensor lifetime.
async getSensorInfo(): Promise<SensorInfo[]> { const data = await this.getGraphData(); return data.activeSensors.map(s => { // a is Unix timestamp in seconds (when sensor became active after warm-up) const activatedTimestamp = s.sensor.a * 1000; // Convert to milliseconds // Sensor lifetime depends on product type: // - Libre 2 Plus: 15 days // - Libre 3: 14 days // - Libre 2: 14 days // The 'w' field is NOT the lifetime - default to 15 days for Libre 2 Plus const SENSOR_LIFETIME_DAYS = 15; const expiresTimestamp = activatedTimestamp + (SENSOR_LIFETIME_DAYS * 24 * 60 * 60 * 1000); return { sn: s.sensor.sn, activatedOn: new Date(activatedTimestamp).toISOString(), expiresOn: new Date(expiresTimestamp).toISOString(), status: 'active' }; }); } - src/types.ts:52-57 (schema)The SensorInfo interface defining the shape: sn (serial number), activatedOn, expiresOn (ISO strings), and status.
export interface SensorInfo { sn: string; activatedOn: string; expiresOn: string; status: string; }