get_product
Retrieve detailed product information using a Shopify variant ID to support autonomous hat purchases with cryptocurrency.
Instructions
Get full details for a specific product by its Shopify variant ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| variant_id | Yes | Shopify variant ID of the product |
Implementation Reference
- main.py:275-300 (handler)The handler implementation for the 'get_product' tool, which fetches product details from Shopify and formats them for the MCP response.
# --- Tool: get_product --- @app.post("/tools/get_product") async def get_product(request: Request): body = await request.json() product_id = body.get("product_id") data = await shopify_get(f"products/{product_id}.json") p = data["product"] return { "id": str(p["id"]), "title": p["title"], "description": p.get("body_html", "").replace("<p>", "").replace("</p>", "\n").strip(), "handle": p["handle"], "url": f"https://shop.masonborda.com/products/{p['handle']}", "variants": [ { "id": str(v["id"]), "title": v["title"], "price_usd": float(v["price"]), "price_usdc": float(v["price"]), "sku": v.get("sku", ""), "available": v.get("inventory_quantity", 1) > 0, } for v in p.get("variants", []) ],