Create Library Folder
library_create_folder · Tools · Documents
Create one Library folder inside an existing folder
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The folder's name, as shown in the Library tree. Example: 'Clients'. |
path | string[] | Yes | Folder path as an array of folder slugs or ids from the root, as library_list and every returned item give them, e.g. ['projects-ab12cd', 'q1-x9y8z7']; [] is the root. A folder's name is not a path segment. The folder the new folder is created in. |
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#
{ "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