thermoworks_check_auth
Verify ThermoWorks Cloud authentication status and token expiry for real-time BBQ temperature monitoring and cooking guidance.
Instructions
Check if you're currently authenticated with ThermoWorks Cloud.
Returns: Authentication status and token expiry time.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1090-1123 (handler)Handler function that checks the current ThermoWorks authentication status using the client singleton. Returns formatted markdown response with structured content indicating authentication state, user ID, and token expiry.async (_params: CheckAuthStatusInput) => { const client = getThermoWorksClient(); const isAuth = client.isAuthenticated(); const authInfo = client.getAuthInfo(); if (!isAuth) { return { content: [ { type: "text", text: `## 🔒 Not Authenticated\n\nUse \`thermoworks_authenticate\` to connect to ThermoWorks Cloud.`, }, ], structuredContent: { authenticated: false }, }; } const output = { authenticated: true, userId: authInfo.userId, tokenExpiry: authInfo.tokenExpiry?.toISOString(), tokenValid: authInfo.tokenExpiry ? authInfo.tokenExpiry > new Date() : false, }; return { content: [ { type: "text", text: `## ✅ Authenticated\n\n**User ID:** ${authInfo.userId}\n**Token Expires:** ${authInfo.tokenExpiry?.toLocaleString()}`, }, ], structuredContent: output, }; }
- src/index.ts:1074-1124 (registration)Registers the thermoworks_check_auth tool with the MCP server, providing title, description, input schema, annotations, and the inline handler function.server.registerTool( "thermoworks_check_auth", { title: "Check ThermoWorks Auth Status", description: `Check if you're currently authenticated with ThermoWorks Cloud. Returns: Authentication status and token expiry time.`, inputSchema: CheckAuthStatusSchema, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async (_params: CheckAuthStatusInput) => { const client = getThermoWorksClient(); const isAuth = client.isAuthenticated(); const authInfo = client.getAuthInfo(); if (!isAuth) { return { content: [ { type: "text", text: `## 🔒 Not Authenticated\n\nUse \`thermoworks_authenticate\` to connect to ThermoWorks Cloud.`, }, ], structuredContent: { authenticated: false }, }; } const output = { authenticated: true, userId: authInfo.userId, tokenExpiry: authInfo.tokenExpiry?.toISOString(), tokenValid: authInfo.tokenExpiry ? authInfo.tokenExpiry > new Date() : false, }; return { content: [ { type: "text", text: `## ✅ Authenticated\n\n**User ID:** ${authInfo.userId}\n**Token Expires:** ${authInfo.tokenExpiry?.toLocaleString()}`, }, ], structuredContent: output, }; } );
- src/schemas/auth.ts:84-86 (schema)Zod schema defining the input for the tool (empty object since no parameters are required). Includes TypeScript type inference.export const CheckAuthStatusSchema = z.object({}).strict(); export type CheckAuthStatusInput = z.infer<typeof CheckAuthStatusSchema>;
- src/services/thermoworks.ts:385-390 (helper)Singleton factory that provides the ThermoWorksClient instance used by the handler to check authentication status.export function getThermoWorksClient(useSmokeLegacy = false): ThermoWorksClient { if (!globalClient) { globalClient = new ThermoWorksClient(useSmokeLegacy); } return globalClient; }
- src/services/thermoworks.ts:326-328 (helper)ThermoWorksClient method called by the handler to determine if currently authenticated.isAuthenticated(): boolean { return this.idToken !== null && this.userId !== null; }