UNPKG

it-tools-mcp

Version:

MCP-compliant server access to over 100 IT tools and utilities commonly used by developers, system administrators, and IT professionals.

38 lines (37 loc) 1.14 kB
import { z } from "zod"; export function registerConvertJsonToml(server) { server.registerTool("convert_json_to_toml", { inputSchema: { json: z.string().describe("JSON string to convert"), }, // VS Code compliance annotations annotations: { title: "Convert Json To Toml", readOnlyHint: false } }, async ({ json }) => { try { const toml = await import("@iarna/toml"); const data = JSON.parse(json); const tomlResult = toml.stringify(data); return { content: [ { type: "text", text: `TOML result:\n${tomlResult}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error converting JSON to TOML: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }); }