> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://platform.bctrl.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://platform.bctrl.ai/_mcp/server.

# Collect Runtime file

> Collect a Runtime workspace file into durable File storage.

Copy a file from an active Runtime workspace into durable File storage. The
workspace file remains in place after collection.

## Collect a File

```ts
const result = await bctrl.tools.call("runtime.files.collect", {
  path: "reports/result.json",
  name: "checkout-result.json",
}, { runtimeId: runtime.id });

console.log(result.fileId, result.name, result.size);
```

The Runtime must be active. `path` is relative to the workspace root; absolute
paths and `..` segments are not allowed. Omit `name` to let the Tool derive the
durable File name.

## Request parameters

| Parameter | Type     | Required | Description                                                |
| --------- | -------- | -------- | ---------------------------------------------------------- |
| `path`    | `string` | Yes      | Workspace-relative source path, from 1 to 1024 characters. |
| `name`    | `string` | No       | Durable File name, from 1 to 255 characters.               |

## Response

| Field    | Type     | Always present | Description                                   |
| -------- | -------- | -------------- | --------------------------------------------- |
| `fileId` | `FileId` | Yes            | Durable File created from the workspace file. |
| `name`   | `string` | Yes            | Durable File name.                            |
| `size`   | `number` | Yes            | Number of bytes collected.                    |

## Next

* [Stage Runtime file](/sdk/tools/runtime/runtime-files-stage) — copy input files in
* [List Runtime files](/sdk/tools/runtime/runtime-files-list) — inspect the workspace
* [Files](/sdk/files) — manage the collected File