UNPKG

it-tools-mcp

Version:

Full MCP 2025-06-18 compliant server with 121+ IT tools, logging, ping, progress tracking, cancellation, and sampling utilities

40 lines (39 loc) 1.24 kB
import { z } from "zod"; export function registerConvertJsonToml(server) { server.registerTool("convert_json_to_toml", { description: "Convert JSON to TOML format", inputSchema: { json: z.string().describe("JSON string to convert"), }, // VS Code compliance annotations annotations: { title: "Convert Json To Toml", description: "Convert JSON to TOML format", 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'}`, }, ], }; } }); }