Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

list_usage_records

Retrieve billing usage records from CloudStack MCP Server by specifying a start date, end date, and optional usage type for accurate cost tracking and analysis.

Instructions

List usage records for billing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enddateYesEnd date (YYYY-MM-DD)
startdateYesStart date (YYYY-MM-DD)
typeNoUsage type

Implementation Reference

  • Main handler function that fetches usage records from CloudStack, processes them, and formats a response with details like usageid, description, usagetype, usage, startdate, enddate.
    async handleListUsageRecords(args: any) { const result = await this.cloudStackClient.listUsageRecords(args); const records = result.listusagerecordsresponse?.usagerecord || []; const recordList = records.map((record: any) => ({ usageid: record.usageid, description: record.description, usagetype: record.usagetype, rawusage: record.rawusage, usage: record.usage, startdate: record.startdate, enddate: record.enddate })); return { content: [ { type: 'text', text: `Found ${recordList.length} usage records:\n\n${recordList .map((record: any) => `• ${record.description} (${record.usageid})\n Type: ${record.usagetype}\n Usage: ${record.usage}\n Start: ${record.startdate}\n End: ${record.enddate}\n` ) .join('\n')}` } ] }; }
  • Tool definition including name, description, and input schema requiring startdate and enddate, with optional type.
    name: 'list_usage_records', description: 'List usage records for billing', inputSchema: { type: 'object', properties: { startdate: { type: 'string', description: 'Start date (YYYY-MM-DD)', }, enddate: { type: 'string', description: 'End date (YYYY-MM-DD)', }, type: { type: 'number', description: 'Usage type', }, }, required: ['startdate', 'enddate'], additionalProperties: false, }, },
  • src/server.ts:174-175 (registration)
    Switch case in server that registers and dispatches the tool call to the monitoring handler.
    case 'list_usage_records': return await this.monitoringHandlers.handleListUsageRecords(args);
  • CloudStack client method that makes the actual API request to listUsageRecords endpoint.
    async listUsageRecords(params: CloudStackParams): Promise<CloudStackResponse> { return this.request('listUsageRecords', params); }

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/phantosmax/cloudstack-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server