@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
|
@@ -14,7 +14,7 @@ exports.metadata = {
|
|
|
14
14
|
};
|
|
15
15
|
exports.tool = {
|
|
16
16
|
name: 'create_checkout_session',
|
|
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\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```",
|
|
18
18
|
inputSchema: {
|
|
19
19
|
type: 'object',
|
|
20
20
|
properties: {
|
|
@@ -84,7 +84,15 @@ exports.tool = {
|
|
|
84
84
|
};
|
|
85
85
|
const handler = async (client, args) => {
|
|
86
86
|
const { jq_filter, ...body } = args;
|
|
87
|
-
|
|
87
|
+
try {
|
|
88
|
+
return (0, types_1.asTextContentResult)(await (0, filtering_1.maybeFilter)(jq_filter, await client.checkout.session.createQuote(body)));
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if ((0, filtering_1.isJqError)(error)) {
|
|
92
|
+
return (0, types_1.asErrorResult)(error.message);
|
|
93
|
+
}
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
88
96
|
};
|
|
89
97
|
exports.handler = handler;
|
|
90
98
|
exports.default = { metadata: exports.metadata, tool: exports.tool, handler: exports.handler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-checkout-session.js","sourceRoot":"","sources":["../../../src/tools/checkout/session/create-checkout-session.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"create-checkout-session.js","sourceRoot":"","sources":["../../../src/tools/checkout/session/create-checkout-session.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAkE;AAClE,sDAA0F;AAK7E,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,kBAAkB;IAC5B,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,yBAAyB;IACnC,WAAW,EAAE,4BAA4B;CAC1C,CAAC;AAEW,QAAA,IAAI,GAAS;IACxB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,wvEAAwvE;IAC1vE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,gBAAgB;qBAC9B;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,MAAM;qBACpB;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,cAAc;qBAC5B;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,OAAO;qBACrB;oBACD,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,WAAW;qBACzB;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,cAAc;qBAC5B;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,aAAa;qBAC3B;oBACD,eAAe,EAAE;wBACf,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,mBAAmB;qBACjC;oBACD,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,gBAAgB;qBAC9B;iBACF;gBACD,QAAQ,EAAE;oBACR,cAAc;oBACd,MAAM;oBACN,aAAa;oBACb,OAAO;oBACP,UAAU;oBACV,aAAa;oBACb,YAAY;oBACZ,iBAAiB;iBAClB;aACF;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;aACf;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,WAAW,EACT,kWAAkW;aACrW;SACF;QACD,QAAQ,EAAE,CAAC,iBAAiB,EAAE,WAAW,CAAC;KAC3C;IACD,WAAW,EAAE,EAAE;CAChB,CAAC;AAEK,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,IAAA,2BAAmB,EAAC,MAAM,IAAA,uBAAW,EAAC,SAAS,EAAE,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5G,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,IAAA,qBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,IAAA,qBAAa,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,OAAO,WAUlB;AAEF,kBAAe,EAAE,QAAQ,EAAR,gBAAQ,EAAE,IAAI,EAAJ,YAAI,EAAE,OAAO,EAAP,eAAO,EAAE,CAAC"}
|
|
@@ -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: 'checkout.session',
|
|
6
6
|
operation: 'write',
|
|
@@ -11,7 +11,7 @@ export const metadata = {
|
|
|
11
11
|
};
|
|
12
12
|
export const tool = {
|
|
13
13
|
name: 'create_checkout_session',
|
|
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\
|
|
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\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```",
|
|
15
15
|
inputSchema: {
|
|
16
16
|
type: 'object',
|
|
17
17
|
properties: {
|
|
@@ -81,7 +81,15 @@ export const tool = {
|
|
|
81
81
|
};
|
|
82
82
|
export const handler = async (client, args) => {
|
|
83
83
|
const { jq_filter, ...body } = args;
|
|
84
|
-
|
|
84
|
+
try {
|
|
85
|
+
return asTextContentResult(await maybeFilter(jq_filter, await client.checkout.session.createQuote(body)));
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (isJqError(error)) {
|
|
89
|
+
return asErrorResult(error.message);
|
|
90
|
+
}
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
85
93
|
};
|
|
86
94
|
export default { metadata, tool, handler };
|
|
87
95
|
//# sourceMappingURL=create-checkout-session.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-checkout-session.mjs","sourceRoot":"","sources":["../../../src/tools/checkout/session/create-checkout-session.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE,MAAM,0BAA0B;
|
|
1
|
+
{"version":3,"file":"create-checkout-session.mjs","sourceRoot":"","sources":["../../../src/tools/checkout/session/create-checkout-session.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,kBAAkB;IAC5B,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,yBAAyB;IACnC,WAAW,EAAE,4BAA4B;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,wvEAAwvE;IAC1vE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,gBAAgB;qBAC9B;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,MAAM;qBACpB;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,cAAc;qBAC5B;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,OAAO;qBACrB;oBACD,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,WAAW;qBACzB;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,cAAc;qBAC5B;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,aAAa;qBAC3B;oBACD,eAAe,EAAE;wBACf,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,mBAAmB;qBACjC;oBACD,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,gBAAgB;qBAC9B;iBACF;gBACD,QAAQ,EAAE;oBACR,cAAc;oBACd,MAAM;oBACN,aAAa;oBACb,OAAO;oBACP,UAAU;oBACV,aAAa;oBACb,YAAY;oBACZ,iBAAiB;iBAClB;aACF;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;aACf;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,WAAW,EACT,kWAAkW;aACrW;SACF;QACD,QAAQ,EAAE,CAAC,iBAAiB,EAAE,WAAW,CAAC;KAC3C;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,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5G,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":"retrieve-status-orders.d.mts","sourceRoot":"","sources":["../../src/tools/orders/retrieve-status-orders.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"retrieve-status-orders.d.mts","sourceRoot":"","sources":["../../src/tools/orders/retrieve-status-orders.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,IAsBlB,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":"retrieve-status-orders.d.ts","sourceRoot":"","sources":["../../src/tools/orders/retrieve-status-orders.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"retrieve-status-orders.d.ts","sourceRoot":"","sources":["../../src/tools/orders/retrieve-status-orders.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,IAsBlB,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: 'retrieve_status_orders',
|
|
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\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```",
|
|
18
18
|
inputSchema: {
|
|
19
19
|
type: 'object',
|
|
20
20
|
properties: {
|
|
@@ -35,7 +35,15 @@ exports.tool = {
|
|
|
35
35
|
};
|
|
36
36
|
const handler = async (client, args) => {
|
|
37
37
|
const { orderId, jq_filter, ...body } = args;
|
|
38
|
-
|
|
38
|
+
try {
|
|
39
|
+
return (0, types_1.asTextContentResult)(await (0, filtering_1.maybeFilter)(jq_filter, await client.orders.retrieveStatus(orderId)));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if ((0, filtering_1.isJqError)(error)) {
|
|
43
|
+
return (0, types_1.asErrorResult)(error.message);
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
39
47
|
};
|
|
40
48
|
exports.handler = handler;
|
|
41
49
|
exports.default = { metadata: exports.metadata, tool: exports.tool, handler: exports.handler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-status-orders.js","sourceRoot":"","sources":["../../src/tools/orders/retrieve-status-orders.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"retrieve-status-orders.js","sourceRoot":"","sources":["../../src/tools/orders/retrieve-status-orders.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAkE;AAClE,sDAA0F;AAK7E,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC5B,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,mBAAmB;IAC7B,WAAW,EAAE,gBAAgB;CAC9B,CAAC;AAEW,QAAA,IAAI,GAAS;IACxB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,s5HAAs5H;IACx5H,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;aACf;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,WAAW,EACT,kWAAkW;aACrW;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEK,MAAM,OAAO,GAAG,KAAK,EAAE,MAAgB,EAAE,IAAyC,EAAE,EAAE;IAC3F,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAW,CAAC;IACpD,IAAI,CAAC;QACH,OAAO,IAAA,2BAAmB,EAAC,MAAM,IAAA,uBAAW,EAAC,SAAS,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACxG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,IAAA,qBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,IAAA,qBAAa,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,OAAO,WAUlB;AAEF,kBAAe,EAAE,QAAQ,EAAR,gBAAQ,EAAE,IAAI,EAAJ,YAAI,EAAE,OAAO,EAAP,eAAO,EAAE,CAAC"}
|
|
@@ -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: 'orders',
|
|
6
6
|
operation: 'read',
|
|
@@ -11,7 +11,7 @@ export const metadata = {
|
|
|
11
11
|
};
|
|
12
12
|
export const tool = {
|
|
13
13
|
name: 'retrieve_status_orders',
|
|
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\
|
|
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\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```",
|
|
15
15
|
inputSchema: {
|
|
16
16
|
type: 'object',
|
|
17
17
|
properties: {
|
|
@@ -32,7 +32,15 @@ export const tool = {
|
|
|
32
32
|
};
|
|
33
33
|
export const handler = async (client, args) => {
|
|
34
34
|
const { orderId, jq_filter, ...body } = args;
|
|
35
|
-
|
|
35
|
+
try {
|
|
36
|
+
return asTextContentResult(await maybeFilter(jq_filter, await client.orders.retrieveStatus(orderId)));
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (isJqError(error)) {
|
|
40
|
+
return asErrorResult(error.message);
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
36
44
|
};
|
|
37
45
|
export default { metadata, tool, handler };
|
|
38
46
|
//# sourceMappingURL=retrieve-status-orders.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-status-orders.mjs","sourceRoot":"","sources":["../../src/tools/orders/retrieve-status-orders.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE,MAAM,0BAA0B;
|
|
1
|
+
{"version":3,"file":"retrieve-status-orders.mjs","sourceRoot":"","sources":["../../src/tools/orders/retrieve-status-orders.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,QAAQ;IAClB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC5B,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,mBAAmB;IAC7B,WAAW,EAAE,gBAAgB;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,s5HAAs5H;IACx5H,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;aACf;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,WAAW,EACT,kWAAkW;aACrW;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,MAAgB,EAAE,IAAyC,EAAE,EAAE;IAC3F,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAW,CAAC;IACpD,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,MAAM,WAAW,CAAC,SAAS,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACxG,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":"retrieve-product-details.d.mts","sourceRoot":"","sources":["../../src/tools/products/retrieve-product-details.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retrieve-product-details.d.mts","sourceRoot":"","sources":["../../src/tools/products/retrieve-product-details.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB,MAAM,4BAA4B;OAEnE,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,QAAQ,MAAM,gBAAgB;AAErC,eAAO,MAAM,QAAQ,EAAE,QAOtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IAiBlB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,QAAQ,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,iEAGxF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAHoC,QAAQ,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAKzF,wBAA2C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-product-details.d.ts","sourceRoot":"","sources":["../../src/tools/products/retrieve-product-details.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retrieve-product-details.d.ts","sourceRoot":"","sources":["../../src/tools/products/retrieve-product-details.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB,MAAM,4BAA4B;OAEnE,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,QAAQ,MAAM,gBAAgB;AAErC,eAAO,MAAM,QAAQ,EAAE,QAOtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IAiBlB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,QAAQ,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,iEAGxF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAHoC,QAAQ,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAKzF,wBAA2C"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.handler = exports.tool = exports.metadata = void 0;
|
|
5
|
-
const filtering_1 = require("@henrylabs/mcp/filtering");
|
|
6
5
|
const types_1 = require("@henrylabs/mcp/tools/types");
|
|
7
6
|
exports.metadata = {
|
|
8
7
|
resource: 'products',
|
|
@@ -14,7 +13,7 @@ exports.metadata = {
|
|
|
14
13
|
};
|
|
15
14
|
exports.tool = {
|
|
16
15
|
name: 'retrieve_product_details',
|
|
17
|
-
description:
|
|
16
|
+
description: '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',
|
|
18
17
|
inputSchema: {
|
|
19
18
|
type: 'object',
|
|
20
19
|
properties: {
|
|
@@ -22,11 +21,6 @@ exports.tool = {
|
|
|
22
21
|
type: 'string',
|
|
23
22
|
description: 'Product ID',
|
|
24
23
|
},
|
|
25
|
-
jq_filter: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
title: 'jq Filter',
|
|
28
|
-
description: '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/).',
|
|
29
|
-
},
|
|
30
24
|
},
|
|
31
25
|
required: ['productId'],
|
|
32
26
|
},
|
|
@@ -35,8 +29,8 @@ exports.tool = {
|
|
|
35
29
|
},
|
|
36
30
|
};
|
|
37
31
|
const handler = async (client, args) => {
|
|
38
|
-
const
|
|
39
|
-
return (0, types_1.asTextContentResult)(await
|
|
32
|
+
const body = args;
|
|
33
|
+
return (0, types_1.asTextContentResult)(await client.products.retrieveDetails(body));
|
|
40
34
|
};
|
|
41
35
|
exports.handler = handler;
|
|
42
36
|
exports.default = { metadata: exports.metadata, tool: exports.tool, handler: exports.handler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-product-details.js","sourceRoot":"","sources":["../../src/tools/products/retrieve-product-details.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"retrieve-product-details.js","sourceRoot":"","sources":["../../src/tools/products/retrieve-product-details.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sDAA2E;AAK9D,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC5B,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,mBAAmB;IAC7B,WAAW,EAAE,mBAAmB;CACjC,CAAC;AAEW,QAAA,IAAI,GAAS;IACxB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EACT,+bAA+b;IACjc,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,YAAY;aAC1B;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEK,MAAM,OAAO,GAAG,KAAK,EAAE,MAAgB,EAAE,IAAyC,EAAE,EAAE;IAC3F,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,OAAO,IAAA,2BAAmB,EAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAHW,QAAA,OAAO,WAGlB;AAEF,kBAAe,EAAE,QAAQ,EAAR,gBAAQ,EAAE,IAAI,EAAJ,YAAI,EAAE,OAAO,EAAP,eAAO,EAAE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { maybeFilter } from '@henrylabs/mcp/filtering';
|
|
3
2
|
import { asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
4
3
|
export const metadata = {
|
|
5
4
|
resource: 'products',
|
|
@@ -11,7 +10,7 @@ export const metadata = {
|
|
|
11
10
|
};
|
|
12
11
|
export const tool = {
|
|
13
12
|
name: 'retrieve_product_details',
|
|
14
|
-
description:
|
|
13
|
+
description: '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',
|
|
15
14
|
inputSchema: {
|
|
16
15
|
type: 'object',
|
|
17
16
|
properties: {
|
|
@@ -19,11 +18,6 @@ export const tool = {
|
|
|
19
18
|
type: 'string',
|
|
20
19
|
description: 'Product ID',
|
|
21
20
|
},
|
|
22
|
-
jq_filter: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
title: 'jq Filter',
|
|
25
|
-
description: '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/).',
|
|
26
|
-
},
|
|
27
21
|
},
|
|
28
22
|
required: ['productId'],
|
|
29
23
|
},
|
|
@@ -32,8 +26,8 @@ export const tool = {
|
|
|
32
26
|
},
|
|
33
27
|
};
|
|
34
28
|
export const handler = async (client, args) => {
|
|
35
|
-
const
|
|
36
|
-
return asTextContentResult(await
|
|
29
|
+
const body = args;
|
|
30
|
+
return asTextContentResult(await client.products.retrieveDetails(body));
|
|
37
31
|
};
|
|
38
32
|
export default { metadata, tool, handler };
|
|
39
33
|
//# sourceMappingURL=retrieve-product-details.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-product-details.mjs","sourceRoot":"","sources":["../../src/tools/products/retrieve-product-details.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,
|
|
1
|
+
{"version":3,"file":"retrieve-product-details.mjs","sourceRoot":"","sources":["../../src/tools/products/retrieve-product-details.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAY,mBAAmB,EAAE,MAAM,4BAA4B;AAK1E,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC5B,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,mBAAmB;IAC7B,WAAW,EAAE,mBAAmB;CACjC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EACT,+bAA+b;IACjc,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,YAAY;aAC1B;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,MAAgB,EAAE,IAAyC,EAAE,EAAE;IAC3F,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,OAAO,mBAAmB,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-products.d.mts","sourceRoot":"","sources":["../../src/tools/products/search-products.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"search-products.d.mts","sourceRoot":"","sources":["../../src/tools/products/search-products.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,IA8ElB,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":"search-products.d.ts","sourceRoot":"","sources":["../../src/tools/products/search-products.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"search-products.d.ts","sourceRoot":"","sources":["../../src/tools/products/search-products.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,IA8ElB,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: 'search_products',
|
|
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\nSearch for products
|
|
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\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```",
|
|
18
18
|
inputSchema: {
|
|
19
19
|
type: 'object',
|
|
20
20
|
properties: {
|
|
@@ -24,15 +24,23 @@ exports.tool = {
|
|
|
24
24
|
},
|
|
25
25
|
color: {
|
|
26
26
|
type: 'string',
|
|
27
|
-
description: '
|
|
27
|
+
description: '[Deprecated] Filter results by color',
|
|
28
|
+
},
|
|
29
|
+
cursor: {
|
|
30
|
+
type: 'integer',
|
|
31
|
+
description: 'Cursor returned from the previous response (SerpAPI start param)',
|
|
32
|
+
},
|
|
33
|
+
freeShipping: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
description: 'Restrict results to listings with free shipping',
|
|
28
36
|
},
|
|
29
37
|
gender: {
|
|
30
38
|
type: 'string',
|
|
31
|
-
description: '
|
|
39
|
+
description: '[Deprecated] Filter results by gender',
|
|
32
40
|
},
|
|
33
41
|
greaterThanPrice: {
|
|
34
42
|
type: 'number',
|
|
35
|
-
description: '
|
|
43
|
+
description: '[Deprecated] Alias for minPrice. Maintained for backwards compatibility.',
|
|
36
44
|
},
|
|
37
45
|
limit: {
|
|
38
46
|
type: 'integer',
|
|
@@ -40,19 +48,36 @@ exports.tool = {
|
|
|
40
48
|
},
|
|
41
49
|
lowerThanPrice: {
|
|
42
50
|
type: 'number',
|
|
43
|
-
description: '
|
|
51
|
+
description: '[Deprecated] Alias for maxPrice. Maintained for backwards compatibility.',
|
|
44
52
|
},
|
|
45
53
|
manufacturer: {
|
|
46
54
|
type: 'string',
|
|
47
|
-
description: '
|
|
55
|
+
description: '[Deprecated] Filter results by manufacturer',
|
|
56
|
+
},
|
|
57
|
+
maxPrice: {
|
|
58
|
+
type: 'number',
|
|
59
|
+
description: 'Maximum price filter',
|
|
60
|
+
},
|
|
61
|
+
minPrice: {
|
|
62
|
+
type: 'number',
|
|
63
|
+
description: 'Minimum price filter',
|
|
48
64
|
},
|
|
49
65
|
region: {
|
|
50
66
|
type: 'string',
|
|
51
|
-
description: 'Region',
|
|
67
|
+
description: '[Deprecated] Region filter (defaults to `us`).',
|
|
52
68
|
},
|
|
53
69
|
size: {
|
|
54
70
|
type: 'string',
|
|
55
|
-
description: '
|
|
71
|
+
description: '[Deprecated] Filter results by size',
|
|
72
|
+
},
|
|
73
|
+
smallBusiness: {
|
|
74
|
+
type: 'boolean',
|
|
75
|
+
description: 'Restrict results to merchants labeled as small business',
|
|
76
|
+
},
|
|
77
|
+
sortBy: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'Sort order: 1 = price low→high, 2 = price high→low',
|
|
80
|
+
enum: [1, 2],
|
|
56
81
|
},
|
|
57
82
|
jq_filter: {
|
|
58
83
|
type: 'string',
|
|
@@ -66,7 +91,15 @@ exports.tool = {
|
|
|
66
91
|
};
|
|
67
92
|
const handler = async (client, args) => {
|
|
68
93
|
const { jq_filter, ...body } = args;
|
|
69
|
-
|
|
94
|
+
try {
|
|
95
|
+
return (0, types_1.asTextContentResult)(await (0, filtering_1.maybeFilter)(jq_filter, await client.products.search(body)));
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if ((0, filtering_1.isJqError)(error)) {
|
|
99
|
+
return (0, types_1.asErrorResult)(error.message);
|
|
100
|
+
}
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
70
103
|
};
|
|
71
104
|
exports.handler = handler;
|
|
72
105
|
exports.default = { metadata: exports.metadata, tool: exports.tool, handler: exports.handler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-products.js","sourceRoot":"","sources":["../../src/tools/products/search-products.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"search-products.js","sourceRoot":"","sources":["../../src/tools/products/search-products.ts"],"names":[],"mappings":"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"}
|