it-tools-mcp
Version:
MCP-compliant server access to over 100 IT tools and utilities commonly used by developers, system administrators, and IT professionals.
37 lines (36 loc) • 1.12 kB
JavaScript
import { z } from "zod";
export function registerConvertTomlJson(server) {
server.registerTool("convert_toml_to_json", {
inputSchema: {
toml: z.string().describe("TOML string to convert"),
},
// VS Code compliance annotations
annotations: {
title: "Convert Toml To Json",
readOnlyHint: false
}
}, async ({ toml: tomlString }) => {
try {
const toml = await import("@iarna/toml");
const result = toml.parse(tomlString);
return {
content: [
{
type: "text",
text: `JSON result:\n${JSON.stringify(result, null, 2)}`,
},
],
};
}
catch (error) {
return {
content: [
{
type: "text",
text: `Error converting TOML to JSON: ${error instanceof Error ? error.message : 'Unknown error'}`,
},
],
};
}
});
}