Skip to main content
Glama

toml-to-json

Convert TOML strings to JSON format for simplified data parsing and integration. A tool within the IT Tools MCP Server, designed for developers and system administrators.

Instructions

Convert TOML to JSON format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tomlYesTOML string to convert

Implementation Reference

  • Registration of the 'convert_toml_to_json' tool, which is the TOML to JSON converter. Includes inline schema and handler.
    export function registerConvertTomlJson(server: McpServer) { server.registerTool("convert_toml_to_json", { description: "Convert TOML to JSON format", inputSchema: { toml: z.string().describe("TOML string to convert"), }, // VS Code compliance annotations annotations: { title: "Convert Toml To Json", description: "Convert TOML to JSON format", 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'}`, }, ], }; } } ); }
  • The handler function that parses TOML input using @iarna/toml and returns formatted JSON or error.
    }, 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'}`, }, ], }; } } );
  • Zod schema for input: toml string.
    inputSchema: { toml: z.string().describe("TOML string to convert"), },

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

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