Skip to main content
Glama
msftnadavbh

Azure Pricing MCP Server

by msftnadavbh

azure_price_compare

Compare Azure service pricing across regions or SKUs to identify cost differences and optimize cloud spending.

Instructions

Compare Azure prices across regions or SKUs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
service_nameYesAzure service name to compare
sku_nameNoSpecific SKU to compare (optional)
regionsNoList of regions to compare (if not provided, compares SKUs)
currency_codeNoCurrency code (default: USD)USD
discount_percentageNoDiscount percentage to apply to prices (e.g., 10 for 10% discount). If not specified and show_with_discount is false, no discount is applied. If show_with_discount is true, defaults to 10%.
show_with_discountNoSet to true to apply a discount; uses default 10% unless discount_percentage is explicitly specified.

Implementation Reference

  • The handler function that executes the azure_price_compare tool. It resolves discount settings, calls the pricing service's compare_prices method, attaches discount metadata, and formats the response.
    async def handle_price_compare(self, arguments: dict[str, Any]) -> list[TextContent]:
        """Handle azure_price_compare tool calls."""
        discount_pct, discount_specified, used_default = self._resolve_discount(arguments)
    
        result = await self._pricing_service.compare_prices(**arguments)
        self._attach_discount_metadata(result, discount_pct, discount_specified, used_default)
    
        response_text = format_price_compare_response(result)
        return [TextContent(type="text", text=response_text)]
  • Core implementation of the compare_prices logic in PricingService. Supports comparing prices across regions (when regions list is provided) or across SKUs (when no regions specified). Applies discounts, sorts results by price, and returns comparison data.
    async def compare_prices(
        self,
        service_name: str,
        sku_name: str | None = None,
        regions: list[str] | None = None,
        currency_code: str = "USD",
        discount_percentage: float | None = None,
    ) -> dict[str, Any]:
        """Compare prices across different regions or SKUs."""
        comparisons = []
    
        if regions and isinstance(regions, list):
            for region in regions:
                try:
                    result = await self.search_prices(
                        service_name=service_name,
                        sku_name=sku_name,
                        region=region,
                        currency_code=currency_code,
                        limit=10,
                    )
    
                    if result["items"]:
                        item = result["items"][0]
                        comparisons.append(
                            {
                                "region": region,
                                "sku_name": item.get("skuName"),
                                "retail_price": item.get("retailPrice"),
                                "unit_of_measure": item.get("unitOfMeasure"),
                                "product_name": item.get("productName"),
                                "meter_name": item.get("meterName"),
                            }
                        )
                except Exception as e:
                    logger.warning(f"Failed to get prices for region {region}: {e}")
        else:
            result = await self.search_prices(
                service_name=service_name,
                currency_code=currency_code,
                limit=20,
            )
    
            sku_prices: dict[str, dict[str, Any]] = {}
            items = result.get("items", [])
            for item in items:
                sku = item.get("skuName")
                if sku and sku not in sku_prices:
                    sku_prices[sku] = {
                        "sku_name": sku,
                        "retail_price": item.get("retailPrice"),
                        "unit_of_measure": item.get("unitOfMeasure"),
                        "product_name": item.get("productName"),
                        "region": item.get("armRegionName"),
                        "meter_name": item.get("meterName"),
                    }
    
            comparisons = list(sku_prices.values())
    
        if discount_percentage is not None and discount_percentage > 0:
            for comparison in comparisons:
                if "retail_price" in comparison and comparison["retail_price"]:
                    original_price = comparison["retail_price"]
                    discounted_price = original_price * (1 - discount_percentage / 100)
                    comparison["retail_price"] = round(discounted_price, 6)
                    comparison["original_price"] = original_price
    
        comparisons.sort(key=lambda x: x.get("retail_price", 0))
    
        result_data: dict[str, Any] = {
            "comparisons": comparisons,
            "service_name": service_name,
            "currency": currency_code,
            "comparison_type": "regions" if regions else "skus",
        }
    
        if discount_percentage is not None and discount_percentage > 0:
            result_data["discount_applied"] = {
                "percentage": discount_percentage,
                "note": "Prices shown are after discount",
            }
    
        return result_data
  • Tool definition and input schema for azure_price_compare. Defines parameters: service_name (required), sku_name (optional), regions (optional array), currency_code, discount_percentage, and show_with_discount flags.
    Tool(
        name="azure_price_compare",
        description="Compare Azure prices across regions or SKUs",
        inputSchema={
            "type": "object",
            "properties": {
                "service_name": {
                    "type": "string",
                    "description": "Azure service name to compare",
                },
                "sku_name": {
                    "type": "string",
                    "description": "Specific SKU to compare (optional)",
                },
                "regions": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "List of regions to compare (if not provided, compares SKUs)",
                },
                "currency_code": {
                    "type": "string",
                    "description": "Currency code (default: USD)",
                    "default": "USD",
                },
                "discount_percentage": {
                    "type": "number",
                    "description": "Discount percentage to apply to prices (e.g., 10 for 10% discount). If not specified and show_with_discount is false, no discount is applied. If show_with_discount is true, defaults to 10%.",
                },
                "show_with_discount": {
                    "type": "boolean",
                    "description": "Set to true to apply a discount; uses default 10% unless discount_percentage is explicitly specified.",
                    "default": False,
                },
            },
            "required": ["service_name"],
        },
    ),
  • Response formatter for price comparison results. Adds service name header, discount notification if applicable, and returns the comparisons as formatted JSON.
    def format_price_compare_response(result: dict[str, Any]) -> str:
        """Format the price comparison response for display."""
        response_text = f"Price comparison for {result['service_name']}:\n\n"
    
        if "discount_applied" in result:
            response_text += f"💰 {result['discount_applied']['percentage']}% discount applied - {result['discount_applied']['note']}\n\n"
    
        response_text += json.dumps(result["comparisons"], indent=2)
    
        return response_text
  • Tool registration in the MCP server's call_tool handler. Routes azure_price_compare calls to the handle_price_compare method in tool_handlers.
    elif name == "azure_price_compare":
        return await handlers.handle_price_compare(arguments)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'compare' suggests a read-only operation, it doesn't clarify whether this queries live pricing APIs, cached data, or requires authentication. It also doesn't mention rate limits, data freshness, or what format the comparison results take.

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 that immediately states the tool's core function. There's no wasted verbiage or unnecessary elaboration, making it easy for an agent to parse quickly.

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?

For a 6-parameter tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the comparison output looks like, how results are structured, or provide context about data sources. The agent must rely entirely on the input schema without understanding the tool's behavior or results.

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?

With 100% schema description coverage, the baseline is 3. The description adds minimal value beyond the schema, only implying that regions and SKUs are the comparison dimensions. It doesn't explain the relationship between regions and SKU parameters or provide examples of valid service/SKU names.

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 as comparing Azure prices across regions or SKUs, which is a specific verb+resource combination. However, it doesn't explicitly differentiate this tool from its siblings like azure_price_search or azure_ri_pricing, which likely have overlapping price-related functionality.

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 12 sibling tools including azure_price_search, azure_ri_pricing, and azure_sku_discovery, the agent receives no help in selecting the appropriate price comparison tool for different scenarios.

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/msftnadavbh/AzurePricingMCP'

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