thermoworks_get_devices
Retrieve connected ThermoWorks devices for BBQ temperature monitoring. Lists serial numbers, names, and types after authentication.
Instructions
Get a list of all ThermoWorks devices connected to your account.
Requires authentication first via thermoworks_authenticate.
Args:
response_format: 'markdown' or 'json'
Returns: List of devices with serial numbers, names, and types.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| response_format | No | Output format | markdown |
Implementation Reference
- src/index.ts:1151-1197 (handler)Executes the tool logic: authenticates via client, fetches devices, formats as markdown list or JSON.async (params: GetDevicesInput) => { try { const client = getThermoWorksClient(); if (!client.isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Use `thermoworks_authenticate` first.", }, ], }; } const devices = await client.getDevices(); if (params.response_format === "json") { return { content: [{ type: "text", text: JSON.stringify(devices, null, 2) }], structuredContent: { devices }, }; } let markdown = `## 📱 ThermoWorks Devices\n\n`; if (devices.length === 0) { markdown += `No devices found.\n`; } else { for (const device of devices) { markdown += `### ${device.name}\n`; markdown += `- **Type:** ${device.type}\n`; markdown += `- **Serial:** ${device.serial}\n\n`; } } return { content: [{ type: "text", text: markdown }], }; } catch (error) { const message = error instanceof Error ? error.message : "Failed to get devices"; return { isError: true, content: [{ type: "text", text: `Error: ${message}` }], }; } }
- src/schemas/auth.ts:33-39 (schema)Input schema validating response_format parameter (markdown or json).export const GetDevicesSchema = z .object({ response_format: ResponseFormatSchema.describe("Output format"), }) .strict(); export type GetDevicesInput = z.infer<typeof GetDevicesSchema>;
- src/index.ts:1130-1150 (registration)Registers the tool with MCP server, including metadata, schema reference, and handler function.server.registerTool( "thermoworks_get_devices", { title: "Get ThermoWorks Devices", description: `Get a list of all ThermoWorks devices connected to your account. Requires authentication first via thermoworks_authenticate. Args: - response_format: 'markdown' or 'json' Returns: List of devices with serial numbers, names, and types.`, inputSchema: GetDevicesSchema, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, },
- src/services/thermoworks.ts:156-188 (helper)Core helper function that fetches the list of devices from ThermoWorks Firebase Realtime Database using the authenticated ID token.export async function getDevices( idToken: string, userId: string, useSmokeLegacy = false ): Promise<ThermoWorksDevice[]> { const config = useSmokeLegacy ? THERMOWORKS_SMOKE_FIREBASE_CONFIG : THERMOWORKS_FIREBASE_CONFIG; // ThermoWorks stores device data under the user's ID const response = await fetch( `${config.databaseURL}/users/${userId}/devices.json?auth=${idToken}` ); if (!response.ok) { throw new Error("Failed to fetch devices. Token may be expired."); } const data = await response.json(); if (!data) { return []; } // Convert Firebase object to array return Object.entries(data).map(([serial, device]: [string, unknown]) => { const d = device as Record<string, unknown>; return { serial, name: (d.name as string) || serial, type: (d.type as string) || "Unknown", lastUpdated: new Date(), }; }); }
- src/services/thermoworks.ts:350-353 (helper)ThermoWorksClient method wrapper that ensures token validity before calling low-level getDevices.async getDevices(): Promise<ThermoWorksDevice[]> { await this.ensureValidToken(); return getDevices(this.idToken!, this.userId!, this.useSmokeLegacy); }