# Toml10 format

`toml10-format` · version 1.0.0 · Structured formats · free, no key needed

Emit canonical TOML 1.0 source from a typed document tree.

**Use when you need to: emit canonical toml 1.0 from typed nodes · typed toml document to source text · serialize toml tables without retagging keys.**

## Decide before calling

Read the [versioned contract](/v1/tools/toml10-format/versions/1.0.0) and the supported scope below. Reuse `toml10-format@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `toml10-format@1.0.0` for emit canonical toml 1.0 from typed nodes. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- emit canonical toml 1.0 from typed nodes
- typed toml document to source text
- serialize toml tables without retagging keys
- format inline toml tables and arrays
- write exact integer text into toml 1.0
- deterministic toml 1.0 document layout

## Not supported

- parse toml source text
- preserve comments or the original key spacing
- emit toml 1.1 inline-table newlines

## Behavior

- Input is the typed tree, not TOML source and not an ordinary JSON object. A {$toml, value} object without kind is invalid_input and is not emitted.
- Within each standard table, direct values come first in entry order, then subtables and arrays of tables in entry order. Inline tables are emitted as braces, including nested inline tables.
- Integer, float, and datetime text must already be canonical. Keys use bare form only for ASCII letters, digits, underscore, and hyphen. Strings use basic quotes. LF line endings and one trailing newline when not empty.
- max_input_bytes counts UTF-8 bytes of JSON.stringify(input) before the tree is walked. Depth, nodes, and output bytes use the same caps as the parser.
- The layout is deterministic. Comments and original spacing are not part of the tree, so they are not restored.

## Input

- `document` (object, required)

## Output

- `toml` (string, required)

## Limits

- max input bytes: 4096
- max output bytes: 16384
- max depth: 8
- max nodes: 48

## Example

Request input:

```json
{
  "document": {
    "kind": "table",
    "inline": false,
    "entries": [
      {
        "key": "bool1",
        "value": {
          "kind": "bool",
          "value": true
        }
      }
    ]
  }
}
```

Response:

```json
{
  "result": {
    "toml": "bool1 = true\n"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "toml10-format",
  "version": "1.0.0",
  "input": {
    "document": {
      "kind": "table",
      "inline": false,
      "entries": [
        {
          "key": "bool1",
          "value": {
            "kind": "bool",
            "value": true
          }
        }
      ]
    }
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/toml10-format/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"document":{"kind":"table","inline":false,"entries":[{"key":"bool1","value":{"kind":"bool","value":true}}]}}'
```

The machine-readable contract is at [/v1/tools/toml10-format/versions/1.0.0](/v1/tools/toml10-format/versions/1.0.0).

### CLI

```sh
node cli.mjs run toml10-format 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Toml10 parse](/tools/toml10-parse): Parse TOML 1.0 into typed nodes with exact int64, floats, and datetimes.
- [INI win format](/tools/ini-win-format): Format sections and keys into stable Windows initialization-file text.
- [Gitconfig format](/tools/gitconfig-format): Format git config sections as canonical text with escapes and subsections.
- [Toml10 validate](/tools/toml10-validate): Check a TOML 1.0 document and locate the first structural error.
- [Asn1 der encode tree](/tools/asn1-der-encode-tree): Encode a schema-free ASN.1 node list as one canonical DER value.
- [Asn1 der primitive encode](/tools/asn1-der-primitive-encode): Encode one universal DER primitive from typed fields into lowercase hex.
