Skip to main content
Glama

download_files

Download multiple files from MinIO storage buckets simultaneously by specifying file objects and local save paths. Streamlines batch file retrieval for efficient storage management.

Instructions

批量下载文件

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketNameYes存储桶名称
filesYes文件列表

Implementation Reference

  • MCP request handler for the 'download_files' tool. Validates input arguments using Zod, delegates to MinIO client for execution, and formats a response with success/failure counts and errors.
    case 'download_files': { const { bucketName, files } = z.object({ bucketName: z.string(), files: z.array(z.object({ objectName: z.string(), localPath: z.string() })) }).parse(args); const result = await this.minioClient.downloadFiles(bucketName, files); return { content: [ { type: 'text', text: `批量下载完成: 成功 ${result.successCount} 个, 失败 ${result.failureCount} 个${result.errors.length > 0 ? '\n错误:\n' + result.errors.map(e => `- ${e.item}: ${e.error}`).join('\n') : ''}` } ] }; }
  • src/index.ts:255-277 (registration)
    Registration of the 'download_files' tool in the MCP server tools list, including name, description, and input schema definition.
    { name: 'download_files', description: '批量下载文件', inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, files: { type: 'array', items: { type: 'object', properties: { objectName: { type: 'string', description: '对象名称' }, localPath: { type: 'string', description: '本地保存路径' } }, required: ['objectName', 'localPath'] }, description: '文件列表' } }, required: ['bucketName', 'files'] } },
  • Input schema definition for the 'download_files' tool, specifying bucketName and array of files with objectName and localPath.
    inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, files: { type: 'array', items: { type: 'object', properties: { objectName: { type: 'string', description: '对象名称' }, localPath: { type: 'string', description: '本地保存路径' } }, required: ['objectName', 'localPath'] }, description: '文件列表' } }, required: ['bucketName', 'files']
  • Core implementation of batch file download in MinIO client. Loops through files, calls single downloadFile for each, tracks successes and failures, returns BatchOperationResult.
    async downloadFiles(bucketName: string, files: Array<{ objectName: string; localPath: string }>): Promise<BatchOperationResult> { this.ensureConnected(); const result: BatchOperationResult = { success: true, successCount: 0, failureCount: 0, errors: [] }; for (const file of files) { try { await this.downloadFile(bucketName, file.objectName, file.localPath); result.successCount++; } catch (error) { result.success = false; result.failureCount++; result.errors.push({ item: file.objectName, error: error instanceof Error ? error.message : String(error) }); } } return result; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pickstar-2002/minio-storage-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server