Skip to main content
Glama

Convert Temperature

bbq_convert_temperature
Read-onlyIdempotent

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);
      }
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide clear hints (readOnlyHint=true, destructiveHint=false, idempotentHint=true, openWorldHint=false), so the description does not need to repeat these. It adds value by including practical examples that illustrate the tool's behavior in real-world scenarios, but does not disclose additional traits like error handling or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement, followed by arg definitions and practical examples. Every sentence serves a purpose, with no redundant information, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity, rich annotations, and full schema coverage, the description is mostly complete. It lacks an output schema, but the examples implicitly show the expected result format. A minor gap is the absence of explicit error cases or edge-case handling, though this is less critical for a simple conversion tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with all parameters well-documented in the schema. The description adds minimal semantics beyond the schema, such as clarifying 'from_unit' and 'to_unit' in the examples, but does not provide significant additional meaning. The baseline of 3 is appropriate given the comprehensive schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Convert temperature') and resources involved ('between Fahrenheit and Celsius'), distinguishing it from sibling tools like 'bbq_analyze_temperature' or 'bbq_get_target_temperature' which perform different functions. The verb 'convert' is precise and the scope is well-defined.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implicitly defines usage context through the examples, showing when to use this tool for unit conversion tasks. However, it does not explicitly state when NOT to use it or name alternatives among sibling tools, such as 'bbq_analyze_temperature' for analysis rather than conversion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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