Skip to main content
Glama
code-alchemist01

MCP Cloud Services Server

get_cost_by_service

Analyze cloud spending by service across AWS, Azure, and GCP for specific date ranges to identify cost drivers and optimize expenses.

Instructions

Get cost breakdown by service

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
providerYesCloud provider
startDateYesStart date (YYYY-MM-DD)
endDateYesEnd date (YYYY-MM-DD)

Implementation Reference

  • Handler logic for 'get_cost_by_service' tool within handleCostAnalysisTool function, dispatching to AWS-specific implementation or returning unimplemented message for other providers.
    case 'get_cost_by_service': {
      const startDate = params.startDate as string;
      const endDate = params.endDate as string;
    
      if (provider === 'aws') {
        return await getAWSCostByService(startDate, endDate);
      }
      return { message: `Cost by service not yet implemented for ${provider}` };
    }
  • Input schema and metadata definition for the 'get_cost_by_service' tool.
    {
      name: 'get_cost_by_service',
      description: 'Get cost breakdown by service',
      inputSchema: {
        type: 'object',
        properties: {
          provider: {
            type: 'string',
            enum: ['aws', 'azure', 'gcp'],
            description: 'Cloud provider',
          },
          startDate: {
            type: 'string',
            description: 'Start date (YYYY-MM-DD)',
          },
          endDate: {
            type: 'string',
            description: 'End date (YYYY-MM-DD)',
          },
        },
        required: ['provider', 'startDate', 'endDate'],
      },
    },
  • src/server.ts:72-73 (registration)
    Top-level registration and dispatch for cost analysis tools, including 'get_cost_by_service', in the MCP server tool call handler.
    } else if (costAnalysisTools.some((t) => t.name === name)) {
      result = await handleCostAnalysisTool(name, args || {});
  • src/server.ts:19-27 (registration)
    Aggregation of all tools including costAnalysisTools (containing 'get_cost_by_service') into allTools list provided to MCP clients.
    const allTools = [
      ...awsTools,
      ...azureTools,
      ...gcpTools,
      ...resourceManagementTools,
      ...costAnalysisTools,
      ...monitoringTools,
      ...securityTools,
    ];
  • AWS-specific helper function that retrieves cost breakdown by service using analyzeAWSCosts and returns parsed data.
    async function getAWSCostByService(startDate: string, endDate: string): Promise<unknown> {
      try {
        const analysis = await analyzeAWSCosts(startDate, endDate, 'monthly');
        // Parse the formatted analysis to extract service breakdown
        return {
          breakdown: JSON.parse(analysis),
          message: 'Cost breakdown by service retrieved',
        };
      } catch (error) {
        throw new Error(`Failed to get cost by service: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
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. 'Get' implies a read operation, but it doesn't specify whether this requires authentication, has rate limits, returns paginated results, or what format the cost breakdown is in. For a tool with three required parameters and no annotations, this leaves significant behavioral gaps.

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 with no wasted words. It's appropriately sized for a simple tool and front-loads the core purpose without unnecessary elaboration.

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 (three required parameters, no output schema, and no annotations), the description is insufficient. It doesn't explain what the output looks like (e.g., a list, a summary, or structured data), how errors are handled, or any dependencies, leaving the agent with incomplete 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 schema description coverage is 100%, with clear descriptions for all three parameters (provider, startDate, endDate). The description adds no additional parameter information beyond what the schema provides, which is acceptable given the high schema coverage, resulting in a baseline score 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 'Get cost breakdown by service' clearly states the verb ('Get') and resource ('cost breakdown by service'), making the purpose understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'analyze_costs' or 'estimate_monthly_cost', which appear related to cost analysis.

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 sibling tools like 'analyze_costs' and 'estimate_monthly_cost' present, there's no indication of what differentiates this cost-related tool from others, leaving the agent without context for selection.

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/code-alchemist01/Cloud-mcp_server'

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