Skip to main content
Glama

get_reservation_utilization

Retrieve Reserved Instance utilization percentages for AWS resources to analyze cost efficiency and optimize cloud spending.

Instructions

Retrieves Reserved Instance (RI) utilization percentages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYesStart date (YYYY-MM-DD).
end_dateYesEnd date (YYYY-MM-DD).

Implementation Reference

  • The main handler function for the 'get_reservation_utilization' tool. It uses AWS Cost Explorer's GetReservationUtilizationCommand to fetch Reserved Instance (RI) utilization data for a given time period and formats the response into a time-series of utilization percentages and hours.
    if (name === "get_reservation_utilization") { const command = new GetReservationUtilizationCommand({ TimePeriod: { Start: (args as any).start_date, End: (args as any).end_date } }); const response = await costExplorerClient.send(command); const utils = response.UtilizationsByTime?.map(u => ({ Date: u.TimePeriod?.Start, TotalPotentialRIHours: u.Total?.TotalPotentialRISavings, // Approximate proxy if direct hours not shown in all interfaces UtilizationPercentage: u.Total?.UtilizationPercentage + "%", PurchasedUnits: u.Total?.PurchasedHours, TotalActualHours: u.Total?.TotalActualHours, UnusedHours: u.Total?.UnusedHours })) || []; return { content: [{ type: "text", text: JSON.stringify(utils, null, 2) }] }; }
  • src/index.ts:269-280 (registration)
    Registration of the tool in the ListTools response, defining its name, description, and input schema requirements.
    { name: "get_reservation_utilization", description: "Retrieves Reserved Instance (RI) utilization percentages.", inputSchema: { type: "object", properties: { start_date: { type: "string", description: "Start date (YYYY-MM-DD)." }, end_date: { type: "string", description: "End date (YYYY-MM-DD)." } }, required: ["start_date", "end_date"] } },
  • Input schema definition for the tool, specifying required start_date and end_date parameters in YYYY-MM-DD format.
    inputSchema: { type: "object", properties: { start_date: { type: "string", description: "Start date (YYYY-MM-DD)." }, end_date: { type: "string", description: "End date (YYYY-MM-DD)." } }, required: ["start_date", "end_date"] }
  • Import statement for the GetReservationUtilizationCommand and CostExplorerClient used by the tool.
    import { CostExplorerClient, GetCostAndUsageCommand, GetCostForecastCommand, GetAnomaliesCommand, GetSavingsPlansUtilizationCommand, GetReservationUtilizationCommand } from "@aws-sdk/client-cost-explorer";
  • Initialization of the AWS CostExplorerClient instance used to send the GetReservationUtilizationCommand.
    const costExplorerClient = new CostExplorerClient({});

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/Bhavesh8890/MCP-server'

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