-
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
Merged
+312
−9
Merged
Changes from 1 commit
Commits
Show all changes
11 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 219f64b
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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
.../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,81 @@ | ||
| import everstox from "../../everstox.app.mjs"; | ||
|
|
||
| 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.staging.everstox.com/api/v1/ui/#/Fulfillment-updates/district_core.api.shops.fulfillments.fulfillments.Fulfillments.create_fulfillment_update_request)", | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| 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. Must be in `in_fulfillment` state.", | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| }, | ||
| 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\"}]}]`", | ||
| }, | ||
| 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\"}`", | ||
| }, | ||
| 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\"}`", | ||
| }, | ||
| 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.
|
||
| min: 1, | ||
| max: 99, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const fulfillmentItems = JSON.parse(this.fulfillmentItems); | ||
| const shippingAddress = JSON.parse(this.shippingAddress); | ||
| const billingAddress = JSON.parse(this.billingAddress); | ||
|
|
||
| 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; | ||
| }, | ||
| }; | ||
95 changes: 95 additions & 0 deletions
95
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,95 @@ | ||
| import everstox from "../../everstox.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "everstox-list-products", | ||
| name: "List Products", | ||
| description: "List products in an Everstox shop. [See the documentation](https://api.staging.everstox.com/api/v1/ui/#/Product/district_core.api.shops.products.products.Products.index)", | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| everstox, | ||
| sku: { | ||
| type: "string", | ||
| label: "SKU", | ||
| description: "Filter products by SKU", | ||
| optional: true, | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "Filter products by name", | ||
| optional: true, | ||
| }, | ||
| warehouseIds: { | ||
| propDefinition: [ | ||
| everstox, | ||
| "warehouseIds", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| createdDateGte: { | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| type: "string", | ||
| label: "Created Date Greater Than or Equal To", | ||
| description: "Filter products with a creation date greater than or equal to the provided date. Example: `2021-02-23`", | ||
| optional: true, | ||
| }, | ||
| createdDateLte: { | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| type: "string", | ||
| label: "Created Date Less Than or Equal To", | ||
| description: "Filter products with a creation date less than or equal to the provided date. Example: `2021-02-23`", | ||
| optional: true, | ||
| }, | ||
| updatedDateGte: { | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| type: "string", | ||
| label: "Updated Date Greater Than or Equal To", | ||
| description: "Filter products with an updated date greater than or equal to the provided date. Example: `2021-02-23`", | ||
| optional: true, | ||
| }, | ||
| updatedDateLte: { | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| type: "string", | ||
| label: "Updated Date Less Than or Equal To", | ||
| description: "Filter products with an updated date less than or equal to the provided date. Example: `2021-02-23`", | ||
| optional: true, | ||
| }, | ||
| limit: { | ||
| type: "integer", | ||
| label: "Limit", | ||
| description: "The number of products to return (default 10)", | ||
| optional: true, | ||
| }, | ||
| offset: { | ||
| type: "integer", | ||
| label: "Offset", | ||
| description: "The number of products to skip before starting to collect the result set", | ||
| optional: true, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.everstox.listProducts({ | ||
| $, | ||
| params: { | ||
| sku: this.sku, | ||
| name: this.name, | ||
| warehouse_ids: this.warehouseIds, | ||
| creation_date_gte: this.createdDateGte, | ||
|
michelle0927 marked this conversation as resolved.
Outdated
|
||
| creation_date_lte: this.createdDateLte, | ||
| updated_date_gte: this.updatedDateGte, | ||
| updated_date_lte: this.updatedDateLte, | ||
| 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
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.