Skip to main content
Glama
lucas-1000

MCP Glucose Server

by lucas-1000

get_latest_glucose

Retrieve the most recent glucose reading for a user, including value, unit, timestamp, and data source to support diabetes management and health monitoring.

Instructions

Get the most recent glucose/blood sugar reading for a user. Returns value, unit, timestamp, and source.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdNoUser identifier. Defaults to user_12345abcdef67890 if not specified.

Implementation Reference

  • src/index.ts:57-71 (registration)
    Registration of the 'get_latest_glucose' tool including name, description, and input schema used in ListTools response.
    { name: 'get_latest_glucose', description: 'Get the most recent glucose/blood sugar reading for a user. Returns value, unit, timestamp, and source.', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: `User identifier. Defaults to ${DEFAULT_USER_ID || 'configured user'} if not specified.`, }, }, required: [], }, },
  • MCP tool handler for 'get_latest_glucose': extracts userId, calls api.getLatestGlucose, handles null case, and returns formatted JSON response.
    case 'get_latest_glucose': { const reading = await api.getLatestGlucose(userId); if (!reading) { return { content: [ { type: 'text', text: 'No glucose readings found for this user.', }, ], }; } return { content: [ { type: 'text', text: JSON.stringify( { value: reading.value, unit: reading.unit, date: reading.date, source: reading.source, }, null, 2 ), }, ], }; }
  • Helper function implementing the glucose retrieval logic by querying the storage API's /api/samples/latest endpoint with userId and type 'BloodGlucose'.
    async getLatestGlucose(userId: string): Promise<GlucoseReading | null> { try { const response = await this.client.get('/api/samples/latest', { params: { userId, type: 'BloodGlucose', }, }); const sample = response.data; return { value: sample.value, unit: sample.unit, date: sample.start_date, source: sample.source, }; } catch (error: any) { if (error.response?.status === 404) { return null; } throw error; } }

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/lucas-1000/mcp-glucose'

If you have feedback or need assistance with the MCP directory API, please join our Discord server