cast_column
Change a column's type by deriving a NEW column from it: the fix when a write was refused for retyping a column (-31004). The source column stays as it was: write to the returned new_column_id from then on, and delete_column the original once you have checked the new one. Values that cannot convert become empty unless strict. An impossible cast (a category column only becomes text or a list) is refused naming both types; text is the universal fallback. name defaults to the source's name.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model_id": "<model_id>",
"table_id": "<table_id>",
"column_id": "<column_id>",
"to_type": "<to_type>"
},
"name": "cast_column"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name for the new column. Defaults to the source column's name. | |
| strict | No | Refuse the whole cast if any value does not convert, instead of leaving those cells empty in the new column. The refusal says how many. | |
| to_type | Yes | Target type, in the same spelling `describe_table` reports: "string", "i64", "f64", "bool", "date", … Call `list_column_types` to see which targets this column's current type can actually reach. | |
| model_id | Yes | ||
| table_id | Yes | ||
| column_id | Yes | Column to cast (a `column_id` from describe_table). | |
| expected_version | No | Optional optimistic-concurrency guard (see edit_rows). |