delete_objects
Remove multiple objects from a specified bucket in MinIO Storage MCP, streamlining batch deletions for efficient storage management.
Instructions
批量删除存储桶中的对象
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucketName | Yes | 存储桶名称 | |
| objectNames | Yes | 对象名称列表 |
Implementation Reference
- src/minio-client.ts:160-183 (handler)Core implementation of the delete_objects tool: batch deletes objects from MinIO bucket using removeObjects, handles errors, returns BatchOperationResult.async deleteObjects(bucketName: string, objectNames: string[]): Promise<BatchOperationResult> { this.ensureConnected(); const result: BatchOperationResult = { success: true, successCount: 0, failureCount: 0, errors: [] }; try { await this.client!.removeObjects(bucketName, objectNames); result.successCount = objectNames.length; } catch (error) { result.success = false; result.failureCount = objectNames.length; result.errors.push({ item: objectNames.join(', '), error: error instanceof Error ? error.message : String(error) }); } return result; }
- src/index.ts:174-185 (registration)Registration of the delete_objects tool in the ListTools response, including name, description, and input schema.{ name: 'delete_objects', description: '批量删除存储桶中的对象', inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, objectNames: { type: 'array', items: { type: 'string' }, description: '对象名称列表' } }, required: ['bucketName', 'objectNames'] } },
- src/types.ts:44-52 (schema)Type definition for the output of deleteObjects operation (BatchOperationResult).export interface BatchOperationResult { success: boolean; successCount: number; failureCount: number; errors: Array<{ item: string; error: string; }>; }
- src/index.ts:469-484 (handler)MCP server dispatch handler for delete_objects: validates input with zod, calls minioClient.deleteObjects, formats response.case 'delete_objects': { const { bucketName, objectNames } = z.object({ bucketName: z.string(), objectNames: z.array(z.string()) }).parse(args); const result = await this.minioClient.deleteObjects(bucketName, objectNames); 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') : ''}` } ] }; }