Skip to main content
Glama

get_quote

Calculate shipping costs and USDC payment amount for a product, returning the wallet address to send payment.

Instructions

Get a shipping quote and USDC payment amount for a product. Returns the wallet address to send payment to.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variant_idYesShopify variant ID
shipping_nameYesRecipient full name
shipping_address1YesStreet address
shipping_cityYesCity
shipping_stateYesState (2-letter code)
shipping_zipYesZIP code
shipping_countryNoCountry code (default: US)

Implementation Reference

  • main.py:305-350 (handler)
    The main handler for the get_quote tool. It fetches the variant price from Shopify, calculates shipping (US=$5, international=$15), stores the quote in an in-memory dict with a 10-minute expiry, and returns the total USDC amount, payment wallet address, network, token, and instructions.
    # --- Tool: get_quote ---
    @app.post("/tools/get_quote")
    async def get_quote(request: Request):
        body = await request.json()
        variant_id = body.get("variant_id")
        quantity = body.get("quantity", 1)
        address = body.get("shipping_address", {})
    
        # Get variant price from Shopify
        data = await shopify_get(f"variants/{variant_id}.json")
        variant = data["variant"]
        unit_price = float(variant["price"])
        subtotal = unit_price * quantity
    
        # Standard shipping estimate (US $5, international $15)
        country = address.get("country_code", "US")
        shipping = 5.0 if country == "US" else 15.0
        total_usdc = round(subtotal + shipping, 2)
    
        quote_id = make_quote_id(variant_id, quantity)
        _quotes[quote_id] = {
            "variant_id": variant_id,
            "quantity": quantity,
            "total_usdc": total_usdc,
            "shipping_address": address,
            "expires_at": time.time() + 600,  # 10 min
            "product_title": variant.get("title", ""),
        }
    
        return {
            "quote_id": quote_id,
            "product": variant.get("title", ""),
            "quantity": quantity,
            "subtotal_usdc": subtotal,
            "shipping_usdc": shipping,
            "total_usdc": total_usdc,
            "payment_wallet": PAYMENT_WALLET,
            "network": "base",
            "token": "USDC",
            "token_contract": USDC_CONTRACT,
            "instructions": (
                f"Send exactly {total_usdc} USDC on Base network to {PAYMENT_WALLET}, "
                f"then call place_order with the transaction hash and this quote_id."
            ),
            "expires_in": "10 minutes",
        }
  • Input schema for get_quote in the MCP manifest. Requires variant_id (string), optional quantity (integer, default 1), and shipping_address object (name, address1, city, province, zip, country_code).
    {
        "name": "get_quote",
        "description": (
            "Get a USDC price quote for a product + shipping. "
            "Returns total USDC amount to send, payment wallet address, and a quote_id. "
            "Quote is valid for 10 minutes."
        ),
        "price": None,
        "inputSchema": {
            "type": "object",
            "properties": {
                "variant_id": {"type": "string"},
                "quantity": {"type": "integer", "default": 1},
                "shipping_address": {
                    "type": "object",
                    "properties": {
                        "name": {"type": "string"},
                        "address1": {"type": "string"},
                        "city": {"type": "string"},
                        "province": {"type": "string", "description": "State/province code e.g. CA"},
                        "zip": {"type": "string"},
                        "country_code": {"type": "string", "description": "ISO 2-letter e.g. US"},
                    },
                    "required": ["name", "address1", "city", "zip", "country_code"],
                },
            },
            "required": ["variant_id", "shipping_address"],
        },
  • main.py:490-537 (registration)
    Registration of get_quote in the MCP_TOOLS list for the /mcp protocol endpoint. Maps the tool name to its description and flat input schema (variant_id, shipping_name, shipping_address1, etc.).
        {
            "name": "get_quote",
            "description": "Get a shipping quote and USDC payment amount for a product. Returns the wallet address to send payment to.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "variant_id": {"type": "integer", "description": "Shopify variant ID"},
                    "shipping_name": {"type": "string", "description": "Recipient full name"},
                    "shipping_address1": {"type": "string", "description": "Street address"},
                    "shipping_city": {"type": "string", "description": "City"},
                    "shipping_state": {"type": "string", "description": "State (2-letter code)"},
                    "shipping_zip": {"type": "string", "description": "ZIP code"},
                    "shipping_country": {"type": "string", "description": "Country code (default: US)"}
                },
                "required": ["variant_id", "shipping_name", "shipping_address1", "shipping_city", "shipping_state", "shipping_zip"]
            }
        },
        {
            "name": "place_order",
            "description": "Place an order after sending USDC payment on Base. Verifies the on-chain transaction and creates the order.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "quote_id": {"type": "string", "description": "Quote ID from get_quote"},
                    "tx_hash": {"type": "string", "description": "Transaction hash of USDC payment on Base"},
                    "variant_id": {"type": "integer", "description": "Shopify variant ID"},
                    "shipping_name": {"type": "string"},
                    "shipping_address1": {"type": "string"},
                    "shipping_city": {"type": "string"},
                    "shipping_state": {"type": "string"},
                    "shipping_zip": {"type": "string"},
                    "shipping_country": {"type": "string"}
                },
                "required": ["quote_id", "tx_hash", "variant_id", "shipping_name", "shipping_address1", "shipping_city", "shipping_state", "shipping_zip"]
            }
        },
        {
            "name": "get_order_status",
            "description": "Check the status of a placed order by order ID.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "order_id": {"type": "string", "description": "Order ID returned from place_order"}
                },
                "required": ["order_id"]
            }
        }
    ]
  • main.py:574-580 (registration)
    Routing registration mapping the tool name 'get_quote' to the REST endpoint '/tools/get_quote' in the MCP protocol handler.
    rest_map = {
        "search_products": "/tools/search_products",
        "get_product": "/tools/get_product",
        "get_quote": "/tools/get_quote",
        "place_order": "/tools/place_order",
        "get_order_status": "/tools/get_order_status",
    }
  • In-memory quote store (_quotes dict) and make_quote_id helper used by get_quote to generate unique quote IDs.
    # In-memory quote store (replace with Redis in production)
    _quotes = {}
    
    def make_quote_id(variant_id: str, quantity: int) -> str:
        return f"q_{variant_id}_{quantity}_{int(time.time())}"
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. It states the tool gets a quote and returns a wallet address, but does not disclose whether it is read-only, side effects, rate limits, or authentication needs.

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 sentence that front- loads the main action and expected output, with no unnecessary words.

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

Completeness3/5

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

Without an output schema, the description mentions the return value (wallet address) but does not detail the full quote information (USDC amount, shipping cost). It is adequate but leaves some gaps for a tool with 7 parameters.

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?

Schema coverage is 100%, so the schema already documents all parameters. The description does not add extra meaning beyond the field names (e.g., explains how parameters are used), so a baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly specifies the action (getting a shipping quote and USDC payment amount) and the resource (product), and distinguishes from siblings like get_order_status (status), get_product (details), place_order (placing), and search_products (search).

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 (e.g., place_order, get_product). It does not mention prerequisites or when not to use it.

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/masonicGIT/shop-mcp-server'

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