和 api.files.list(), , 现时 api.tools 以便“列出我所拥有的东西”可以作为工具交给一个模型。
返回值
[
{
id: "…", // the sourceId, to pass to readDocument()
name: "report.md",
category: "document", // document | image | audio | video
mimeType: "text/markdown",
size: 9118,
storageId: "…", // where it lives, or null
status: "ready",
createdAt: "2026-10-05T18:02:11.000Z"
}
]documents = api.tools.list_documents()
# {
# "computer": [{"name", "path", "type", "size"}], # ~/.iagenify/files
# "account": [{"id": "…", # the sourceId, for read_document()
# "name": "report.md", "category": "document",
# "mimeType": "text/markdown", "size": 9118,
# "storageId": "…", "status": "ready",
# "createdAt": "2026-10-05T18:02:11.000Z"}]
# }服务器布局没有显示
文件由文件的代号识别, 而不是在磁盘上路径识别。 这就是将一个能从任何地方( 您的脚本、 页面、 运行) 找到的代号保存在任何位置, 却不知道字节坐在哪里 。
列出什么,没有列出什么
| 名单清单 | 没有列出 |
|---|---|
文件保存通过 api.files | 电脑上的档案文件 files.list() |
| 为账户存储的附加附件 | 桶中的东西——这些是 run({ action: "list" }) |
| 生成和保存的媒体 | 手机浏览器里的任何信息 |
作为一种工具
它是少数没有争论的申报单之一,运行比一个光列出的单子更能说明问题:它用账户的文档回答问题 和 打电话者计算机的文件, 每个组名, 所以模型知道下一步要使用哪个标识符, 一个代号, 另一个路径。
tools: {
list_documents: api.tools.listDocuments,
read_document: api.tools.readDocument,
}
// What the model is told, in a run:
// { computer: { storage: "MacBook", files: [{ path, mimeType, size }] },
// server: [{ sourceId, name, mimeType }] }tools = {
"list_documents": api.tools.list_documents,
"read_document": api.tools.read_document,
}
# What the model is told, in a run:
# {"computer": {"storage": "MacBook", "files": [{"path", "mimeType", "size"}]},
# "server": [{"sourceId", "name", "mimeType"}]}错误
失败会引发服务器发送的信息。 没有空结果错误: 账户没有文件回答, 且没有空数组 。