Skip to main content
Glama

thermoworks_get_devices

Retrieve connected ThermoWorks devices for BBQ temperature monitoring. Lists serial numbers, names, and device types to enable real-time tracking during cooking.

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
NameRequiredDescriptionDefault
response_formatNoOutput formatmarkdown

Implementation Reference

  • MCP tool handler: checks authentication, fetches devices using ThermoWorksClient, returns formatted 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/index.ts:1130-1150 (registration)
    Registers the thermoworks_get_devices tool with the MCP server, specifying metadata, input schema, and annotations.
    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,
        },
      },
  • Zod schema defining the tool's input parameters (response_format: markdown or json).
    export const GetDevicesSchema = z
      .object({
        response_format: ResponseFormatSchema.describe("Output format"),
      })
      .strict();
    
    export type GetDevicesInput = z.infer<typeof GetDevicesSchema>;
  • Low-level function to fetch the list of user devices from Firebase Realtime Database using 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(),
        };
      });
    }
  • ThermoWorksClient.getDevices(): Ensures valid token and delegates to low-level getDevices implementation.
    async getDevices(): Promise<ThermoWorksDevice[]> {
      await this.ensureValidToken();
      return getDevices(this.idToken!, this.userId!, this.useSmokeLegacy);
    }

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/jweingardt12/bbq-mcp'

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