Skip to content

convert

Convert a file from one format to another. Same surface as the CLI's octa --convert: both ends resolved by file extension, both routed through Octa's FormatRegistry.

When to use

  • "Convert this Excel to a clean Parquet."
  • "Export this SQLite table to CSV."
  • "Make a JSON copy of this Stata file."

Input schema

Parameter Type Required? Default Description
input string no* (no default) Source file path. Format inferred from extension
open_tab string no (no default) Convert an open GUI tab instead of input (name, or @active). Only in the Assistant.
output string yes (no default) Destination file path. Format inferred from extension
table string no (no default) For multi-table input sources, which table to export
unlimited bool no false Lift the 2,000,000-row file-loader cap so the entire source file is converted
sort array no none Sort the rows before writing: [{column, descending}], first key first
natural bool no false Sort text naturally (file2 before file10)

* input or open_tab is required.

sort orders the rows before they are written. A column the source does not have is refused with a message naming it.

Response shape

{
  "rows_written": <n>,
  "cols_written": <n>,
  "output": "<output_path>"
}

Example calls

CSV → Parquet

{
  "name": "convert",
  "arguments": {
    "input": "/tmp/sales.csv",
    "output": "/tmp/sales.parquet"
  }
}

Response:

{
  "rows_written": 14523,
  "cols_written": 7,
  "output": "/tmp/sales.parquet"
}

Export one SQLite table to JSON

{
  "name": "convert",
  "arguments": {
    "input": "/data/app.sqlite",
    "output": "/tmp/users.json",
    "table": "users"
  }
}

Excel → SQLite

{
  "name": "convert",
  "arguments": {
    "input": "/tmp/quarterly.xlsx",
    "output": "/tmp/quarterly.sqlite"
  }
}

Read-only target rejection

Octa rejects up-front when the output extension maps to a read-only reader:

Format Why read-only
SAS (.sas7bdat) sas7bdat 0.2 is read-only
Microsoft Access (.mdb, .accdb) jetdb is read-only
QlikView data (.qvd) Read-only by design
R datasets (.rds, .rdata, .rda) rds2rust is read-only
HDF5 (.h5, .hdf5, .hdf) hdf5-reader is read-only
MATLAB (.mat) Read-only by design
NetCDF (.nc) netcdf3 is read-only
EPUB (.epub) Read-only by design
GeoJSON (.geojson) Read-only by design

Trying to convert to one of these errors with:

{ "error": { "code": "invalid_params", "message": "convert failed: format SAS does not support writing; pick a different output extension" }}

These same formats are perfectly fine as input: convert input.sas7bdat output.csv is valid.

Performance and safety

  • The input is loaded fully into memory before writing. Streaming formats (Parquet, CSV, TSV) honour the initial-load cap during the read step (2,000,000 rows by default). For larger conversions, pass unlimited: true; without it the answer carries initial_load_capped and an initial_load_note. Parquet files with very many row groups fall back to a DuckDB-backed reader automatically.
  • A file read only in part is refused when output is that same file, since writing it back would cut it short.
  • convert overwrites the output path without prompting, so make sure the destination is what you intend.

Notes

  • Excel writes always produce .xlsx structure regardless of the chosen Excel extension, since rust_xlsxwriter can't emit legacy .xls / .xlsm / .xlsb. Save those as .xlsx. .ods has its own dedicated reader+writer so it round-trips natively.
  • Write options are the built-in defaults, not the ones saved in the app. Parquet output is zstd-compressed like everywhere else, but the MCP server does not read settings.toml for the CSV delimiter, quoting or row-group size: a server answering an agent has no reason to inherit one desktop user's preferences. Use the CLI --convert when you want the saved settings honoured.
  • Database outputs (SQLite, DuckDB, GeoPackage) write a single table named after the input's stem. Both run_sql (here) and octa --sql use ephemeral DuckDB sessions, so neither persists CREATE TABLE / INSERT to disk; use convert itself, or open the target database in the GUI to edit table names directly.

See also