Skip to main content
Glama

get_product

Retrieve complete product information by providing a variant ID, enabling autonomous purchasing decisions with real-time details.

Instructions

Get full details for a specific product by its Shopify variant ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variant_idYesShopify variant ID of the product

Implementation Reference

  • main.py:275-302 (handler)
    The actual handler for the 'get_product' tool. It parses the request for product_id, calls Shopify API to fetch the product, and returns structured data including id, title, description, handle, URL, variants, and images.
    # --- 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", [])
            ],
            "images": [img["src"] for img in p.get("images", [])],
        }
  • main.py:78-88 (registration)
    Registration of 'get_product' in the MCP manifest (/.well-known/mcp.json) with input schema requiring product_id (string).
        "name": "get_product",
        "description": "Get full details for a product including all variants and images.",
        "price": None,
        "inputSchema": {
            "type": "object",
            "properties": {
                "product_id": {"type": "string"},
            },
            "required": ["product_id"],
        },
    },
  • main.py:480-489 (registration)
    Alternative/second registration of 'get_product' in another MCP tool listing, with input schema expecting variant_id (integer).
        "name": "get_product",
        "description": "Get full details for a specific product by its Shopify variant ID.",
        "inputSchema": {
            "type": "object",
            "properties": {
                "variant_id": {"type": "integer", "description": "Shopify variant ID of the product"}
            },
            "required": ["variant_id"]
        }
    },
  • main.py:574-580 (registration)
    Registration in the REST route mapping that forwards 'get_product' tool calls to the '/tools/get_product' endpoint.
    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",
    }
  • Helper function 'shopify_get' used by the handler to make authenticated GET requests to the Shopify Admin API.
    async def shopify_get(path: str, params: dict = {}):
        async with httpx.AsyncClient(timeout=15) as client:
            r = await client.get(f"{SHOPIFY_BASE}/{path}", headers=SHOPIFY_HEADERS, params=params)
            r.raise_for_status()
            return r.json()
Behavior2/5

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

No annotations provided, so the description carries full burden. It only states 'Get full details' without disclosing side effects, permissions, or what constitutes 'full details,' leaving significant 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?

Single, concise sentence with no unnecessary words, efficiently conveying the tool's purpose.

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?

Adequate for a simple tool with one parameter, but lacking details about the output structure or any disclaimers, which would improve completeness.

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% with a clear description for variant_id. The description echoes this without adding new meaning, meeting baseline requirement.

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 states the tool retrieves full details for a specific product using a Shopify variant ID. It distinguishes from siblings like get_order_status and place_order, making its purpose unambiguous.

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

Usage Guidelines3/5

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

The description implies usage for fetching product details by variant ID, but no explicit guidance on when to use this vs. search_products for broader queries, 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