@henrylabs/mcp 0.14.0 → 0.17.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 +13 -334
- package/code-tool-types.d.mts +2 -0
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +2 -0
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool.d.mts +2 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +2 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +27 -130
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +27 -97
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +15 -9
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +15 -9
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +4 -1
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +4 -1
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts.map +1 -1
- package/http.js +1 -18
- package/http.js.map +1 -1
- package/http.mjs +1 -18
- package/http.mjs.map +1 -1
- package/index.js +4 -40
- package/index.js.map +1 -1
- package/index.mjs +4 -40
- package/index.mjs.map +1 -1
- package/options.d.mts +0 -9
- package/options.d.mts.map +1 -1
- package/options.d.ts +0 -9
- package/options.d.ts.map +1 -1
- package/options.js +4 -359
- package/options.js.map +1 -1
- package/options.mjs +4 -359
- package/options.mjs.map +1 -1
- package/package.json +10 -66
- package/server.d.mts +3 -8
- package/server.d.mts.map +1 -1
- package/server.d.ts +3 -8
- package/server.d.ts.map +1 -1
- package/server.js +12 -65
- package/server.js.map +1 -1
- package/server.mjs +11 -62
- package/server.mjs.map +1 -1
- package/src/code-tool-types.ts +5 -1
- package/src/code-tool.ts +36 -121
- package/src/docs-search-tool.ts +8 -1
- package/src/http.ts +1 -19
- package/src/index.ts +5 -52
- package/src/options.ts +5 -386
- package/src/server.ts +12 -72
- package/src/stdio.ts +2 -3
- package/src/{tools/types.ts → types.ts} +1 -1
- package/stdio.d.mts +1 -2
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +1 -2
- package/stdio.d.ts.map +1 -1
- package/stdio.js +2 -2
- package/stdio.js.map +1 -1
- package/stdio.mjs +2 -2
- package/stdio.mjs.map +1 -1
- package/{tools/types.d.mts → types.d.mts} +1 -1
- package/types.d.mts.map +1 -0
- package/{tools/types.d.ts → types.d.ts} +1 -1
- package/types.d.ts.map +1 -0
- package/types.js.map +1 -0
- package/types.mjs.map +1 -0
- package/code-tool-paths.cjs +0 -6
- package/code-tool-paths.cjs.map +0 -1
- package/code-tool-paths.d.cts +0 -2
- package/code-tool-paths.d.cts.map +0 -1
- package/code-tool-worker.d.mts +0 -5
- package/code-tool-worker.d.mts.map +0 -1
- package/code-tool-worker.d.ts +0 -5
- package/code-tool-worker.d.ts.map +0 -1
- package/code-tool-worker.js +0 -162
- package/code-tool-worker.js.map +0 -1
- package/code-tool-worker.mjs +0 -157
- package/code-tool-worker.mjs.map +0 -1
- package/compat.d.mts +0 -58
- package/compat.d.mts.map +0 -1
- package/compat.d.ts +0 -58
- package/compat.d.ts.map +0 -1
- package/compat.js +0 -387
- package/compat.js.map +0 -1
- package/compat.mjs +0 -378
- package/compat.mjs.map +0 -1
- package/dynamic-tools.d.mts +0 -12
- package/dynamic-tools.d.mts.map +0 -1
- package/dynamic-tools.d.ts +0 -12
- package/dynamic-tools.d.ts.map +0 -1
- package/dynamic-tools.js +0 -135
- package/dynamic-tools.js.map +0 -1
- package/dynamic-tools.mjs +0 -132
- package/dynamic-tools.mjs.map +0 -1
- package/filtering.d.mts +0 -3
- package/filtering.d.mts.map +0 -1
- package/filtering.d.ts +0 -3
- package/filtering.d.ts.map +0 -1
- package/filtering.js +0 -24
- package/filtering.js.map +0 -1
- package/filtering.mjs +0 -16
- package/filtering.mjs.map +0 -1
- package/src/code-tool-paths.cts +0 -3
- package/src/code-tool-worker.ts +0 -208
- package/src/compat.ts +0 -483
- package/src/dynamic-tools.ts +0 -153
- package/src/filtering.ts +0 -18
- package/src/tools/cart/create-cart-checkout.ts +0 -56
- package/src/tools/cart/items/add-cart-items.ts +0 -100
- package/src/tools/cart/items/clear-cart-items.ts +0 -54
- package/src/tools/cart/items/list-cart-items.ts +0 -54
- package/src/tools/cart/items/remove-cart-items.ts +0 -57
- package/src/tools/index.ts +0 -87
- package/src/tools/orders/retrieve-status-orders.ts +0 -54
- package/src/tools/products/retrieve-product-details.ts +0 -41
- package/src/tools/products/search-products.ts +0 -110
- package/src/tools/wallet/collect-payment-details.ts +0 -56
- package/src/tools.ts +0 -1
- package/tools/cart/create-cart-checkout.d.mts +0 -45
- package/tools/cart/create-cart-checkout.d.mts.map +0 -1
- package/tools/cart/create-cart-checkout.d.ts +0 -45
- package/tools/cart/create-cart-checkout.d.ts.map +0 -1
- package/tools/cart/create-cart-checkout.js +0 -52
- package/tools/cart/create-cart-checkout.js.map +0 -1
- package/tools/cart/create-cart-checkout.mjs +0 -48
- package/tools/cart/create-cart-checkout.mjs.map +0 -1
- package/tools/cart/items/add-cart-items.d.mts +0 -45
- package/tools/cart/items/add-cart-items.d.mts.map +0 -1
- package/tools/cart/items/add-cart-items.d.ts +0 -45
- package/tools/cart/items/add-cart-items.d.ts.map +0 -1
- package/tools/cart/items/add-cart-items.js +0 -94
- package/tools/cart/items/add-cart-items.js.map +0 -1
- package/tools/cart/items/add-cart-items.mjs +0 -90
- package/tools/cart/items/add-cart-items.mjs.map +0 -1
- package/tools/cart/items/clear-cart-items.d.mts +0 -45
- package/tools/cart/items/clear-cart-items.d.mts.map +0 -1
- package/tools/cart/items/clear-cart-items.d.ts +0 -45
- package/tools/cart/items/clear-cart-items.d.ts.map +0 -1
- package/tools/cart/items/clear-cart-items.js +0 -50
- package/tools/cart/items/clear-cart-items.js.map +0 -1
- package/tools/cart/items/clear-cart-items.mjs +0 -46
- package/tools/cart/items/clear-cart-items.mjs.map +0 -1
- package/tools/cart/items/list-cart-items.d.mts +0 -45
- package/tools/cart/items/list-cart-items.d.mts.map +0 -1
- package/tools/cart/items/list-cart-items.d.ts +0 -45
- package/tools/cart/items/list-cart-items.d.ts.map +0 -1
- package/tools/cart/items/list-cart-items.js +0 -50
- package/tools/cart/items/list-cart-items.js.map +0 -1
- package/tools/cart/items/list-cart-items.mjs +0 -46
- package/tools/cart/items/list-cart-items.mjs.map +0 -1
- package/tools/cart/items/remove-cart-items.d.mts +0 -45
- package/tools/cart/items/remove-cart-items.d.mts.map +0 -1
- package/tools/cart/items/remove-cart-items.d.ts +0 -45
- package/tools/cart/items/remove-cart-items.d.ts.map +0 -1
- package/tools/cart/items/remove-cart-items.js +0 -53
- package/tools/cart/items/remove-cart-items.js.map +0 -1
- package/tools/cart/items/remove-cart-items.mjs +0 -49
- package/tools/cart/items/remove-cart-items.mjs.map +0 -1
- package/tools/index.d.mts +0 -10
- package/tools/index.d.mts.map +0 -1
- package/tools/index.d.ts +0 -10
- package/tools/index.d.ts.map +0 -1
- package/tools/index.js +0 -71
- package/tools/index.js.map +0 -1
- package/tools/index.mjs +0 -64
- package/tools/index.mjs.map +0 -1
- package/tools/orders/retrieve-status-orders.d.mts +0 -45
- package/tools/orders/retrieve-status-orders.d.mts.map +0 -1
- package/tools/orders/retrieve-status-orders.d.ts +0 -45
- package/tools/orders/retrieve-status-orders.d.ts.map +0 -1
- package/tools/orders/retrieve-status-orders.js +0 -50
- package/tools/orders/retrieve-status-orders.js.map +0 -1
- package/tools/orders/retrieve-status-orders.mjs +0 -46
- package/tools/orders/retrieve-status-orders.mjs.map +0 -1
- package/tools/products/retrieve-product-details.d.mts +0 -45
- package/tools/products/retrieve-product-details.d.mts.map +0 -1
- package/tools/products/retrieve-product-details.d.ts +0 -45
- package/tools/products/retrieve-product-details.d.ts.map +0 -1
- package/tools/products/retrieve-product-details.js +0 -37
- package/tools/products/retrieve-product-details.js.map +0 -1
- package/tools/products/retrieve-product-details.mjs +0 -33
- package/tools/products/retrieve-product-details.mjs.map +0 -1
- package/tools/products/search-products.d.mts +0 -45
- package/tools/products/search-products.d.mts.map +0 -1
- package/tools/products/search-products.d.ts +0 -45
- package/tools/products/search-products.d.ts.map +0 -1
- package/tools/products/search-products.js +0 -106
- package/tools/products/search-products.js.map +0 -1
- package/tools/products/search-products.mjs +0 -102
- package/tools/products/search-products.mjs.map +0 -1
- package/tools/types.d.mts.map +0 -1
- package/tools/types.d.ts.map +0 -1
- package/tools/types.js.map +0 -1
- package/tools/types.mjs.map +0 -1
- package/tools/wallet/collect-payment-details.d.mts +0 -45
- package/tools/wallet/collect-payment-details.d.mts.map +0 -1
- package/tools/wallet/collect-payment-details.d.ts +0 -45
- package/tools/wallet/collect-payment-details.d.ts.map +0 -1
- package/tools/wallet/collect-payment-details.js +0 -52
- package/tools/wallet/collect-payment-details.js.map +0 -1
- package/tools/wallet/collect-payment-details.mjs +0 -48
- package/tools/wallet/collect-payment-details.mjs.map +0 -1
- package/tools.d.mts +0 -2
- package/tools.d.mts.map +0 -1
- package/tools.d.ts +0 -2
- package/tools.d.ts.map +0 -1
- package/tools.js +0 -18
- package/tools.js.map +0 -1
- package/tools.mjs +0 -2
- package/tools.mjs.map +0 -1
- /package/{tools/types.js → types.js} +0 -0
- /package/{tools/types.mjs → types.mjs} +0 -0
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
|
-
|
|
6
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import HenrySDK from '@henrylabs/sdk';
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
resource: 'cart.items',
|
|
11
|
-
operation: 'write',
|
|
12
|
-
tags: [],
|
|
13
|
-
httpMethod: 'post',
|
|
14
|
-
httpPath: '/cart/items',
|
|
15
|
-
operationId: 'addCartItems',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const tool: Tool = {
|
|
19
|
-
name: 'add_cart_items',
|
|
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\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```",
|
|
22
|
-
inputSchema: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
productsDetails: {
|
|
26
|
-
type: 'array',
|
|
27
|
-
items: {
|
|
28
|
-
type: 'object',
|
|
29
|
-
properties: {
|
|
30
|
-
name: {
|
|
31
|
-
type: 'string',
|
|
32
|
-
description: 'Product name',
|
|
33
|
-
},
|
|
34
|
-
price: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
description: 'Product price',
|
|
37
|
-
},
|
|
38
|
-
productLink: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'Product link',
|
|
41
|
-
},
|
|
42
|
-
quantity: {
|
|
43
|
-
type: 'number',
|
|
44
|
-
description: 'Quantity',
|
|
45
|
-
},
|
|
46
|
-
affiliateProductLink: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
description:
|
|
49
|
-
'Affiliate product link (if provided, will be used instead of productLink for order fulfillment)',
|
|
50
|
-
},
|
|
51
|
-
metadata: {
|
|
52
|
-
type: 'object',
|
|
53
|
-
description: 'Product metadata',
|
|
54
|
-
additionalProperties: true,
|
|
55
|
-
},
|
|
56
|
-
productId: {
|
|
57
|
-
type: 'string',
|
|
58
|
-
description: 'Product Id',
|
|
59
|
-
},
|
|
60
|
-
productImageLink: {
|
|
61
|
-
type: 'string',
|
|
62
|
-
description: 'Product image link (thumbnail)',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
required: ['name', 'price', 'productLink', 'quantity'],
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
'x-user-id': {
|
|
69
|
-
type: 'string',
|
|
70
|
-
},
|
|
71
|
-
checkVariantAvailability: {
|
|
72
|
-
type: 'boolean',
|
|
73
|
-
description:
|
|
74
|
-
'Whether to check variant availability after adding to cart. If true, variant check requests will be created for products with metadata and requestIds returned.',
|
|
75
|
-
},
|
|
76
|
-
jq_filter: {
|
|
77
|
-
type: 'string',
|
|
78
|
-
title: 'jq Filter',
|
|
79
|
-
description:
|
|
80
|
-
'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/).',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
required: ['productsDetails', 'x-user-id'],
|
|
84
|
-
},
|
|
85
|
-
annotations: {},
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
89
|
-
const { jq_filter, ...body } = args as any;
|
|
90
|
-
try {
|
|
91
|
-
return asTextContentResult(await maybeFilter(jq_filter, await client.cart.items.add(body)));
|
|
92
|
-
} catch (error) {
|
|
93
|
-
if (isJqError(error)) {
|
|
94
|
-
return asErrorResult(error.message);
|
|
95
|
-
}
|
|
96
|
-
throw error;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default { metadata, tool, handler };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
|
-
|
|
6
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import HenrySDK from '@henrylabs/sdk';
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
resource: 'cart.items',
|
|
11
|
-
operation: 'write',
|
|
12
|
-
tags: [],
|
|
13
|
-
httpMethod: 'delete',
|
|
14
|
-
httpPath: '/cart/items',
|
|
15
|
-
operationId: 'deleteAllCartItems',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const tool: Tool = {
|
|
19
|
-
name: 'clear_cart_items',
|
|
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\nRemove ALL products from the cart. Cannot be undone.\n\nUse when:\n- User wants to start over\n- Clearing abandoned cart\n- After successful order completion\n\nReturns success confirmation message.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/item_clear_response',\n $defs: {\n item_clear_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
|
-
inputSchema: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
'x-user-id': {
|
|
26
|
-
type: 'string',
|
|
27
|
-
},
|
|
28
|
-
jq_filter: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
title: 'jq Filter',
|
|
31
|
-
description:
|
|
32
|
-
'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/).',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
required: ['x-user-id'],
|
|
36
|
-
},
|
|
37
|
-
annotations: {
|
|
38
|
-
idempotentHint: true,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
43
|
-
const { jq_filter, ...body } = args as any;
|
|
44
|
-
try {
|
|
45
|
-
return asTextContentResult(await maybeFilter(jq_filter, await client.cart.items.clear(body)));
|
|
46
|
-
} catch (error) {
|
|
47
|
-
if (isJqError(error)) {
|
|
48
|
-
return asErrorResult(error.message);
|
|
49
|
-
}
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default { metadata, tool, handler };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
|
-
|
|
6
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import HenrySDK from '@henrylabs/sdk';
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
resource: 'cart.items',
|
|
11
|
-
operation: 'read',
|
|
12
|
-
tags: [],
|
|
13
|
-
httpMethod: 'get',
|
|
14
|
-
httpPath: '/cart/items',
|
|
15
|
-
operationId: 'getCartItems',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const tool: Tool = {
|
|
19
|
-
name: 'list_cart_items',
|
|
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\nRetrieve all products currently in the user's cart.\n\nReturns products array with:\n- name, price, productLink, quantity\n- productId (if provided when added)\n- metadata (variant selections)\n- productImageLink (thumbnail)\n- affiliateProductLink (if used)\n\nUse this to:\n- Show cart contents before checkout\n- Calculate totals\n- Verify items before creating checkout\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/item_list_response',\n $defs: {\n item_list_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 products: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'Product name'\n },\n price: {\n type: 'string',\n description: 'Product price'\n },\n productLink: {\n type: 'string',\n description: 'Product link'\n },\n quantity: {\n type: 'number',\n description: 'Quantity'\n },\n affiliateProductLink: {\n type: 'string',\n description: 'Affiliate product link (if provided, will be used instead of productLink for order fulfillment)'\n },\n metadata: {\n type: 'object',\n description: 'Product metadata',\n additionalProperties: true\n },\n productId: {\n type: 'string',\n description: 'Product Id'\n },\n productImageLink: {\n type: 'string',\n description: 'Product image link (thumbnail)'\n }\n },\n required: [ 'name',\n 'price',\n 'productLink',\n 'quantity'\n ]\n }\n }\n },\n required: [ 'products'\n ]\n }\n },\n required: [ 'message',\n 'status',\n 'success'\n ]\n }\n }\n}\n```",
|
|
22
|
-
inputSchema: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
'x-user-id': {
|
|
26
|
-
type: 'string',
|
|
27
|
-
},
|
|
28
|
-
jq_filter: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
title: 'jq Filter',
|
|
31
|
-
description:
|
|
32
|
-
'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/).',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
required: ['x-user-id'],
|
|
36
|
-
},
|
|
37
|
-
annotations: {
|
|
38
|
-
readOnlyHint: true,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
43
|
-
const { jq_filter, ...body } = args as any;
|
|
44
|
-
try {
|
|
45
|
-
return asTextContentResult(await maybeFilter(jq_filter, await client.cart.items.list(body)));
|
|
46
|
-
} catch (error) {
|
|
47
|
-
if (isJqError(error)) {
|
|
48
|
-
return asErrorResult(error.message);
|
|
49
|
-
}
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default { metadata, tool, handler };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
|
-
|
|
6
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import HenrySDK from '@henrylabs/sdk';
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
resource: 'cart.items',
|
|
11
|
-
operation: 'write',
|
|
12
|
-
tags: [],
|
|
13
|
-
httpMethod: 'delete',
|
|
14
|
-
httpPath: '/cart/items/{productId}',
|
|
15
|
-
operationId: 'deleteCartItem',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const tool: Tool = {
|
|
19
|
-
name: 'remove_cart_items',
|
|
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\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
|
-
inputSchema: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
productId: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
},
|
|
28
|
-
'x-user-id': {
|
|
29
|
-
type: 'string',
|
|
30
|
-
},
|
|
31
|
-
jq_filter: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
title: 'jq Filter',
|
|
34
|
-
description:
|
|
35
|
-
'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/).',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
required: ['productId', 'x-user-id'],
|
|
39
|
-
},
|
|
40
|
-
annotations: {
|
|
41
|
-
idempotentHint: true,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
46
|
-
const { productId, jq_filter, ...body } = args as any;
|
|
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
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default { metadata, tool, handler };
|
package/src/tools/index.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { Metadata, Endpoint, HandlerFunction } from './types';
|
|
4
|
-
|
|
5
|
-
export { Metadata, Endpoint, HandlerFunction };
|
|
6
|
-
|
|
7
|
-
import retrieve_product_details from './products/retrieve-product-details';
|
|
8
|
-
import search_products from './products/search-products';
|
|
9
|
-
import create_cart_checkout from './cart/create-cart-checkout';
|
|
10
|
-
import list_cart_items from './cart/items/list-cart-items';
|
|
11
|
-
import add_cart_items from './cart/items/add-cart-items';
|
|
12
|
-
import clear_cart_items from './cart/items/clear-cart-items';
|
|
13
|
-
import remove_cart_items from './cart/items/remove-cart-items';
|
|
14
|
-
import retrieve_status_orders from './orders/retrieve-status-orders';
|
|
15
|
-
import collect_payment_details from './wallet/collect-payment-details';
|
|
16
|
-
|
|
17
|
-
export const endpoints: Endpoint[] = [];
|
|
18
|
-
|
|
19
|
-
function addEndpoint(endpoint: Endpoint) {
|
|
20
|
-
endpoints.push(endpoint);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
addEndpoint(retrieve_product_details);
|
|
24
|
-
addEndpoint(search_products);
|
|
25
|
-
addEndpoint(create_cart_checkout);
|
|
26
|
-
addEndpoint(list_cart_items);
|
|
27
|
-
addEndpoint(add_cart_items);
|
|
28
|
-
addEndpoint(clear_cart_items);
|
|
29
|
-
addEndpoint(remove_cart_items);
|
|
30
|
-
addEndpoint(retrieve_status_orders);
|
|
31
|
-
addEndpoint(collect_payment_details);
|
|
32
|
-
|
|
33
|
-
export type Filter = {
|
|
34
|
-
type: 'resource' | 'operation' | 'tag' | 'tool';
|
|
35
|
-
op: 'include' | 'exclude';
|
|
36
|
-
value: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export function query(filters: Filter[], endpoints: Endpoint[]): Endpoint[] {
|
|
40
|
-
const allExcludes = filters.length > 0 && filters.every((filter) => filter.op === 'exclude');
|
|
41
|
-
const unmatchedFilters = new Set(filters);
|
|
42
|
-
|
|
43
|
-
const filtered = endpoints.filter((endpoint: Endpoint) => {
|
|
44
|
-
let included = false || allExcludes;
|
|
45
|
-
|
|
46
|
-
for (const filter of filters) {
|
|
47
|
-
if (match(filter, endpoint)) {
|
|
48
|
-
unmatchedFilters.delete(filter);
|
|
49
|
-
included = filter.op === 'include';
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return included;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Check if any filters didn't match
|
|
57
|
-
const unmatched = Array.from(unmatchedFilters).filter((f) => f.type === 'tool' || f.type === 'resource');
|
|
58
|
-
if (unmatched.length > 0) {
|
|
59
|
-
throw new Error(
|
|
60
|
-
`The following filters did not match any endpoints: ${unmatched
|
|
61
|
-
.map((f) => `${f.type}=${f.value}`)
|
|
62
|
-
.join(', ')}`,
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return filtered;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function match({ type, value }: Filter, endpoint: Endpoint): boolean {
|
|
70
|
-
switch (type) {
|
|
71
|
-
case 'resource': {
|
|
72
|
-
const regexStr = '^' + normalizeResource(value).replace(/\*/g, '.*') + '$';
|
|
73
|
-
const regex = new RegExp(regexStr);
|
|
74
|
-
return regex.test(normalizeResource(endpoint.metadata.resource));
|
|
75
|
-
}
|
|
76
|
-
case 'operation':
|
|
77
|
-
return endpoint.metadata.operation === value;
|
|
78
|
-
case 'tag':
|
|
79
|
-
return endpoint.metadata.tags.includes(value);
|
|
80
|
-
case 'tool':
|
|
81
|
-
return endpoint.tool.name === value;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function normalizeResource(resource: string): string {
|
|
86
|
-
return resource.toLowerCase().replace(/[^a-z.*\-_]*/g, '');
|
|
87
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
|
-
|
|
6
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import HenrySDK from '@henrylabs/sdk';
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
resource: 'orders',
|
|
11
|
-
operation: 'read',
|
|
12
|
-
tags: [],
|
|
13
|
-
httpMethod: 'get',
|
|
14
|
-
httpPath: '/orders/{orderId}',
|
|
15
|
-
operationId: 'getOrderStatus',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const tool: Tool = {
|
|
19
|
-
name: 'retrieve_status_orders',
|
|
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\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
|
-
inputSchema: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
orderId: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
},
|
|
28
|
-
jq_filter: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
title: 'jq Filter',
|
|
31
|
-
description:
|
|
32
|
-
'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/).',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
required: ['orderId'],
|
|
36
|
-
},
|
|
37
|
-
annotations: {
|
|
38
|
-
readOnlyHint: true,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
43
|
-
const { orderId, jq_filter, ...body } = args as any;
|
|
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
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default { metadata, tool, handler };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { Metadata, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
4
|
-
|
|
5
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import HenrySDK from '@henrylabs/sdk';
|
|
7
|
-
|
|
8
|
-
export const metadata: Metadata = {
|
|
9
|
-
resource: 'products',
|
|
10
|
-
operation: 'read',
|
|
11
|
-
tags: [],
|
|
12
|
-
httpMethod: 'get',
|
|
13
|
-
httpPath: '/products/details',
|
|
14
|
-
operationId: 'getProductDetails',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const tool: Tool = {
|
|
18
|
-
name: 'retrieve_product_details',
|
|
19
|
-
description:
|
|
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',
|
|
21
|
-
inputSchema: {
|
|
22
|
-
type: 'object',
|
|
23
|
-
properties: {
|
|
24
|
-
productId: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
description: 'Product ID',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
required: ['productId'],
|
|
30
|
-
},
|
|
31
|
-
annotations: {
|
|
32
|
-
readOnlyHint: true,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
37
|
-
const body = args as any;
|
|
38
|
-
return asTextContentResult(await client.products.retrieveDetails(body));
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default { metadata, tool, handler };
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
|
-
|
|
6
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import HenrySDK from '@henrylabs/sdk';
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
resource: 'products',
|
|
11
|
-
operation: 'write',
|
|
12
|
-
tags: [],
|
|
13
|
-
httpMethod: 'post',
|
|
14
|
-
httpPath: '/products/search',
|
|
15
|
-
operationId: 'searchProducts',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const tool: Tool = {
|
|
19
|
-
name: 'search_products',
|
|
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 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
|
-
inputSchema: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
query: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
description: 'Search query',
|
|
28
|
-
},
|
|
29
|
-
color: {
|
|
30
|
-
type: 'string',
|
|
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',
|
|
40
|
-
},
|
|
41
|
-
gender: {
|
|
42
|
-
type: 'string',
|
|
43
|
-
description: '[Deprecated] Filter results by gender',
|
|
44
|
-
},
|
|
45
|
-
greaterThanPrice: {
|
|
46
|
-
type: 'number',
|
|
47
|
-
description: '[Deprecated] Alias for minPrice. Maintained for backwards compatibility.',
|
|
48
|
-
},
|
|
49
|
-
limit: {
|
|
50
|
-
type: 'integer',
|
|
51
|
-
description: 'Limit the number of results',
|
|
52
|
-
},
|
|
53
|
-
lowerThanPrice: {
|
|
54
|
-
type: 'number',
|
|
55
|
-
description: '[Deprecated] Alias for maxPrice. Maintained for backwards compatibility.',
|
|
56
|
-
},
|
|
57
|
-
manufacturer: {
|
|
58
|
-
type: 'string',
|
|
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',
|
|
68
|
-
},
|
|
69
|
-
region: {
|
|
70
|
-
type: 'string',
|
|
71
|
-
description: '[Deprecated] Region filter (defaults to `us`).',
|
|
72
|
-
},
|
|
73
|
-
size: {
|
|
74
|
-
type: 'string',
|
|
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],
|
|
85
|
-
},
|
|
86
|
-
jq_filter: {
|
|
87
|
-
type: 'string',
|
|
88
|
-
title: 'jq Filter',
|
|
89
|
-
description:
|
|
90
|
-
'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/).',
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
required: ['query'],
|
|
94
|
-
},
|
|
95
|
-
annotations: {},
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
99
|
-
const { jq_filter, ...body } = args as any;
|
|
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
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export default { metadata, tool, handler };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { isJqError, maybeFilter } from '@henrylabs/mcp/filtering';
|
|
4
|
-
import { Metadata, asErrorResult, asTextContentResult } from '@henrylabs/mcp/tools/types';
|
|
5
|
-
|
|
6
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import HenrySDK from '@henrylabs/sdk';
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
resource: 'wallet',
|
|
11
|
-
operation: 'write',
|
|
12
|
-
tags: [],
|
|
13
|
-
httpMethod: 'post',
|
|
14
|
-
httpPath: '/wallet/card-collect',
|
|
15
|
-
operationId: 'initiateCardCollect',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const tool: Tool = {
|
|
19
|
-
name: 'collect_payment_details',
|
|
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\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
|
-
inputSchema: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
'x-user-id': {
|
|
26
|
-
type: 'string',
|
|
27
|
-
},
|
|
28
|
-
auth: {
|
|
29
|
-
type: 'boolean',
|
|
30
|
-
description: 'Whether authentication is required for card collection (default: true)',
|
|
31
|
-
},
|
|
32
|
-
jq_filter: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
title: 'jq Filter',
|
|
35
|
-
description:
|
|
36
|
-
'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/).',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
required: ['x-user-id'],
|
|
40
|
-
},
|
|
41
|
-
annotations: {},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const handler = async (client: HenrySDK, args: Record<string, unknown> | undefined) => {
|
|
45
|
-
const { jq_filter, ...body } = args as any;
|
|
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
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default { metadata, tool, handler };
|
package/src/tools.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './tools/index';
|