list_capacity
Retrieve system capacity details including memory, CPU, and storage for specific zones using CloudStack MCP Server's query tool.
Instructions
List system capacity information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Capacity type (0=Memory, 1=CPU, 2=Storage, etc.) | |
| zoneid | No | Zone ID to filter capacity |
Implementation Reference
- The main handler function that executes the list_capacity tool logic by calling the CloudStack client, processing capacities, and formatting a text response.async handleListCapacity(args: any) { const result = await this.cloudStackClient.listCapacity(args); const capacities = result.listcapacityresponse?.capacity || []; const capacityList = capacities.map((capacity: any) => ({ type: capacity.type, zonename: capacity.zonename, capacityused: capacity.capacityused, capacitytotal: capacity.capacitytotal, percentused: capacity.percentused })); return { content: [ { type: 'text', text: `Found ${capacityList.length} capacity metrics:\n\n${capacityList .map((cap: any) => `• Type: ${cap.type}\n Zone: ${cap.zonename}\n Used: ${cap.capacityused}\n Total: ${cap.capacitytotal}\n Percent Used: ${cap.percentused}%\n` ) .join('\n')}` } ] }; }
- Defines the tool name, description, and input schema for validation in the MCP tool definitions.name: 'list_capacity', description: 'List system capacity information', inputSchema: { type: 'object', properties: { zoneid: { type: 'string', description: 'Zone ID to filter capacity', }, type: { type: 'number', description: 'Capacity type (0=Memory, 1=CPU, 2=Storage, etc.)', }, }, additionalProperties: false, }, },
- src/server.ts:170-171 (registration)Dispatches the list_capacity tool call to the appropriate monitoring handler in the MCP server request handler.case 'list_capacity': return await this.monitoringHandlers.handleListCapacity(args);
- src/cloudstack-client.ts:230-232 (helper)Helper method in the CloudStack client that performs the actual API request to listCapacity.async listCapacity(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listCapacity', params); }