Class ShopifyTools

java.lang.Object
com.tnsai.tools.commerce.ShopifyTools

public class ShopifyTools extends Object
Function-shape Shopify tools — Storefront GraphQL API (read-only). Replaces the legacy ShopifyACPTool (single dispatched tool). Splits the most- useful subset of the legacy operations (search/product) into typed @Tool methods. Cart / checkout / inventory can be added piecewise as real consumers need them.
MethodGraphQL surfaceIdempotent
shopifySearch(java.lang.String, int)products(query, first)true
shopifyGetProduct(java.lang.String)productByHandle(handle)true

Requires SHOPIFY_STOREFRONT_TOKEN + SHOPIFY_SHOP_DOMAIN (e.g. mystore.myshopify.com). The Storefront token is created in Shopify Admin → Apps → Develop apps → Storefront API access.

Since:
0.5.7 (Phase 2 batch 14b — built-in tool migration to function shape, see #188)
  • Constructor Details

    • ShopifyTools

      public ShopifyTools()
      Default constructor — picks SHOPIFY_STOREFRONT_TOKEN + SHOPIFY_SHOP_DOMAIN from env.
    • ShopifyTools

      public ShopifyTools(String storefrontToken, String shopDomain)
      Explicit-credentials constructor.
    • ShopifyTools

      public ShopifyTools(String storefrontToken, String shopDomain, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper)
      Full constructor for tests / shared HTTP.
  • Method Details

    • shopifySearch

      @Tool(name="shopify_search", description="Search Shopify products via Storefront GraphQL. {query} is a free-text product query (e.g. \"shoes\", \"red dress\"). {limit} clamps to [1, 100]. Returns the raw GraphQL JSON response (data.products.edges). Requires SHOPIFY_STOREFRONT_TOKEN + SHOPIFY_SHOP_DOMAIN.", keywords={"shopify","ecommerce","store","search","product"}, idempotent=true) public String shopifySearch(@ToolParam(description="Free-text product search query") String query, @ToolParam(description="Max results (1..100); 0 \u2192 default 10",required=false,defaultValue="0") int limit) throws IOException
      Throws:
      IOException
    • shopifyGetProduct

      @Tool(name="shopify_get_product", description="Fetch a single Shopify product by its handle (URL slug, e.g. \"red-dress\"). Returns the full GraphQL JSON response with title, description, images, and pricing. Requires SHOPIFY_STOREFRONT_TOKEN + SHOPIFY_SHOP_DOMAIN.", keywords={"shopify","product","detail","handle"}, idempotent=true) public String shopifyGetProduct(@ToolParam(description="Product handle (URL slug)") String handle) throws IOException
      Throws:
      IOException