agentbay_project_files
Get a complete list of files within a project, including their file paths and sizes. Provide the project ID to retrieve structured file details for inventory or management purposes.
Instructions
List all files in a project with paths and sizes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID |
Implementation Reference
- src/index.ts:1025-1037 (handler)The handler for the 'agentbay_project_files' tool. It calls the API endpoint /api/v1/projects/{projectId}/files, lists all files with paths and sizes, and formats the response.
server.tool( 'agentbay_project_files', 'List all files in a project with paths and sizes', { projectId: z.string().describe('Project ID') }, async ({ projectId }) => { const data = await apiGet(`/api/v1/projects/${projectId}/files`); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; const files = data.files || []; if (!files.length) return { content: [{ type: 'text' as const, text: 'No files in this project yet.' }] }; const text = files.map((f: any) => `${f.path} (${(f.sizeBytes / 1024).toFixed(1)}KB, v${f.version})`).join('\n'); return { content: [{ type: 'text' as const, text: `${files.length} files:\n\n${text}` }] }; } ); - src/index.ts:1025-1028 (schema)The schema for 'agentbay_project_files' defines a single required parameter 'projectId' of type string.
server.tool( 'agentbay_project_files', 'List all files in a project with paths and sizes', { projectId: z.string().describe('Project ID') }, - src/index.ts:1024-1037 (registration)The tool is registered via server.tool() call with the name 'agentbay_project_files' at line 1025.
// Tool 37: Project Files (list) server.tool( 'agentbay_project_files', 'List all files in a project with paths and sizes', { projectId: z.string().describe('Project ID') }, async ({ projectId }) => { const data = await apiGet(`/api/v1/projects/${projectId}/files`); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; const files = data.files || []; if (!files.length) return { content: [{ type: 'text' as const, text: 'No files in this project yet.' }] }; const text = files.map((f: any) => `${f.path} (${(f.sizeBytes / 1024).toFixed(1)}KB, v${f.version})`).join('\n'); return { content: [{ type: 'text' as const, text: `${files.length} files:\n\n${text}` }] }; } );