@henrylabs/mcp 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +204 -20
- package/filtering.d.mts +1 -0
- package/filtering.d.mts.map +1 -1
- package/filtering.d.ts +1 -0
- package/filtering.d.ts.map +1 -1
- package/filtering.js +4 -0
- package/filtering.js.map +1 -1
- package/filtering.mjs +3 -0
- package/filtering.mjs.map +1 -1
- package/package.json +3 -3
- package/server.js +1 -1
- package/server.js.map +1 -1
- package/server.mjs +1 -1
- package/server.mjs.map +1 -1
- package/src/filtering.ts +4 -0
- package/src/server.ts +1 -1
- package/src/tools/cart/create-cart-checkout.ts +11 -4
- package/src/tools/cart/items/add-cart-items.ts +12 -5
- package/src/tools/cart/items/clear-cart-items.ts +12 -5
- package/src/tools/cart/items/list-cart-items.ts +12 -5
- package/src/tools/cart/items/remove-cart-items.ts +12 -5
- package/src/tools/checkout/session/confirm-checkout-session.ts +13 -6
- package/src/tools/checkout/session/create-checkout-session.ts +11 -4
- package/src/tools/orders/retrieve-status-orders.ts +11 -4
- package/src/tools/products/retrieve-product-details.ts +3 -10
- package/src/tools/products/search-products.ts +43 -11
- package/src/tools/types.ts +12 -0
- package/src/tools/wallet/collect-payment-details.ts +11 -4
- package/tools/cart/create-cart-checkout.d.mts.map +1 -1
- package/tools/cart/create-cart-checkout.d.ts.map +1 -1
- package/tools/cart/create-cart-checkout.js +10 -2
- package/tools/cart/create-cart-checkout.js.map +1 -1
- package/tools/cart/create-cart-checkout.mjs +12 -4
- package/tools/cart/create-cart-checkout.mjs.map +1 -1
- package/tools/cart/items/add-cart-items.d.mts.map +1 -1
- package/tools/cart/items/add-cart-items.d.ts.map +1 -1
- package/tools/cart/items/add-cart-items.js +11 -3
- package/tools/cart/items/add-cart-items.js.map +1 -1
- package/tools/cart/items/add-cart-items.mjs +13 -5
- package/tools/cart/items/add-cart-items.mjs.map +1 -1
- package/tools/cart/items/clear-cart-items.d.mts.map +1 -1
- package/tools/cart/items/clear-cart-items.d.ts.map +1 -1
- package/tools/cart/items/clear-cart-items.js +11 -3
- package/tools/cart/items/clear-cart-items.js.map +1 -1
- package/tools/cart/items/clear-cart-items.mjs +13 -5
- package/tools/cart/items/clear-cart-items.mjs.map +1 -1
- package/tools/cart/items/list-cart-items.d.mts.map +1 -1
- package/tools/cart/items/list-cart-items.d.ts.map +1 -1
- package/tools/cart/items/list-cart-items.js +11 -3
- package/tools/cart/items/list-cart-items.js.map +1 -1
- package/tools/cart/items/list-cart-items.mjs +13 -5
- package/tools/cart/items/list-cart-items.mjs.map +1 -1
- package/tools/cart/items/remove-cart-items.d.mts.map +1 -1
- package/tools/cart/items/remove-cart-items.d.ts.map +1 -1
- package/tools/cart/items/remove-cart-items.js +11 -3
- package/tools/cart/items/remove-cart-items.js.map +1 -1
- package/tools/cart/items/remove-cart-items.mjs +13 -5
- package/tools/cart/items/remove-cart-items.mjs.map +1 -1
- package/tools/checkout/session/confirm-checkout-session.d.mts.map +1 -1
- package/tools/checkout/session/confirm-checkout-session.d.ts.map +1 -1
- package/tools/checkout/session/confirm-checkout-session.js +10 -2
- package/tools/checkout/session/confirm-checkout-session.js.map +1 -1
- package/tools/checkout/session/confirm-checkout-session.mjs +12 -4
- package/tools/checkout/session/confirm-checkout-session.mjs.map +1 -1
- package/tools/checkout/session/create-checkout-session.d.mts.map +1 -1
- package/tools/checkout/session/create-checkout-session.d.ts.map +1 -1
- package/tools/checkout/session/create-checkout-session.js +10 -2
- package/tools/checkout/session/create-checkout-session.js.map +1 -1
- package/tools/checkout/session/create-checkout-session.mjs +12 -4
- package/tools/checkout/session/create-checkout-session.mjs.map +1 -1
- package/tools/orders/retrieve-status-orders.d.mts.map +1 -1
- package/tools/orders/retrieve-status-orders.d.ts.map +1 -1
- package/tools/orders/retrieve-status-orders.js +10 -2
- package/tools/orders/retrieve-status-orders.js.map +1 -1
- package/tools/orders/retrieve-status-orders.mjs +12 -4
- package/tools/orders/retrieve-status-orders.mjs.map +1 -1
- package/tools/products/retrieve-product-details.d.mts.map +1 -1
- package/tools/products/retrieve-product-details.d.ts.map +1 -1
- package/tools/products/retrieve-product-details.js +3 -9
- package/tools/products/retrieve-product-details.js.map +1 -1
- package/tools/products/retrieve-product-details.mjs +3 -9
- package/tools/products/retrieve-product-details.mjs.map +1 -1
- package/tools/products/search-products.d.mts.map +1 -1
- package/tools/products/search-products.d.ts.map +1 -1
- package/tools/products/search-products.js +42 -9
- package/tools/products/search-products.js.map +1 -1
- package/tools/products/search-products.mjs +44 -11
- package/tools/products/search-products.mjs.map +1 -1
- package/tools/types.d.mts +1 -0
- package/tools/types.d.mts.map +1 -1
- package/tools/types.d.ts +1 -0
- package/tools/types.d.ts.map +1 -1
- package/tools/types.js +12 -0
- package/tools/types.js.map +1 -1
- package/tools/types.mjs +11 -0
- package/tools/types.mjs.map +1 -1
- package/tools/wallet/collect-payment-details.d.mts.map +1 -1
- package/tools/wallet/collect-payment-details.d.ts.map +1 -1
- package/tools/wallet/collect-payment-details.js +10 -2
- package/tools/wallet/collect-payment-details.js.map +1 -1
- package/tools/wallet/collect-payment-details.mjs +12 -4
- package/tools/wallet/collect-payment-details.mjs.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
3
|
+
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
+
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
5
|
|
|
6
6
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
7
|
import HenrySDK from '@henrylabs/sdk';
|
|
@@ -9,7 +9,7 @@ import HenrySDK from '@henrylabs/sdk';
|
|
|
9
9
|
export const metadata: Metadata = {
|
|
10
10
|
resource: 'cart.items',
|
|
11
11
|
operation: 'write',
|
|
12
|
-
tags: ['hosted'],
|
|
12
|
+
tags: ['headless', 'hosted'],
|
|
13
13
|
httpMethod: 'delete',
|
|
14
14
|
httpPath: '/cart/items/{productId}',
|
|
15
15
|
operationId: 'deleteCartItem',
|
|
@@ -18,7 +18,7 @@ export const metadata: Metadata = {
|
|
|
18
18
|
export const tool: Tool = {
|
|
19
19
|
name: 'remove_cart_items',
|
|
20
20
|
description:
|
|
21
|
-
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\
|
|
21
|
+
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRemove a specific product from the cart by its productId.\n\nRequired: productId (must match the ID used when adding item)\n\nReturns success confirmation message.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/item_remove_response',\n $defs: {\n item_remove_response: {\n type: 'object',\n properties: {\n message: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
22
22
|
inputSchema: {
|
|
23
23
|
type: 'object',
|
|
24
24
|
properties: {
|
|
@@ -44,7 +44,14 @@ export const tool: Tool = {
|
|
|
44
44
|
|
|
45
45
|
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
46
46
|
const { productId, jq_filter, ...body } = args as any;
|
|
47
|
-
|
|
47
|
+
try {
|
|
48
|
+
return asTextContentResult(await maybeFilter(jq_filter, await client.cart.items.remove(productId, body)));
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (isJqError(error)) {
|
|
51
|
+
return asErrorResult(error.message);
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
48
55
|
};
|
|
49
56
|
|
|
50
57
|
export default { metadata, tool, handler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
3
|
+
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
+
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
5
|
|
|
6
6
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
7
|
import HenrySDK from '@henrylabs/sdk';
|
|
@@ -18,7 +18,7 @@ export const metadata: Metadata = {
|
|
|
18
18
|
export const tool: Tool = {
|
|
19
19
|
name: 'confirm_checkout_session',
|
|
20
20
|
description:
|
|
21
|
-
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\
|
|
21
|
+
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nFinalize the checkout and create an order. Returns order details with order ID.\n\nRequired:\n- x-session-token: From create_checkout_session\n- shippingDetails: Same address object used in create_checkout_session\n\nIMPORTANT: Must call collect_payment_details BEFORE this to save payment method.\n\nReturns order details:\n- id: Order ID (use with retrieve_status_orders)\n- products: List with productName, quantity, productMetadata\n- currency, subtotal, shipping, tax, grandTotal\n- shippingDetails: Delivery address\n- status: Order status (e.g., \"processing\")\n- statusMessage: Human-readable status\n- cardLast4: Last 4 digits of payment card (if available)\n\nAfter confirmation, provide order ID to user for tracking.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/session_confirm_checkout_response',\n $defs: {\n session_confirm_checkout_response: {\n type: 'object',\n properties: {\n message: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n },\n data: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n currency: {\n type: 'string'\n },\n grandTotal: {\n type: 'string'\n },\n products: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n productName: {\n type: 'string'\n },\n quantity: {\n type: 'number'\n },\n productMetadata: {\n type: 'object',\n additionalProperties: true\n }\n },\n required: [ 'productName',\n 'quantity'\n ]\n }\n },\n shipping: {\n type: 'string'\n },\n shippingDetails: {\n type: 'object',\n properties: {\n addressLine1: {\n type: 'string',\n description: 'Address line 1'\n },\n city: {\n type: 'string',\n description: 'City'\n },\n countryCode: {\n type: 'string',\n description: 'Country code'\n },\n email: {\n type: 'string',\n description: 'Email'\n },\n fullName: {\n type: 'string',\n description: 'Full name'\n },\n phoneNumber: {\n type: 'string',\n description: 'Phone number'\n },\n postalCode: {\n type: 'string',\n description: 'Postal code'\n },\n stateOrProvince: {\n type: 'string',\n description: 'State or province'\n },\n addressLine2: {\n type: 'string',\n description: 'Address line 2'\n }\n },\n required: [ 'addressLine1',\n 'city',\n 'countryCode',\n 'email',\n 'fullName',\n 'phoneNumber',\n 'postalCode',\n 'stateOrProvince'\n ]\n },\n status: {\n type: 'string'\n },\n statusMessage: {\n type: 'string'\n },\n subtotal: {\n type: 'string'\n },\n tax: {\n type: 'string'\n },\n cardLast4: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'currency',\n 'grandTotal',\n 'products',\n 'shipping',\n 'shippingDetails',\n 'status',\n 'statusMessage',\n 'subtotal',\n 'tax'\n ]\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
22
22
|
inputSchema: {
|
|
23
23
|
type: 'object',
|
|
24
24
|
properties: {
|
|
@@ -93,9 +93,16 @@ export const tool: Tool = {
|
|
|
93
93
|
|
|
94
94
|
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
95
95
|
const { jq_filter, ...body } = args as any;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
try {
|
|
97
|
+
return asTextContentResult(
|
|
98
|
+
await maybeFilter(jq_filter, await client.checkout.session.confirmCheckout(body)),
|
|
99
|
+
);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
if (isJqError(error)) {
|
|
102
|
+
return asErrorResult(error.message);
|
|
103
|
+
}
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
99
106
|
};
|
|
100
107
|
|
|
101
108
|
export default { metadata, tool, handler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
3
|
+
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
+
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
5
|
|
|
6
6
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
7
|
import HenrySDK from '@henrylabs/sdk';
|
|
@@ -18,7 +18,7 @@ export const metadata: Metadata = {
|
|
|
18
18
|
export const tool: Tool = {
|
|
19
19
|
name: 'create_checkout_session',
|
|
20
20
|
description:
|
|
21
|
-
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\
|
|
21
|
+
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreate/update a checkout session for headless checkout flow. Returns pricing breakdown and session token.\n\nRequired: shippingDetails object with:\n- fullName, email, phoneNumber\n- addressLine1, city, stateOrProvince, postalCode, countryCode\n- addressLine2 (optional)\n\nReturns:\n- order_metadata: shipping details, shipping_total, tax, total_price\n- session_token: Required for confirm_checkout_session\n\nThe session_token expires, so confirm checkout soon after receiving it.\n\nHeadless checkout flow:\n1. create_checkout_session (get quote + token)\n2. collect_payment_details (save card via modal)\n3. confirm_checkout_session (finalize order)\n\nUse hosted checkout (create_cart_checkout) for simpler implementation.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/session_create_quote_response',\n $defs: {\n session_create_quote_response: {\n type: 'object',\n properties: {\n message: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n },\n data: {\n type: 'object',\n properties: {\n order_metadata: {\n type: 'object',\n properties: {\n shipping: {\n type: 'object',\n additionalProperties: true\n },\n shipping_total: {\n type: 'number'\n },\n tax: {\n type: 'number'\n },\n total_price: {\n type: 'number'\n }\n },\n required: [ 'shipping',\n 'shipping_total',\n 'tax',\n 'total_price'\n ]\n },\n session_token: {\n type: 'string'\n }\n },\n required: [ 'order_metadata',\n 'session_token'\n ]\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
22
22
|
inputSchema: {
|
|
23
23
|
type: 'object',
|
|
24
24
|
properties: {
|
|
@@ -90,7 +90,14 @@ export const tool: Tool = {
|
|
|
90
90
|
|
|
91
91
|
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
92
92
|
const { jq_filter, ...body } = args as any;
|
|
93
|
-
|
|
93
|
+
try {
|
|
94
|
+
return asTextContentResult(await maybeFilter(jq_filter, await client.checkout.session.createQuote(body)));
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (isJqError(error)) {
|
|
97
|
+
return asErrorResult(error.message);
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
94
101
|
};
|
|
95
102
|
|
|
96
103
|
export default { metadata, tool, handler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
3
|
+
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
+
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
5
|
|
|
6
6
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
7
|
import HenrySDK from '@henrylabs/sdk';
|
|
@@ -18,7 +18,7 @@ export const metadata: Metadata = {
|
|
|
18
18
|
export const tool: Tool = {
|
|
19
19
|
name: 'retrieve_status_orders',
|
|
20
20
|
description:
|
|
21
|
-
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\
|
|
21
|
+
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCheck the status and details of an order using its order ID.\n\nReturns:\n- id: Order ID\n- status: Current order status (e.g., \"processing\", \"shipped\", \"delivered\")\n- statusMessage: Detailed status description\n- products: Array with productName, quantity, productMetadata (variants)\n- currency, subtotal, shipping, tax, grandTotal\n- shippingDetails: Full delivery address\n- userId: User who placed order\n- cardLast4: Payment card used (last 4 digits)\n\nUse for:\n- Order tracking\n- Status updates\n- Order history\n- Customer support\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/order_retrieve_status_response',\n $defs: {\n order_retrieve_status_response: {\n type: 'object',\n properties: {\n message: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n },\n data: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n currency: {\n type: 'string'\n },\n grandTotal: {\n type: 'string'\n },\n products: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n productName: {\n type: 'string'\n },\n quantity: {\n type: 'number'\n },\n productMetadata: {\n type: 'object',\n additionalProperties: true\n }\n },\n required: [ 'productName',\n 'quantity'\n ]\n }\n },\n shipping: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n statusMessage: {\n type: 'string'\n },\n subtotal: {\n type: 'string'\n },\n tax: {\n type: 'string'\n },\n userId: {\n type: 'string'\n },\n shippingDetails: {\n type: 'object',\n properties: {\n addressLine1: {\n type: 'string'\n },\n city: {\n type: 'string'\n },\n countryCode: {\n type: 'string'\n },\n email: {\n type: 'string'\n },\n fullName: {\n type: 'string'\n },\n phoneNumber: {\n type: 'string'\n },\n postalCode: {\n type: 'string'\n },\n stateOrProvince: {\n type: 'string'\n },\n addressLine2: {\n type: 'string'\n }\n },\n required: [ 'addressLine1',\n 'city',\n 'countryCode',\n 'email',\n 'fullName',\n 'phoneNumber',\n 'postalCode',\n 'stateOrProvince'\n ]\n }\n },\n required: [ 'id',\n 'currency',\n 'grandTotal',\n 'products',\n 'shipping',\n 'status',\n 'statusMessage',\n 'subtotal',\n 'tax',\n 'userId'\n ]\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
22
22
|
inputSchema: {
|
|
23
23
|
type: 'object',
|
|
24
24
|
properties: {
|
|
@@ -41,7 +41,14 @@ export const tool: Tool = {
|
|
|
41
41
|
|
|
42
42
|
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
43
43
|
const { orderId, jq_filter, ...body } = args as any;
|
|
44
|
-
|
|
44
|
+
try {
|
|
45
|
+
return asTextContentResult(await maybeFilter(jq_filter, await client.orders.retrieveStatus(orderId)));
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (isJqError(error)) {
|
|
48
|
+
return asErrorResult(error.message);
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
export default { metadata, tool, handler };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
3
|
import { Metadata, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
4
|
|
|
6
5
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -18,7 +17,7 @@ export const metadata: Metadata = {
|
|
|
18
17
|
export const tool: Tool = {
|
|
19
18
|
name: 'retrieve_product_details',
|
|
20
19
|
description:
|
|
21
|
-
|
|
20
|
+
'Retrieve comprehensive product details using a product ID from search results.\n\nMUST BE CALLED BEFORE adding items to cart - this is the only way to get the productLink required for cart operations.\n\nReturns:\n- Product title, brand, rating, review count\n- Stores array with name, price, shipping, total, and LINK for each retailer\n- Available variants (sizes, colors, etc.) with availability status\n- Thumbnail images (multiple angles)\n',
|
|
22
21
|
inputSchema: {
|
|
23
22
|
type: 'object',
|
|
24
23
|
properties: {
|
|
@@ -26,12 +25,6 @@ export const tool: Tool = {
|
|
|
26
25
|
type: 'string',
|
|
27
26
|
description: 'Product ID',
|
|
28
27
|
},
|
|
29
|
-
jq_filter: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
title: 'jq Filter',
|
|
32
|
-
description:
|
|
33
|
-
'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).',
|
|
34
|
-
},
|
|
35
28
|
},
|
|
36
29
|
required: ['productId'],
|
|
37
30
|
},
|
|
@@ -41,8 +34,8 @@ export const tool: Tool = {
|
|
|
41
34
|
};
|
|
42
35
|
|
|
43
36
|
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
44
|
-
const
|
|
45
|
-
return asTextContentResult(await
|
|
37
|
+
const body = args as any;
|
|
38
|
+
return asTextContentResult(await client.products.retrieveDetails(body));
|
|
46
39
|
};
|
|
47
40
|
|
|
48
41
|
export default { metadata, tool, handler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
3
|
+
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
+
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
5
|
|
|
6
6
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
7
|
import HenrySDK from '@henrylabs/sdk';
|
|
@@ -18,7 +18,7 @@ export const metadata: Metadata = {
|
|
|
18
18
|
export const tool: Tool = {
|
|
19
19
|
name: 'search_products',
|
|
20
20
|
description:
|
|
21
|
-
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nSearch for products
|
|
21
|
+
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nSearch for products using keywords and filters (price range, color, size, gender, manufacturer, region).\n\nReturns basic product information:\n- Product ID (required for next step)\n- Name, price, currency, description\n- Thumbnail image URL\n\nYou MUST call retrieve_product_details() with each product's ID to get:\n- Actual store links for purchasing\n- All available variants\n- Detailed reviews and ratings\n- Price comparisons across stores\n\nRecommended flow:\n1. search_products(query, filters) - Get product IDs\n2. retrieve_product_details(productId) - Get store URLs and variants for each\n3. Present results with images, prices, AND clickable store links\n\nCommon filters: limit (default 10), greaterThanPrice, lowerThanPrice, color, size, gender\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/product_search_response',\n $defs: {\n product_search_response: {\n type: 'object',\n properties: {\n data: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n currency: {\n type: 'string'\n },\n description: {\n type: 'string'\n },\n imageUrl: {\n type: 'string'\n },\n name: {\n type: 'string'\n },\n price: {\n type: 'number'\n },\n source: {\n type: 'string'\n },\n originalPrice: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'currency',\n 'description',\n 'imageUrl',\n 'name',\n 'price',\n 'source'\n ]\n }\n },\n message: {\n type: 'string'\n },\n pagination: {\n type: 'object',\n properties: {\n nextCursor: {\n type: 'string'\n },\n previousCursor: {\n type: 'string'\n }\n },\n required: [ 'nextCursor',\n 'previousCursor'\n ]\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n }\n },\n required: [ 'data',\n 'message',\n 'pagination',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
22
22
|
inputSchema: {
|
|
23
23
|
type: 'object',
|
|
24
24
|
properties: {
|
|
@@ -28,15 +28,23 @@ export const tool: Tool = {
|
|
|
28
28
|
},
|
|
29
29
|
color: {
|
|
30
30
|
type: 'string',
|
|
31
|
-
description: '
|
|
31
|
+
description: '[Deprecated] Filter results by color',
|
|
32
|
+
},
|
|
33
|
+
cursor: {
|
|
34
|
+
type: 'integer',
|
|
35
|
+
description: 'Cursor returned from the previous response (SerpAPI start param)',
|
|
36
|
+
},
|
|
37
|
+
freeShipping: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
description: 'Restrict results to listings with free shipping',
|
|
32
40
|
},
|
|
33
41
|
gender: {
|
|
34
42
|
type: 'string',
|
|
35
|
-
description: '
|
|
43
|
+
description: '[Deprecated] Filter results by gender',
|
|
36
44
|
},
|
|
37
45
|
greaterThanPrice: {
|
|
38
46
|
type: 'number',
|
|
39
|
-
description: '
|
|
47
|
+
description: '[Deprecated] Alias for minPrice. Maintained for backwards compatibility.',
|
|
40
48
|
},
|
|
41
49
|
limit: {
|
|
42
50
|
type: 'integer',
|
|
@@ -44,19 +52,36 @@ export const tool: Tool = {
|
|
|
44
52
|
},
|
|
45
53
|
lowerThanPrice: {
|
|
46
54
|
type: 'number',
|
|
47
|
-
description: '
|
|
55
|
+
description: '[Deprecated] Alias for maxPrice. Maintained for backwards compatibility.',
|
|
48
56
|
},
|
|
49
57
|
manufacturer: {
|
|
50
58
|
type: 'string',
|
|
51
|
-
description: '
|
|
59
|
+
description: '[Deprecated] Filter results by manufacturer',
|
|
60
|
+
},
|
|
61
|
+
maxPrice: {
|
|
62
|
+
type: 'number',
|
|
63
|
+
description: 'Maximum price filter',
|
|
64
|
+
},
|
|
65
|
+
minPrice: {
|
|
66
|
+
type: 'number',
|
|
67
|
+
description: 'Minimum price filter',
|
|
52
68
|
},
|
|
53
69
|
region: {
|
|
54
70
|
type: 'string',
|
|
55
|
-
description: 'Region',
|
|
71
|
+
description: '[Deprecated] Region filter (defaults to `us`).',
|
|
56
72
|
},
|
|
57
73
|
size: {
|
|
58
74
|
type: 'string',
|
|
59
|
-
description: '
|
|
75
|
+
description: '[Deprecated] Filter results by size',
|
|
76
|
+
},
|
|
77
|
+
smallBusiness: {
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
description: 'Restrict results to merchants labeled as small business',
|
|
80
|
+
},
|
|
81
|
+
sortBy: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
description: 'Sort order: 1 = price low→high, 2 = price high→low',
|
|
84
|
+
enum: [1, 2],
|
|
60
85
|
},
|
|
61
86
|
jq_filter: {
|
|
62
87
|
type: 'string',
|
|
@@ -72,7 +97,14 @@ export const tool: Tool = {
|
|
|
72
97
|
|
|
73
98
|
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
74
99
|
const { jq_filter, ...body } = args as any;
|
|
75
|
-
|
|
100
|
+
try {
|
|
101
|
+
return asTextContentResult(await maybeFilter(jq_filter, await client.products.search(body)));
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (isJqError(error)) {
|
|
104
|
+
return asErrorResult(error.message);
|
|
105
|
+
}
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
76
108
|
};
|
|
77
109
|
|
|
78
110
|
export default { metadata, tool, handler };
|
package/src/tools/types.ts
CHANGED
|
@@ -87,6 +87,18 @@ export async function asBinaryContentResult(response: Response): Promise<ToolCal
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
export function asErrorResult(message: string): ToolCallResult {
|
|
91
|
+
return {
|
|
92
|
+
content: [
|
|
93
|
+
{
|
|
94
|
+
type: 'text',
|
|
95
|
+
text: message,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
isError: true,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
90
102
|
export type Metadata = {
|
|
91
103
|
resource: string;
|
|
92
104
|
operation: 'read' | 'write';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
3
|
+
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
+
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
5
|
|
|
6
6
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
7
|
import HenrySDK from '@henrylabs/sdk';
|
|
@@ -18,7 +18,7 @@ export const metadata: Metadata = {
|
|
|
18
18
|
export const tool: Tool = {
|
|
19
19
|
name: 'collect_payment_details',
|
|
20
20
|
description:
|
|
21
|
-
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\
|
|
21
|
+
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nGenerate a modal URL for securely collecting payment card information via Stripe.\n\nMUST be called in headless checkout flow BEFORE confirm_checkout_session.\n\nParameters:\n- auth: true (default) - requires authentication, false for guest checkout\n\nReturns:\n- modal_url: Stripe-hosted page for card collection\n\nWorkflow:\n1. Call this endpoint\n2. Direct user to modal_url to enter payment details\n3. After user completes payment form, proceed with confirm_checkout_session\n\nThe modal handles:\n- PCI-compliant card collection\n- Card validation\n- Secure tokenization\n- Saving card for future use\n\nFor hosted checkout, payment collection is automatic (use create_cart_checkout instead).\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/wallet_create_card_collection_response',\n $defs: {\n wallet_create_card_collection_response: {\n type: 'object',\n properties: {\n message: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n },\n data: {\n type: 'object',\n properties: {\n modal_url: {\n type: 'string'\n }\n },\n required: [ 'modal_url'\n ]\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
22
22
|
inputSchema: {
|
|
23
23
|
type: 'object',
|
|
24
24
|
properties: {
|
|
@@ -43,7 +43,14 @@ export const tool: Tool = {
|
|
|
43
43
|
|
|
44
44
|
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
45
45
|
const { jq_filter, ...body } = args as any;
|
|
46
|
-
|
|
46
|
+
try {
|
|
47
|
+
return asTextContentResult(await maybeFilter(jq_filter, await client.wallet.createCardCollection(body)));
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (isJqError(error)) {
|
|
50
|
+
return asErrorResult(error.message);
|
|
51
|
+
}
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
47
54
|
};
|
|
48
55
|
|
|
49
56
|
export default { metadata, tool, handler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-cart-checkout.d.mts","sourceRoot":"","sources":["../../src/tools/cart/create-cart-checkout.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"create-cart-checkout.d.mts","sourceRoot":"","sources":["../../src/tools/cart/create-cart-checkout.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,EAAsC,MAAM,4BAA4B;OAElF,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,QAAQ,MAAM,gBAAgB;AAErC,eAAO,MAAM,QAAQ,EAAE,QAOtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IAwBlB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,QAAQ,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,iEAUxF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAVoC,QAAQ,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAYzF,wBAA2C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-cart-checkout.d.ts","sourceRoot":"","sources":["../../src/tools/cart/create-cart-checkout.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"create-cart-checkout.d.ts","sourceRoot":"","sources":["../../src/tools/cart/create-cart-checkout.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,EAAsC,MAAM,4BAA4B;OAElF,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,QAAQ,MAAM,gBAAgB;AAErC,eAAO,MAAM,QAAQ,EAAE,QAOtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IAwBlB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,QAAQ,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,iEAUxF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAVoC,QAAQ,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAYzF,wBAA2C"}
|
|
@@ -14,7 +14,7 @@ exports.metadata = {
|
|
|
14
14
|
};
|
|
15
15
|
exports.tool = {
|
|
16
16
|
name: 'create_cart_checkout',
|
|
17
|
-
description: "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nGenerates a hosted checkout URL for the user's cart.
|
|
17
|
+
description: "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nGenerates a fully-hosted checkout URL for the user's cart. This is the SIMPLEST checkout method.\n\nThe hosted page handles:\n- Order review\n- Shipping address collection\n- Payment information (via Stripe)\n- Order confirmation\n- All UI and validation\n\nReturns: checkout_url (direct link for user to complete purchase)\n\nParameters:\n- auth: true (default) - requires user authentication, false for guest checkout\n\nUse this when:\n- You want a quick, complete checkout solution\n- Don't need custom checkout UI\n- Want Stripe to handle payment collection\n\nFor custom checkout UI, use the headless flow instead:\ncreate_checkout_session → collect_payment_details → confirm_checkout_session\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/cart_create_checkout_response',\n $defs: {\n cart_create_checkout_response: {\n type: 'object',\n properties: {\n message: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n },\n data: {\n type: 'object',\n properties: {\n checkout_url: {\n type: 'string'\n }\n },\n required: [ 'checkout_url'\n ]\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
18
18
|
inputSchema: {
|
|
19
19
|
type: 'object',
|
|
20
20
|
properties: {
|
|
@@ -37,7 +37,15 @@ exports.tool = {
|
|
|
37
37
|
};
|
|
38
38
|
const handler = async (client, args) => {
|
|
39
39
|
const { jq_filter, ...body } = args;
|
|
40
|
-
|
|
40
|
+
try {
|
|
41
|
+
return (0, types_1.asTextContentResult)(await (0, filtering_1.maybeFilter)(jq_filter, await client.cart.createCheckout(body)));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if ((0, filtering_1.isJqError)(error)) {
|
|
45
|
+
return (0, types_1.asErrorResult)(error.message);
|
|
46
|
+
}
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
41
49
|
};
|
|
42
50
|
exports.handler = handler;
|
|
43
51
|
exports.default = { metadata: exports.metadata, tool: exports.tool, handler: exports.handler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-cart-checkout.js","sourceRoot":"","sources":["../../src/tools/cart/create-cart-checkout.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"create-cart-checkout.js","sourceRoot":"","sources":["../../src/tools/cart/create-cart-checkout.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAkE;AAClE,sDAA0F;AAK7E,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,MAAM;IAChB,SAAS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|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
3
|
-
import { asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
2
|
+
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
3
|
+
import { asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
4
4
|
export const metadata = {
|
|
5
5
|
resource: 'cart',
|
|
6
6
|
operation: 'write',
|
|
@@ -11,7 +11,7 @@ export const metadata = {
|
|
|
11
11
|
};
|
|
12
12
|
export const tool = {
|
|
13
13
|
name: 'create_cart_checkout',
|
|
14
|
-
description: "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nGenerates a hosted checkout URL for the user's cart.
|
|
14
|
+
description: "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nGenerates a fully-hosted checkout URL for the user's cart. This is the SIMPLEST checkout method.\n\nThe hosted page handles:\n- Order review\n- Shipping address collection\n- Payment information (via Stripe)\n- Order confirmation\n- All UI and validation\n\nReturns: checkout_url (direct link for user to complete purchase)\n\nParameters:\n- auth: true (default) - requires user authentication, false for guest checkout\n\nUse this when:\n- You want a quick, complete checkout solution\n- Don't need custom checkout UI\n- Want Stripe to handle payment collection\n\nFor custom checkout UI, use the headless flow instead:\ncreate_checkout_session → collect_payment_details → confirm_checkout_session\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/cart_create_checkout_response',\n $defs: {\n cart_create_checkout_response: {\n type: 'object',\n properties: {\n message: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n },\n data: {\n type: 'object',\n properties: {\n checkout_url: {\n type: 'string'\n }\n },\n required: [ 'checkout_url'\n ]\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
15
15
|
inputSchema: {
|
|
16
16
|
type: 'object',
|
|
17
17
|
properties: {
|
|
@@ -34,7 +34,15 @@ export const tool = {
|
|
|
34
34
|
};
|
|
35
35
|
export const handler = async (client, args) => {
|
|
36
36
|
const { jq_filter, ...body } = args;
|
|
37
|
-
|
|
37
|
+
try {
|
|
38
|
+
return asTextContentResult(await maybeFilter(jq_filter, await client.cart.createCheckout(body)));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (isJqError(error)) {
|
|
42
|
+
return asErrorResult(error.message);
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
38
46
|
};
|
|
39
47
|
export default { metadata, tool, handler };
|
|
40
48
|
//# sourceMappingURL=create-cart-checkout.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-cart-checkout.mjs","sourceRoot":"","sources":["../../src/tools/cart/create-cart-checkout.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE,MAAM,0BAA0B;
|
|
1
|
+
{"version":3,"file":"create-cart-checkout.mjs","sourceRoot":"","sources":["../../src/tools/cart/create-cart-checkout.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B;OAC1D,EAAY,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B;AAKzF,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,CAAC,QAAQ,CAAC;IAChB,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,gBAAgB;IAC1B,WAAW,EAAE,0BAA0B;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,6hDAA6hD;IAC/hD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;aACf;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,iEAAiE;aAC/E;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,WAAW,EACT,kWAAkW;aACrW;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;IACD,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,MAAgB,EAAE,IAAyC,EAAE,EAAE;IAC3F,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAW,CAAC;IAC3C,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,MAAM,WAAW,CAAC,SAAS,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-cart-items.d.mts","sourceRoot":"","sources":["../../../src/tools/cart/items/add-cart-items.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"add-cart-items.d.mts","sourceRoot":"","sources":["../../../src/tools/cart/items/add-cart-items.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,EAAsC,MAAM,4BAA4B;OAElF,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,QAAQ,MAAM,gBAAgB;AAErC,eAAO,MAAM,QAAQ,EAAE,QAOtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IAoElB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,QAAQ,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,iEAUxF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAVoC,QAAQ,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAYzF,wBAA2C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-cart-items.d.ts","sourceRoot":"","sources":["../../../src/tools/cart/items/add-cart-items.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"add-cart-items.d.ts","sourceRoot":"","sources":["../../../src/tools/cart/items/add-cart-items.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,EAAsC,MAAM,4BAA4B;OAElF,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,QAAQ,MAAM,gBAAgB;AAErC,eAAO,MAAM,QAAQ,EAAE,QAOtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IAoElB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,QAAQ,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,iEAUxF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAVoC,QAAQ,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAYzF,wBAA2C"}
|
|
@@ -7,14 +7,14 @@ const types_1 = require("@henrylabs/mcp/tools/types");
|
|
|
7
7
|
exports.metadata = {
|
|
8
8
|
resource: 'cart.items',
|
|
9
9
|
operation: 'write',
|
|
10
|
-
tags: ['hosted'],
|
|
10
|
+
tags: ['headless', 'hosted'],
|
|
11
11
|
httpMethod: 'post',
|
|
12
12
|
httpPath: '/cart/items',
|
|
13
13
|
operationId: 'addCartItems',
|
|
14
14
|
};
|
|
15
15
|
exports.tool = {
|
|
16
16
|
name: 'add_cart_items',
|
|
17
|
-
description: "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\
|
|
17
|
+
description: "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nAdd products to cart or update quantities if already in cart.\n\nRequired fields per product:\n- name: Product name (from retrieve_product_details)\n- price: Price as string, e.g. \"29.99\" (from stores[0].price)\n- productLink: Store URL (from stores[0].link - MUST call retrieve_product_details first)\n- quantity: Number of items\n\nOptional but IMPORTANT:\n- metadata: Object containing variant selections (size, color, etc.)\n Example: {\"size\": \"Large\", \"color\": \"Blue\"}\n- productImageLink: Thumbnail URL (from thumbnails[0])\n- affiliateProductLink: Use instead of productLink for affiliate tracking\n- productId: Include for easier tracking\n\nVARIANT HANDLING:\nIf retrieve_product_details shows variants array, you MUST:\n1. Show variants to user: \"Available sizes: S, M, L, XL\"\n2. Get user's selection\n3. Include in metadata: {\"size\": \"L\"}\n\nOptional: Set checkVariantAvailability: true to verify variants exist at stores\n\nReturns:\n- added_products: New items in cart\n- updated_products: Items with quantity increases\n- cart_summary: total_items and total_unique_products\n- variant_checks: Availability verification results (if requested)\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/item_add_response',\n $defs: {\n item_add_response: {\n type: 'object',\n properties: {\n message: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n success: {\n type: 'boolean'\n },\n data: {\n type: 'object',\n properties: {\n added_products: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: {\n type: 'string'\n },\n price: {\n type: 'string'\n },\n productId: {\n type: 'string'\n },\n quantity: {\n type: 'number'\n }\n },\n required: [ 'name',\n 'price',\n 'productId',\n 'quantity'\n ]\n }\n },\n cart_summary: {\n type: 'object',\n properties: {\n total_items: {\n type: 'number'\n },\n total_unique_products: {\n type: 'number'\n }\n },\n required: [ 'total_items',\n 'total_unique_products'\n ]\n },\n updated_products: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n addedQuantity: {\n type: 'number'\n },\n name: {\n type: 'string'\n },\n previousQuantity: {\n type: 'number'\n },\n price: {\n type: 'string'\n },\n productId: {\n type: 'string'\n },\n quantity: {\n type: 'number'\n }\n },\n required: [ 'addedQuantity',\n 'name',\n 'previousQuantity',\n 'price',\n 'productId',\n 'quantity'\n ]\n }\n },\n variant_checks: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n productId: {\n type: 'string'\n },\n status: {\n type: 'string'\n },\n variantCheckRequestId: {\n type: 'string'\n }\n },\n required: [ 'productId',\n 'status',\n 'variantCheckRequestId'\n ]\n }\n }\n },\n required: [ 'added_products',\n 'cart_summary',\n 'updated_products'\n ]\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
18
18
|
inputSchema: {
|
|
19
19
|
type: 'object',
|
|
20
20
|
properties: {
|
|
@@ -79,7 +79,15 @@ exports.tool = {
|
|
|
79
79
|
};
|
|
80
80
|
const handler = async (client, args) => {
|
|
81
81
|
const { jq_filter, ...body } = args;
|
|
82
|
-
|
|
82
|
+
try {
|
|
83
|
+
return (0, types_1.asTextContentResult)(await (0, filtering_1.maybeFilter)(jq_filter, await client.cart.items.add(body)));
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if ((0, filtering_1.isJqError)(error)) {
|
|
87
|
+
return (0, types_1.asErrorResult)(error.message);
|
|
88
|
+
}
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
83
91
|
};
|
|
84
92
|
exports.handler = handler;
|
|
85
93
|
exports.default = { metadata: exports.metadata, tool: exports.tool, handler: exports.handler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-cart-items.js","sourceRoot":"","sources":["../../../src/tools/cart/items/add-cart-items.ts"],"names":[],"mappings":";AAAA,sFAAsF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