list_documents
Retrieve all documents and folders from your Dynalist account to organize and access your content efficiently.
Instructions
List all documents and folders in your Dynalist account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/index.ts:161-189 (handler)The handler function that lists all documents and folders by calling client.listFiles(), filtering and mapping them, building URLs, and returning a JSON-formatted text content response.async () => { const response = await client.listFiles(); const documents = response.files .filter((f) => f.type === "document") .map((f) => ({ id: f.id, title: f.title, url: buildDynalistUrl(f.id), permission: getPermissionLabel(f.permission), })); const folders = response.files .filter((f) => f.type === "folder") .map((f) => ({ id: f.id, title: f.title, children: f.children, })); return { content: [ { type: "text", text: JSON.stringify({ documents, folders, root_file_id: response.root_file_id }, null, 2), }, ], }; }
- src/tools/index.ts:157-190 (registration)Registration of the list_documents tool using server.tool(), with empty input schema {} and inline handler function.server.tool( "list_documents", "List all documents and folders in your Dynalist account", {}, async () => { const response = await client.listFiles(); const documents = response.files .filter((f) => f.type === "document") .map((f) => ({ id: f.id, title: f.title, url: buildDynalistUrl(f.id), permission: getPermissionLabel(f.permission), })); const folders = response.files .filter((f) => f.type === "folder") .map((f) => ({ id: f.id, title: f.title, children: f.children, })); return { content: [ { type: "text", text: JSON.stringify({ documents, folders, root_file_id: response.root_file_id }, null, 2), }, ], }; } );
- src/tools/index.ts:999-1014 (helper)Helper function getPermissionLabel used within the list_documents handler to convert numeric permission to readable label.function getPermissionLabel(permission: number): string { switch (permission) { case 0: return "none"; case 1: return "read"; case 2: return "edit"; case 3: return "manage"; case 4: return "owner"; default: return "unknown"; } }