list_directory
List a directory. A directory of a tree: its index.md (when it has one), its subdirectories, and the concepts directly in it. Omit the path for the tree’s root; omit the tree to list the trees. Read-only.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
tree |
string | No | The tree’s slug, as list_trees gives it (not its name). The tree to list; omit to list the trees. |
path |
string | No | Directory, e.g. product; omit for the root. |
Returns
Section titled “Returns”One JSON object (see All tools):
| Field | Type | Always | Description |
|---|---|---|---|
tree |
Tree reference | No | The tree, and the commit it was read at. |
path |
string | No | The directory listed; empty for the root. |
index |
string | No | The directory’s index.md, when it has one. |
url |
string | No | The directory’s page in OKForest. |
directories |
list of objects | No | Its subdirectories. |
directories[].path |
string | Yes | The subdirectory’s path in the tree. |
directories[].concepts |
number | Yes | How many concepts are in it, at any depth. |
directories[].url |
string | Yes | Its page in OKForest. |
concepts |
list of Concept summary | No | The concepts directly in it. |
account |
Account | No | Without tree: the account whose Forest this is. |
trees |
list of Tree | No | Without tree: the account’s trees. |
Example
Section titled “Example”Asked “What’s in the company tree?”, an assistant might call list_directory with:
{ "tree": "company"}On OKForest’s test Forest (Acme’s made-up company knowledge), it returns:
{ "tree": { "slug": "company", "repo": "acme/acme-okf", "commit": "abc1234abc1234abc1234abc1234abc1234abc1", "url": "https://app.okforest.ai/@/3f2b8c1e-9a4d-4c7b-8e2f-6d1a0b5c9e7f/company/" }, "path": "", "index": "---\nokf_version: \"0.2\"\n---\n# Acme knowledge\n\n## Customers\n\n* [Acme Corp](customers/acme-corp.md) - Our largest retail customer.\n", "directories": [ { "path": "competitors", "concepts": 1, "url": "https://app.okforest.ai/@/3f2b8c1e-9a4d-4c7b-8e2f-6d1a0b5c9e7f/company/competitors/" }, { "path": "customers", "concepts": 1, "url": "https://app.okforest.ai/@/3f2b8c1e-9a4d-4c7b-8e2f-6d1a0b5c9e7f/company/customers/" }, { "path": "policies", "concepts": 1, "url": "https://app.okforest.ai/@/3f2b8c1e-9a4d-4c7b-8e2f-6d1a0b5c9e7f/company/policies/" } ], "concepts": [], "url": "https://app.okforest.ai/@/3f2b8c1e-9a4d-4c7b-8e2f-6d1a0b5c9e7f/company/"}