toml_to_json
Convert a TOML string to pretty-printed JSON.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | Yes | TOML string to convert. |
Response
| Field | Type | Description |
|---|---|---|
output | string | The 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).
| Code | When | Delivered as |
|---|---|---|
invalid_arguments | input is missing or not a string. | protocol error (invalid_params) |
invalid_toml | The input string is not valid TOML. | tool error (isError) |
internal_error | An 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.