Skip to main content
Glama
pickstar-2002

MinIO Storage MCP

delete_objects

Remove multiple objects from a MinIO storage bucket to manage storage space and organize data efficiently.

Instructions

批量删除存储桶中的对象

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketNameYes存储桶名称
objectNamesYes对象名称列表

Implementation Reference

  • MCP tool handler for 'delete_objects': validates input parameters using Zod, calls MinIOStorageClient.deleteObjects, and returns formatted success/failure 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') : ''}`
          }
        ]
      };
    }
  • src/index.ts:174-185 (registration)
    Tool registration in ListTools response, including name, description, and input schema specification.
    {
      name: 'delete_objects',
      description: '批量删除存储桶中的对象',
      inputSchema: {
        type: 'object',
        properties: {
          bucketName: { type: 'string', description: '存储桶名称' },
          objectNames: { type: 'array', items: { type: 'string' }, description: '对象名称列表' }
        },
        required: ['bucketName', 'objectNames']
      }
    },
  • Inline Zod schema validation for delete_objects input parameters within the handler.
    const { bucketName, objectNames } = z.object({
      bucketName: z.string(),
      objectNames: z.array(z.string())
    }).parse(args);
  • Core implementation of batch object deletion using MinIO client's removeObjects method, with error handling and result aggregation.
    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;
    }

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