-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat(everstox): add 2 MCP actions create-fulfillment-update-request and list-products #21249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
michelle0927
wants to merge
10
commits into
master
Choose a base branch
from
mcp/everstox
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+312
−9
Open
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2724da8
feat(everstox): add list-products and create-fulfillment-update-reque…
4d1c19c
versions
5861bda
fix(everstox): expand list-products description and add min validatio…
e198385
Merge branch 'master' into mcp/everstox
vetrivigneshwaran 5345bf5
updates
michelle0927 d3c9d9a
coderabbit suggestion
michelle0927 1998870
coderabbit suggestion
michelle0927 0ae8a13
updates
ae505a4
fix(everstox): serialize array query params as repeated pairs, not `k…
57e91b4
Merge branch 'master' into mcp/everstox
michelle0927 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
.../everstox/actions/create-fulfillment-update-request/create-fulfillment-update-request.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import everstox from "../../everstox.app.mjs"; | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| key: "everstox-create-fulfillment-update-request", | ||
| name: "Create Fulfillment Update Request", | ||
| description: | ||
| "Creates a new fulfillment update request for a specific fulfillment." | ||
| + " The fulfillment must be in `in_fulfillment` state." | ||
| + " Use this to modify items, quantities, prices, addresses, or priority on an active fulfillment." | ||
| + " `fulfillment_items` must include at least one item with a valid SKU; `price_set` quantities must sum to the item quantity." | ||
| + " Address fields `first_name`/`last_name` or `company` are conditionally required (at least one set must be present)." | ||
| + " [See the documentation](https://api.everstox.com/api/v1/ui/#/Fulfillment-updates/district_core.api.shops.fulfillments.fulfillments.Fulfillments.create_fulfillment_update_request)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| everstox, | ||
| fulfillmentId: { | ||
| type: "string", | ||
| label: "Fulfillment ID", | ||
| description: "The UUID of the fulfillment to update, for example 550e8400-e29b-41d4-a716-446655440000. Obtain this from the fulfillment object you want to modify. Must be in in_fulfillment state.", | ||
| }, | ||
| fulfillmentItems: { | ||
| type: "string", | ||
| label: "Fulfillment Items", | ||
| description: "JSON array of fulfillment items to update. Must contain at least one item." | ||
| + " Omit `id` when adding a new item; include it when updating an existing one." | ||
| + " Each item requires a `product.sku` and a `price_set` with at least one entry." | ||
| + " Example: `[{\"id\": \"550e8400-e29b-41d4-a716-446655440000\", \"quantity\": 2, \"product\": {\"sku\": \"PROD-001\"}, \"price_set\": [{\"quantity\": 2, \"currency\": \"EUR\", \"price_net_after_discount\": \"19.99\", \"tax_amount\": \"3.80\", \"tax_rate\": \"0.19\"}]}]`", | ||
| optional: true, | ||
| }, | ||
| shippingAddress: { | ||
| type: "string", | ||
| label: "Shipping Address", | ||
|
michelle0927 marked this conversation as resolved.
|
||
| description: "JSON object with the complete shipping address." | ||
| + " Required fields: `country_code` (ISO 2-letter, e.g. `\"DE\"`), `country` (full country name, e.g. `\"Germany\"`), `city`, `zip`, `address_1`," | ||
| + " and at least one of `first_name`/`last_name` or `company`." | ||
| + " Optional: `address_2`, `title`, `phone`, `province_code`, `address_type` (`private` or `business`)." | ||
| + " Example: `{\"first_name\": \"John\", \"last_name\": \"Doe\", \"country_code\": \"DE\", \"country\": \"Germany\", \"city\": \"Berlin\", \"zip\": \"10115\", \"address_1\": \"Musterstra\\u00dfe 1\", \"address_type\": \"private\"}`", | ||
| optional: true, | ||
| }, | ||
| billingAddress: { | ||
| type: "string", | ||
| label: "Billing Address", | ||
|
michelle0927 marked this conversation as resolved.
|
||
| description: "JSON object with the complete billing address." | ||
| + " Required fields: `country_code` (ISO 2-letter, e.g. `\"DE\"`), `country` (full country name, e.g. `\"Germany\"`), `city`, `zip`, `address_1`," | ||
| + " and at least one of `first_name`/`last_name` or `company`." | ||
| + " Optional: `address_2`, `title`, `phone`, `VAT_number`, `address_type` (`private` or `business`)." | ||
| + " Example: `{\"first_name\": \"John\", \"last_name\": \"Doe\", \"country_code\": \"DE\", \"country\": \"Germany\", \"city\": \"Berlin\", \"zip\": \"10115\", \"address_1\": \"Musterstra\\u00dfe 1\", \"address_type\": \"private\"}`", | ||
| optional: true, | ||
| }, | ||
| fulfillmentPriority: { | ||
| type: "integer", | ||
| label: "Fulfillment Priority", | ||
| description: "Priority level for the fulfillment. Must be between 1 (highest) and 99 (lowest).", | ||
|
michelle0927 marked this conversation as resolved.
|
||
| optional: true, | ||
| min: 1, | ||
| max: 99, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if (!this.fulfillmentItems | ||
| && !this.shippingAddress | ||
| && !this.billingAddress | ||
| && !this.fulfillmentPriority) { | ||
| throw new ConfigurationError("At least one of `fulfillmentItems`, `shippingAddress`, `billingAddress`, or `fulfillmentPriority` must be provided."); | ||
| } | ||
|
|
||
| const fulfillmentItems = this.fulfillmentItems | ||
| ? JSON.parse(this.fulfillmentItems) | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| : undefined; | ||
| const shippingAddress = this.shippingAddress | ||
| ? JSON.parse(this.shippingAddress) | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| : undefined; | ||
| const billingAddress = this.billingAddress | ||
| ? JSON.parse(this.billingAddress) | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| : undefined; | ||
|
|
||
| const response = await this.everstox.createFulfillmentUpdateRequest({ | ||
| $, | ||
| fulfillmentId: this.fulfillmentId, | ||
| data: { | ||
| fulfillment_items: fulfillmentItems, | ||
| shipping_address: shippingAddress, | ||
| billing_address: billingAddress, | ||
| fulfillment_priority: this.fulfillmentPriority, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created fulfillment update request for fulfillment \`${this.fulfillmentId}\``); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
164 changes: 164 additions & 0 deletions
164
components/everstox/actions/list-products/list-products.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| import constants from "../../common/constants.mjs"; | ||
| import everstox from "../../everstox.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "everstox-list-products", | ||
| name: "List Products", | ||
| description: "List products in an Everstox shop. Use this to browse or audit the product catalog, check inventory by SKU or name, or filter by warehouse. Results default to 10 per page — use `limit` and `offset` together to paginate through large catalogs. [See the documentation](https://api.everstox.com/api/v1/ui/#/Product/district_core.api.shops.products.products.Products.index)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| everstox, | ||
| search: { | ||
| type: "string", | ||
| label: "Search", | ||
| description: "Search for name or SKU", | ||
| optional: true, | ||
| }, | ||
| sku: { | ||
| type: "string[]", | ||
| label: "SKUs", | ||
| description: "Filter products by SKU. If the number of SKUs exceeds 10, `exact_search` is enforced", | ||
| optional: true, | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "Filter products by name", | ||
| optional: true, | ||
| }, | ||
| gtin: { | ||
| type: "string", | ||
| label: "GTIN", | ||
| description: "Filter products by GTIN — returns products with at least one unit whose GTIN contains this value", | ||
| optional: true, | ||
| }, | ||
| customAttributeKey: { | ||
| type: "string", | ||
| label: "Custom Attribute Key", | ||
| description: "Filter products by custom attribute key — returns products with at least one custom attribute whose key contains this value", | ||
| optional: true, | ||
| }, | ||
| customAttributeValue: { | ||
| type: "string", | ||
| label: "Custom Attribute Value", | ||
| description: "Filter products by custom attribute value — returns products with at least one custom attribute whose value contains this value", | ||
| optional: true, | ||
| }, | ||
| status: { | ||
| type: "string", | ||
| label: "Status", | ||
| description: "Filter products by status (default `all`)", | ||
| options: constants.STATUS_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| bundleProduct: { | ||
| type: "boolean", | ||
| label: "Bundle Product", | ||
| description: "Filter for bundle products", | ||
| optional: true, | ||
| }, | ||
| exactSearch: { | ||
| type: "boolean", | ||
| label: "Exact Search", | ||
| description: "If true, searches for exact SKU and name matches (default `true`)", | ||
| optional: true, | ||
| }, | ||
| stockRunwayLte: { | ||
| type: "integer", | ||
| label: "Stock Runway Less Than or Equal To", | ||
| description: "Filter for stocks with runway lower than or equal to the number of days provided", | ||
| optional: true, | ||
| }, | ||
| stockRunwayLt: { | ||
| type: "integer", | ||
| label: "Stock Runway Less Than", | ||
| description: "Filter for stocks with runway lower than the number of days provided", | ||
| optional: true, | ||
| }, | ||
| stockRunwayGte: { | ||
| type: "integer", | ||
| label: "Stock Runway Greater Than or Equal To", | ||
| description: "Filter for stocks with runway greater than or equal to the number of days provided", | ||
| optional: true, | ||
| }, | ||
| warehouseIds: { | ||
| propDefinition: [ | ||
| everstox, | ||
| "warehouseIds", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| orderBy: { | ||
| type: "string", | ||
| label: "Order By", | ||
| description: "Fields to order the result set by", | ||
| optional: true, | ||
| }, | ||
| fields: { | ||
| type: "string", | ||
| label: "Fields", | ||
| description: "Fields to include in the response", | ||
| optional: true, | ||
| }, | ||
| fieldSet: { | ||
| type: "string", | ||
| label: "Field Set", | ||
| description: "`full` includes all sub-entities (default); `minimal` returns essential fields optimized for performance", | ||
| options: constants.FIELD_SET_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| limit: { | ||
| type: "integer", | ||
| label: "Limit", | ||
| description: "The number of products to return (default 10)", | ||
| min: 1, | ||
|
michelle0927 marked this conversation as resolved.
|
||
| default: 10, | ||
| optional: true, | ||
| }, | ||
| offset: { | ||
| type: "integer", | ||
| label: "Offset", | ||
| description: "The number of products to skip before starting to collect the result set", | ||
| min: 0, | ||
| optional: true, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.everstox.listProducts({ | ||
| $, | ||
| params: { | ||
| search: this.search, | ||
| sku: this.sku, | ||
| name: this.name, | ||
| gtin: this.gtin, | ||
| custom_attribute_key: this.customAttributeKey, | ||
| custom_attribute_value: this.customAttributeValue, | ||
| status: this.status, | ||
| bundle_product: this.bundleProduct, | ||
| exact_search: this.exactSearch, | ||
| stock_runway_lte: this.stockRunwayLte, | ||
| stock_runway_lt: this.stockRunwayLt, | ||
| stock_runway_gte: this.stockRunwayGte, | ||
| warehouse_ids: this.warehouseIds, | ||
| order_by: this.orderBy, | ||
| fields: this.fields, | ||
| field_set: this.fieldSet, | ||
| limit: this.limit, | ||
| offset: this.offset, | ||
| }, | ||
| }); | ||
|
|
||
| const count = response.items?.length ?? 0; | ||
| $.export("$summary", `Successfully retrieved ${count} product${count === 1 | ||
| ? "" | ||
| : "s"}`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.