get_object_info
Retrieve detailed metadata and information for specific objects stored in MinIO buckets by specifying the bucket and object names. Simplify object management and access control in MinIO storage.
Instructions
获取对象信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucketName | Yes | 存储桶名称 | |
| objectName | Yes | 对象名称 |
Implementation Reference
- src/index.ts:200-211 (registration)Registration of the 'get_object_info' tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'get_object_info', description: '获取对象信息', inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, objectName: { type: 'string', description: '对象名称' } }, required: ['bucketName', 'objectName'] } },
- src/index.ts:505-520 (handler)MCP tool handler for 'get_object_info' in CallToolRequestSchema switch case. Parses input with Zod, calls MinIO client, formats and returns response.case 'get_object_info': { const { bucketName, objectName } = z.object({ bucketName: z.string(), objectName: z.string() }).parse(args); const info = await this.minioClient.getObjectInfo(bucketName, objectName); return { content: [ { type: 'text', text: `对象信息:\n- 名称: ${info.name}\n- 大小: ${info.size} 字节\n- 最后修改: ${info.lastModified.toISOString()}\n- ETag: ${info.etag}\n- 内容类型: ${info.contentType || '未知'}` } ] }; }
- src/types.ts:22-29 (schema)TypeScript interface defining the ObjectInfo return type used by getObjectInfo.export interface ObjectInfo { name: string; size: number; lastModified: Date; etag: string; contentType?: string; isDir: boolean; }
- src/minio-client.ts:198-210 (helper)Core implementation of getObjectInfo in MinIOStorageClient class, using MinIO client's statObject to retrieve object metadata.async getObjectInfo(bucketName: string, objectName: string): Promise<ObjectInfo> { this.ensureConnected(); const stat = await this.client!.statObject(bucketName, objectName); return { name: objectName, size: stat.size, lastModified: stat.lastModified, etag: stat.etag, contentType: stat.metaData['content-type'], isDir: false }; }