Skip to main content

edit_flight_source

Preview
This feature is in preview and is subject to change.

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

ParameterTypeRequiredDescription
idstring (UUID)YesThe Flight UUID.
editsarrayYesList of edit objects (see below). Must contain at least one.

Each entry in edits:

FieldTypeRequiredDescription
old_stringstringYesExact text to find and replace. Must be unique in the source unless replace_all is true.
new_stringstringYesThe replacement text. Must differ from old_string.
replace_allbooleanNoIf 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
}
]
}