edit_flight_source
Edit a Flight's source_code by applying one or more text replacements, then save as a new FlightVersion. The tool reads the current source, applies the edits in sequence, validates the result, and persists.
You are responsible for the code you run. Flights does not scan customer code. Avoid untrusted code and treat source edits as a security-sensitive change.
Use this when you want to change a small part of a Flight without resending the entire file through update_flight.
Description
Each edit is a {old_string, new_string, replace_all?} object. old_string must occur exactly once in the source unless replace_all is true. Edits apply sequentially: edit N sees the source after edits 1 through N-1.
No prior get_flight call is required — the tool reads the current source itself.
This tool is MCP-only; there is no direct SQL equivalent. To achieve the same outcome in SQL, read the source through MD_GET_FLIGHT, modify it client-side, and call MD_UPDATE_FLIGHT with the full updated source.
Input parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | Yes | The Flight UUID. |
edits | array | Yes | List of edit objects (see below). Must contain at least one. |
Each entry in edits:
| Field | Type | Required | Description |
|---|---|---|---|
old_string | string | Yes | Exact text to find and replace. Must be unique in the source unless replace_all is true. |
new_string | string | Yes | The replacement text. Must differ from old_string. |
replace_all | boolean | No | If true, replace every occurrence. Default false. |
Output schema
{
"success": boolean,
"flight": {
"id": string,
"name": string,
"current_version": number
},
"error": string
}
Example usage
Change one line:
{
"id": "80000000-...",
"edits": [
{
"old_string": "duckdb==1.5.2",
"new_string": "duckdb==1.5.3"
}
]
}
Rename every occurrence of a variable:
{
"id": "80000000-...",
"edits": [
{
"old_string": "raw_table",
"new_string": "raw_events",
"replace_all": true
}
]
}
Related
update_flight— Send a full replacement source.get_flight— Inspect the source before editing.list_flight_versions— See the versions created by edits.