download_file
Download files from MinIO storage buckets to a specified local path by providing bucket name, object name, and file path. Integrates with MinIO Storage MCP for efficient object storage management.
Instructions
从存储桶下载文件
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucketName | Yes | 存储桶名称 | |
| filePath | Yes | 本地保存路径 | |
| objectName | Yes | 对象名称 |
Implementation Reference
- src/minio-client.ts:130-139 (handler)Core handler function that ensures connection, creates directory if needed, and downloads the file from MinIO bucket to local path using fGetObject.async downloadFile(bucketName: string, objectName: string, filePath: string): Promise<void> { this.ensureConnected(); const dir = path.dirname(filePath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } await this.client!.fGetObject(bucketName, objectName, filePath); }
- src/index.ts:434-450 (handler)MCP server tool handler that validates input arguments and delegates to MinIOStorageClient.downloadFile, returning success message.case 'download_file': { const { bucketName, objectName, filePath } = z.object({ bucketName: z.string(), objectName: z.string(), filePath: z.string() }).parse(args); await this.minioClient.downloadFile(bucketName, objectName, filePath); return { content: [ { type: 'text', text: `成功下载文件 ${bucketName}/${objectName} 到 ${filePath}` } ] }; }
- src/index.ts:149-161 (schema)Tool schema definition including name, description, and input schema registered in list_tools handler.{ name: 'download_file', description: '从存储桶下载文件', inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, objectName: { type: 'string', description: '对象名称' }, filePath: { type: 'string', description: '本地保存路径' } }, required: ['bucketName', 'objectName', 'filePath'] } },