Skip to main content
Glama

get_cost_forecast

Predict AWS costs for specified time ranges to plan budgets and manage cloud spending effectively.

Instructions

Predicts future costs for a specified time range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYesStart date (YYYY-MM-DD).
end_dateYesEnd date (YYYY-MM-DD).
granularityNoGranularity (default: DAILY).
prediction_interval_levelNoPrediction interval confidence (51-99, default: 80).

Implementation Reference

  • Handler function that calls AWS CostExplorer GetCostForecastCommand with provided parameters, processes the forecast results by time, and returns formatted JSON response including total and daily forecasts with prediction intervals.
    if (name === "get_cost_forecast") {
        const command = new GetCostForecastCommand({
            TimePeriod: { Start: (args as any).start_date, End: (args as any).end_date },
            Granularity: (args as any)?.granularity || "DAILY",
            Metric: "UNBLENDED_COST",
            PredictionIntervalLevel: (args as any)?.prediction_interval_level || 80
        });
        const response = await costExplorerClient.send(command);
    
        const forecast = response.ForecastResultsByTime?.map(f => ({
            Date: f.TimePeriod?.Start,
            MeanValue: f.MeanValue,
            PredictionIntervalLower: f.PredictionIntervalLowerBound,
            PredictionIntervalUpper: f.PredictionIntervalUpperBound
        })) || [];
    
        return { content: [{ type: "text", text: JSON.stringify({ Total: response.Total, Forecast: forecast }, null, 2) }] };
  • Tool definition in ListTools response, including name, description, and Zod-like input schema defining required start_date/end_date and optional granularity/prediction_interval_level.
    name: "get_cost_forecast",
    description: "Predicts future costs for a specified time range.",
    inputSchema: {
        type: "object",
        properties: {
            start_date: { type: "string", description: "Start date (YYYY-MM-DD)." },
            end_date: { type: "string", description: "End date (YYYY-MM-DD)." },
            granularity: { type: "string", enum: ["DAILY", "MONTHLY", "HOURLY"], description: "Granularity (default: DAILY)." },
            prediction_interval_level: { type: "number", description: "Prediction interval confidence (51-99, default: 80)." }
        },
        required: ["start_date", "end_date"]
    }
  • src/index.ts:221-232 (registration)
    Registration of the tool in the list of available tools returned by ListToolsRequestHandler, which defines its metadata and input schema.
    name: "get_cost_forecast",
    description: "Predicts future costs for a specified time range.",
    inputSchema: {
        type: "object",
        properties: {
            start_date: { type: "string", description: "Start date (YYYY-MM-DD)." },
            end_date: { type: "string", description: "End date (YYYY-MM-DD)." },
            granularity: { type: "string", enum: ["DAILY", "MONTHLY", "HOURLY"], description: "Granularity (default: DAILY)." },
            prediction_interval_level: { type: "number", description: "Prediction interval confidence (51-99, default: 80)." }
        },
        required: ["start_date", "end_date"]
    }
  • Import of GetCostForecastCommand and CostExplorerClient from AWS SDK.
    import { CostExplorerClient, GetCostAndUsageCommand, GetCostForecastCommand, GetAnomaliesCommand, GetSavingsPlansUtilizationCommand, GetReservationUtilizationCommand } from "@aws-sdk/client-cost-explorer";
  • Initialization of the CostExplorerClient used by the get_cost_forecast handler.
    const costExplorerClient = new CostExplorerClient({});
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool predicts costs but doesn't mention whether this is a read-only operation, requires specific permissions, involves computational costs or rate limits, or what the output format looks like (e.g., time-series data, confidence intervals). For a prediction tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Predicts future costs for a specified time range.' It is front-loaded with the core purpose and wastes no words, making it easy for an agent to parse quickly. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a forecasting tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the prediction output includes (e.g., point estimates, intervals), how accuracy or confidence is handled, or any behavioral traits like latency or data freshness. This leaves the agent with insufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'specified time range,' which aligns with the 'start_date' and 'end_date' parameters in the schema. However, with 100% schema description coverage, the schema already fully documents all four parameters, including their types, formats, enums, and defaults. The description adds minimal value beyond what the schema provides, meeting the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Predicts future costs for a specified time range.' It uses a specific verb ('predicts') and resource ('future costs'), and while it doesn't explicitly distinguish from siblings like 'get_cost_breakdown' or 'get_recent_cost', the prediction focus is clear. However, it lacks explicit sibling differentiation, preventing a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_cost_breakdown', 'get_cost_anomalies', and 'get_recent_cost' available, there is no indication of when forecasting is appropriate compared to analyzing current or historical data. This leaves the agent without usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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