yaml_to_json
Convert a YAML string to pretty-printed JSON.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | Yes | YAML string to convert. |
Response
| Field | Type | Description |
|---|---|---|
output | string | The converted pretty-printed JSON string. |
Example
{
"input": "name: Alice\nage: 30\nactive: true\n"
}
Result:
{
"output": "{\n \"name\": \"Alice\",\n \"age\": 30,\n \"active\": true\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) |
internal_error | An unexpected server error. | protocol error (internal_error) |
Notes
- YAML timestamps and other non-JSON types are converted to strings.
- Multi-document YAML (separated by
---) is not supported and will cause an error.