Skip to main content
Glama

IT Tools MCP Server

index.ts2.16 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; export function registerConvertTemperature(server: McpServer) { server.registerTool("convert_temperature", { description: "Convert temperatures between Celsius, Fahrenheit, and Kelvin", inputSchema: { temperature: z.number().describe("Temperature value to convert"), from: z.enum(["celsius", "fahrenheit", "kelvin"]).describe("Source temperature unit"), to: z.enum(["celsius", "fahrenheit", "kelvin"]).describe("Target temperature unit") }, // VS Code compliance annotations annotations: { title: "Convert Temperature", description: "Convert temperatures between Celsius, Fahrenheit, and Kelvin", readOnlyHint: false } }, async ({ temperature, from, to }) => { try { // Convert to Celsius first let celsius: number; switch (from) { case "celsius": celsius = temperature; break; case "fahrenheit": celsius = (temperature - 32) * 5 / 9; break; case "kelvin": celsius = temperature - 273.15; break; default: throw new Error("Invalid source unit"); } // Convert from Celsius to target unit let result: number; switch (to) { case "celsius": result = celsius; break; case "fahrenheit": result = celsius * 9 / 5 + 32; break; case "kelvin": result = celsius + 273.15; break; default: throw new Error("Invalid target unit"); } return { content: [ { type: "text", text: `${temperature}° ${from} = ${result.toFixed(2)}° ${to}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error converting temperature: ${error instanceof Error ? error.message : 'Unknown error'}` } ] }; } } ); }

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/wrenchpilot/it-tools-mcp'

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