Skip to main content
Glama

search_products

Find hats in The Investor Hat Store catalog by entering search terms to view available items with names, descriptions, and prices.

Instructions

Search for products in the hat store. Returns available hats with names, descriptions, and prices.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSearch query (e.g. 'accredited investor hat')

Implementation Reference

  • main.py:237-265 (handler)
    The handler implementation for the search_products tool, which processes the request, calls the Shopify API, and formats the response.
    @app.post("/tools/search_products")
    async def search_products(request: Request):
        body = await request.json()
        query = body.get("query", "")
        limit = body.get("limit", 10)
    
        # Use full-text search if available, fall back to title filter
        params = {"limit": limit, "status": "active"}
        if query:
            params["title"] = query
        data = await shopify_get("products.json", params)
        products = data.get("products", [])
    
        return {
            "products": [
                {
                    "id": str(p["id"]),
                    "title": p["title"],
                    "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"]),  # 1:1 peg
                            "sku": v.get("sku", ""),
                        }
                        for v in p.get("variants", [])

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