Skip to main content
Glama

upload_file

Upload files to MinIO storage buckets with specified metadata. This tool transfers local files to cloud storage for organized data management and accessibility.

Instructions

上传文件到存储桶

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketNameYes存储桶名称
objectNameYes对象名称
filePathYes本地文件路径
metadataNo文件元数据(可选)

Implementation Reference

  • MCP CallTool handler case for 'upload_file': validates arguments with Zod schema matching the tool inputSchema, calls minioClient.uploadFile, and returns success message.
    case 'upload_file': { const { bucketName, objectName, filePath, metadata } = z.object({ bucketName: z.string(), objectName: z.string(), filePath: z.string(), metadata: z.record(z.string()).optional() }).parse(args); await this.minioClient.uploadFile(bucketName, objectName, filePath, metadata); return { content: [ { type: 'text', text: `成功上传文件 ${filePath} 到 ${bucketName}/${objectName}` } ] }; }
  • Tool schema definition in ListTools response, specifying name, description, and inputSchema for 'upload_file'.
    name: 'upload_file', description: '上传文件到存储桶', inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, objectName: { type: 'string', description: '对象名称' }, filePath: { type: 'string', description: '本地文件路径' }, metadata: { type: 'object', description: '文件元数据(可选)' } }, required: ['bucketName', 'objectName', 'filePath'] } },
  • Core implementation of file upload using MinIO client's putObject method, called by the MCP handler.
    async uploadFile(bucketName: string, objectName: string, filePath: string, metadata?: Record<string, string>): Promise<void> { this.ensureConnected(); if (!fs.existsSync(filePath)) { throw new Error(`文件不存在: ${filePath}`); } const stats = fs.statSync(filePath); const stream = fs.createReadStream(filePath); await this.client!.putObject(bucketName, objectName, stream, stats.size, metadata); }

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