Skip to main content
Glama

get_savings_plans_utilization

Retrieve AWS Savings Plans utilization percentages for specified date ranges to monitor cost optimization effectiveness.

Instructions

Retrieves Savings Plans utilization percentages.

Input Schema

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

Implementation Reference

  • Handler function that calls AWS Cost Explorer's GetSavingsPlansUtilizationCommand with the provided time period, processes the response to extract utilization metrics (percentage, commitments), and returns formatted JSON.
    if (name === "get_savings_plans_utilization") {
        const command = new GetSavingsPlansUtilizationCommand({
            TimePeriod: { Start: (args as any).start_date, End: (args as any).end_date }
        });
        const response = await costExplorerClient.send(command);
    
        const utils = response.SavingsPlansUtilizationsByTime?.map(u => ({
            Date: u.TimePeriod?.Start,
            UtilizationPercentage: u.Utilization?.UtilizationPercentage + "%",
            TotalCommitment: u.Utilization?.TotalCommitment,
            UsedCommitment: u.Utilization?.UsedCommitment,
            UnusedCommitment: u.Utilization?.UnusedCommitment
        })) || [];
    
        return { content: [{ type: "text", text: JSON.stringify(utils, null, 2) }] };
    }
  • src/index.ts:257-268 (registration)
    Tool registration entry in the ListTools response, including name, description, and input schema definition (Zod-like object requiring start_date and end_date).
    {
        name: "get_savings_plans_utilization",
        description: "Retrieves Savings Plans 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 for the tool, defining required string parameters for start_date and end_date 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 of GetSavingsPlansUtilizationCommand from AWS SDK Cost Explorer client.
    import { CostExplorerClient, GetCostAndUsageCommand, GetCostForecastCommand, GetAnomaliesCommand, GetSavingsPlansUtilizationCommand, GetReservationUtilizationCommand } from "@aws-sdk/client-cost-explorer";
  • Initialization of the CostExplorerClient used by the handler.
    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/bhaveshopss/MCP-server'

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