# Create Library Folder Tool

`library_create_folder` creates one folder inside an existing Library folder, or returns the folder already there by that name.

## When to Use

The agent uses it when a document needs a folder that does not exist yet. It lists the folders with `library_list` first, because a folder for the subject may already exist somewhere else. Creating a folder is the only way one comes into being: `library_create` never creates the folders on its path.

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `path` | string[] | Yes | The parent folder as folder slugs or ids from the root; `[]` is the root. Every folder must already exist |
| `name` | string | Yes | The new folder's name, as shown in the Library tree |

## Returns

| Field | Type | Description |
|-------|------|-------------|
| `item` | object | The folder: `id`, `slug`, `name`, `kind` (`folder`), `path` (folder slugs), `path_names`, `icon`, `color`, `ai_access_policy`, `revision`, `created_at`, `updated_at`, `url` |
| `already_there` | boolean | `true` when the parent already held a folder with exactly this name: that folder is returned and nothing is created |

`url` is the folder's link. The agent gives it to the user when it reports the change, labelled with the folder's name rather than its path.

## Example Scenario

```json
{ "path": ["work-b3ncv7"], "name": "Clients" }
```

## Notes

- A folder is already there when a folder directly under the parent has exactly that name. Where there are several, the oldest is returned
- A parent folder that does not exist is refused, and nothing is created: `Folder 'nilo' not found. List the folders with library_list to find the path.`
- Like `library_create`, it checks no AI access policy on the parent folder
- Risk: write
