Skip to main content
Glama

get_storage_stats

Retrieve detailed storage statistics from MinIO object storage for monitoring and managing bucket usage, file operations, and resource allocation.

Instructions

获取存储统计信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that computes storage statistics by listing all buckets, recursively listing objects in each, and aggregating total and per-bucket counts and sizes.
    async getStorageStats(): Promise<StorageStats> { this.ensureConnected(); const buckets = await this.listBuckets(); const bucketStats = []; let totalObjects = 0; let totalSize = 0; for (const bucket of buckets) { const objects = await this.listObjects(bucket.name, undefined, true); const bucketSize = objects.reduce((sum, obj) => sum + obj.size, 0); const objectCount = objects.length; bucketStats.push({ bucketName: bucket.name, objectCount, totalSize: bucketSize }); totalObjects += objectCount; totalSize += bucketSize; } return { totalBuckets: buckets.length, totalObjects, totalSize, bucketStats }; }
  • MCP CallToolRequest handler case that invokes the MinIO client's getStorageStats method and formats the response as text content.
    case 'get_storage_stats': { const stats = await this.minioClient.getStorageStats(); return { content: [ { type: 'text', text: `存储统计信息:\n- 总存储桶数: ${stats.totalBuckets}\n- 总对象数: ${stats.totalObjects}\n- 总大小: ${(stats.totalSize / 1024 / 1024).toFixed(2)} MB\n\n各存储桶详情:\n${stats.bucketStats.map(b => `- ${b.bucketName}: ${b.objectCount} 个对象, ${(b.totalSize / 1024 / 1024).toFixed(2)} MB`).join('\n')}` } ] }; }
  • src/index.ts:226-230 (registration)
    Tool registration in ListToolsRequest handler, defining name, description, and empty input schema.
    { name: 'get_storage_stats', description: '获取存储统计信息', inputSchema: { type: 'object', properties: {} } },
  • TypeScript interface defining the structure of StorageStats returned by the handler.
    export interface StorageStats { totalBuckets: number; totalObjects: number; totalSize: number; bucketStats: Array<{ bucketName: string; objectCount: number; totalSize: number; }>; }

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