yaml_to_toml
Convert a YAML string to TOML format.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | Yes | YAML string to convert. The top-level value must be a mapping; null values and mixed-type sequences are not allowed. |
Response
| Field | Type | Description |
|---|---|---|
output | string | The converted TOML string. |
Example
{
"input": "name: Alice\nport: 8080\ndb:\n host: localhost\n"
}
Result:
{
"output": "name = \"Alice\"\nport = 8080\n\n[db]\nhost = \"localhost\"\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_yaml | The input string is not valid YAML. | tool error (isError) |
conversion_failed | The YAML is valid but cannot be represented as TOML (e.g. the top-level value is not a mapping, or it contains null or mixed-type sequences). | tool error (isError) |
internal_error | An unexpected server error. | protocol error (internal_error) |
Notes
- TOML does not support
nullvalues. Useyaml_to_jsonif the YAML may contain nulls. - Arrays must be homogeneous; mixed-type sequences are not allowed.
- The top-level YAML value must be a mapping; sequences and scalars at the top level are rejected.