Skip to main content
Glama

upload_files

Upload multiple files to MinIO object storage buckets with metadata options. This tool enables batch file transfers to cloud storage for efficient data management.

Instructions

批量上传文件

Input Schema

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

Implementation Reference

  • Core implementation of the upload_files tool: batch uploads files to MinIO bucket by iterating and calling uploadFile for each, returns BatchOperationResult with success/failure counts and errors.
    async uploadFiles(bucketName: string, files: Array<{ localPath: string; objectName: string; metadata?: Record<string, string> }>): Promise<BatchOperationResult> { this.ensureConnected(); const result: BatchOperationResult = { success: true, successCount: 0, failureCount: 0, errors: [] }; for (const file of files) { try { await this.uploadFile(bucketName, file.objectName, file.localPath, file.metadata); result.successCount++; } catch (error) { result.success = false; result.failureCount++; result.errors.push({ item: file.localPath, error: error instanceof Error ? error.message : String(error) }); } } return result; }
  • Input JSON schema for upload_files tool defining bucketName (string) and files array of objects with localPath, objectName, optional metadata.
    inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, files: { type: 'array', items: { type: 'object', properties: { localPath: { type: 'string', description: '本地文件路径' }, objectName: { type: 'string', description: '对象名称' }, metadata: { type: 'object', description: '文件元数据(可选)' } }, required: ['localPath', 'objectName'] }, description: '文件列表' } }, required: ['bucketName', 'files'] }
  • src/index.ts:231-254 (registration)
    Registration of the upload_files tool in the ListTools response, including name, description, and inputSchema.
    { name: 'upload_files', description: '批量上传文件', inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, files: { type: 'array', items: { type: 'object', properties: { localPath: { type: 'string', description: '本地文件路径' }, objectName: { type: 'string', description: '对象名称' }, metadata: { type: 'object', description: '文件元数据(可选)' } }, required: ['localPath', 'objectName'] }, description: '文件列表' } }, required: ['bucketName', 'files'] } },
  • MCP server handler case for upload_files: validates arguments with Zod, calls minioClient.uploadFiles, formats response text.
    case 'upload_files': { const { bucketName, files } = z.object({ bucketName: z.string(), files: z.array(z.object({ localPath: z.string(), objectName: z.string(), metadata: z.record(z.string()).optional() })) }).parse(args); const result = await this.minioClient.uploadFiles(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') : ''}` } ] }; }

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