Skip to main content
Glama

bbq_convert_temperature

Convert temperature values between Fahrenheit and Celsius for BBQ cooking applications. Input temperature with source and target units to get accurate conversions.

Instructions

Convert temperature between Fahrenheit and Celsius.

Args:

  • temperature: Temperature value to convert

  • from_unit: Source unit ('fahrenheit' or 'celsius')

  • to_unit: Target unit ('fahrenheit' or 'celsius')

Examples:

  • "What is 225°F in Celsius?" -> temperature=225, from_unit='fahrenheit', to_unit='celsius'

  • "Convert 100°C to Fahrenheit" -> temperature=100, from_unit='celsius', to_unit='fahrenheit'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
temperatureYesTemperature value to convert
from_unitNoSource temperature unitfahrenheit
to_unitNoTarget temperature unitfahrenheit

Implementation Reference

  • Core temperature conversion logic: converts between Fahrenheit and Celsius with rounding to 1 decimal place.
    export function convertTemperature( temp: number, fromUnit: "fahrenheit" | "celsius", toUnit: "fahrenheit" | "celsius" ): number { if (fromUnit === toUnit) return temp; if (fromUnit === "fahrenheit" && toUnit === "celsius") { return Math.round(((temp - 32) * 5) / 9 * 10) / 10; } else { return Math.round((temp * 9) / 5 + 32); } }
  • Zod schema for input validation: temperature value and from/to units.
    export const ConvertTemperatureSchema = z .object({ temperature: z.number().describe("Temperature value to convert"), from_unit: TemperatureUnitSchema.describe("Source temperature unit"), to_unit: TemperatureUnitSchema.describe("Target temperature unit"), }) .strict(); export type ConvertTemperatureInput = z.infer<typeof ConvertTemperatureSchema>;
  • src/index.ts:911-964 (registration)
    MCP tool registration including title, description, input schema, annotations, and thin async handler that delegates to convertTemperature function.
    server.registerTool( "bbq_convert_temperature", { title: "Convert Temperature", description: `Convert temperature between Fahrenheit and Celsius. Args: - temperature: Temperature value to convert - from_unit: Source unit ('fahrenheit' or 'celsius') - to_unit: Target unit ('fahrenheit' or 'celsius') Examples: - "What is 225°F in Celsius?" -> temperature=225, from_unit='fahrenheit', to_unit='celsius' - "Convert 100°C to Fahrenheit" -> temperature=100, from_unit='celsius', to_unit='fahrenheit'`, inputSchema: ConvertTemperatureSchema, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async (params: ConvertTemperatureInput) => { try { const result = convertTemperature(params.temperature, params.from_unit, params.to_unit); const fromSymbol = params.from_unit === "fahrenheit" ? "°F" : "°C"; const toSymbol = params.to_unit === "fahrenheit" ? "°F" : "°C"; const output = { original: { value: params.temperature, unit: params.from_unit, }, converted: { value: result, unit: params.to_unit, }, display: `${params.temperature}${fromSymbol} = ${result}${toSymbol}`, }; return { content: [{ type: "text", text: output.display }], structuredContent: output, }; } catch (error) { const message = error instanceof Error ? error.message : "Unknown error occurred"; return { isError: true, content: [{ type: "text", text: `Error converting temperature: ${message}` }], }; } } );

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