Skip to main content
Glama

bbq_convert_temperature

Convert temperature between Fahrenheit and Celsius for BBQ cooking. Use this tool to translate temperature units for recipes, grill settings, or meat doneness guidelines.

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

  • Main handler function for bbq_convert_temperature tool. Takes input params, calls convertTemperature helper, formats output with symbols, returns structured response or error.
    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}` }], }; } }
  • src/index.ts:911-932 (registration)
    Registration of the bbq_convert_temperature tool with server.registerTool, including title, detailed description, input schema, and annotations.
    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, }, },
  • Zod schema for input validation of the tool, defining temperature, from_unit, to_unit with descriptions. Exports type ConvertTemperatureInput.
    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>;
  • Core helper function implementing F to C and C to F conversion 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); } }

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