Skip to main content

toml_to_json

Convert a TOML string to pretty-printed JSON.

Parameters​

ParameterTypeRequiredDescription
inputstringYesTOML string to convert.

Response​

FieldTypeDescription
outputstringThe converted pretty-printed JSON string.

Example​

{
"input": "name = \"Alice\"\nport = 8080\n\n[db]\nhost = \"localhost\"\n"
}

Result:

{
"output": "{\n \"db\": {\n \"host\": \"localhost\"\n },\n \"name\": \"Alice\",\n \"port\": 8080\n}"
}

Errors​

Each failure carries a precise code in the response. Argument-schema and server errors are JSON-RPC protocol errors; a rejected value is returned as a tool result with isError: true (so the agent can read the code and self-correct).

CodeWhenDelivered as
invalid_argumentsinput is missing or not a string.protocol error (invalid_params)
invalid_tomlThe input string is not valid TOML.tool error (isError)
internal_errorAn unexpected server error.protocol error (internal_error)

Notes​

  • TOML datetime values are serialized as strings in the JSON output.
  • Key ordering may differ from the input since TOML is an unordered format.