# get_flight_run_logs
> Fetch the logs and run record for a single Flight run.
Fetch the plain-text combined stdout and stderr of a [Flight](/concepts/flights) run, plus the matching `Run` record (status, exit code, timing). The response also reports whether the log was truncated.

The SQL equivalent is [`MD_FLIGHT_LOGS`](/sql-reference/motherduck-sql-reference/flights/md-flight-logs) — note that the SQL surface returns only the logs, while this MCP tool also returns the run record.

## Description

Use `get_flight_run_logs` to interpret a failed run without a follow-up call: status, exit code, and timing arrive in the same response as the log content. For runs with large logs, pass `max_bytes` to cap the response size; the response returns the tail and sets `truncated: true`.

## Input parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string (UUID) | Yes | The Flight UUID. |
| `run_number` | integer | Yes | Sequential run number from [`list_flight_runs`](../list-flight-runs). |
| `max_bytes` | integer | No | Maximum log bytes to return. Minimum 1024. Truncation returns the tail. |

## Output schema

```json
{
  "success": boolean,
  "run": {
    "flight_id": string,
    "run_number": number,
    "flight_version": number,
    "status": string,        // PENDING | RUNNING | SUCCEEDED | FAILED | CANCELLED
    "exit_code": number|null,
    "created_at": string,
    "started_at": string|null,
    "completed_at": string|null
  },
  "logs": string,            // Combined stdout + stderr
  "truncated": boolean,      // True if max_bytes truncated the log
  "error": string
}
```

## Example usage

Read the full logs for run 42:

```json
{ "id": "80000000-...", "run_number": 42 }
```

Read only the last 4 KB:

```json
{ "id": "80000000-...", "run_number": 42, "max_bytes": 4096 }
```

## Related

- [`list_flight_runs`](../list-flight-runs) — Find the `run_number` to read.
- [`MD_FLIGHT_LOGS`](/sql-reference/motherduck-sql-reference/flights/md-flight-logs) — SQL equivalent (logs only).


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `POST https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

Payload:

```json
{
  "page_path": "/sql-reference/mcp/get-flight-run-logs/",
  "page_title": "get_flight_run_logs",
  "text": "<the user's feedback, max 2000 characters>",
  "source": "<optional identifier for your interface, for example 'claude.ai' or 'chatgpt'>"
}
```

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed payloads, and `429` when rate-limited.
