Skip to main content
Glama

upload_files

Transfer multiple files to MinIO object storage by specifying bucket names, local file paths, and object names. Simplify batch uploads with optional metadata inclusion.

Instructions

批量上传文件

Input Schema

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

Implementation Reference

  • Core handler function implementing batch file uploads to a MinIO bucket. Iterates over the files array, uploads each using uploadFile, and returns a 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 schema definition for the 'upload_files' tool, provided in the ListTools response. Defines parameters: bucketName (required string), files (required array of objects with localPath, objectName, optional metadata).
    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 tool dispatch handler for 'upload_files'. Parses input arguments using Zod, calls MinIOStorageClient.uploadFiles, formats and returns the batch operation result as tool response.
    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') : ''}` } ] }; }
  • Zod runtime validation schema for 'upload_files' arguments in the dispatch handler, matching the tool inputSchema.
    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);

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