dodopayments-mcp 1.18.1 → 1.19.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.
Files changed (452) hide show
  1. package/README.md +53 -1
  2. package/compat.d.mts +53 -0
  3. package/compat.d.mts.map +1 -0
  4. package/compat.d.ts +53 -0
  5. package/compat.d.ts.map +1 -0
  6. package/compat.js +351 -0
  7. package/compat.js.map +1 -0
  8. package/compat.mjs +338 -0
  9. package/compat.mjs.map +1 -0
  10. package/compat.test.d.mts +2 -0
  11. package/compat.test.d.mts.map +1 -0
  12. package/compat.test.d.ts +2 -0
  13. package/compat.test.d.ts.map +1 -0
  14. package/compat.test.js +950 -0
  15. package/compat.test.js.map +1 -0
  16. package/compat.test.mjs +948 -0
  17. package/compat.test.mjs.map +1 -0
  18. package/index.js +37 -110
  19. package/index.js.map +1 -1
  20. package/index.mjs +37 -107
  21. package/index.mjs.map +1 -1
  22. package/options.d.mts +9 -0
  23. package/options.d.mts.map +1 -0
  24. package/options.d.ts +9 -0
  25. package/options.d.ts.map +1 -0
  26. package/options.js +321 -0
  27. package/options.js.map +1 -0
  28. package/options.mjs +314 -0
  29. package/options.mjs.map +1 -0
  30. package/options.test.d.mts +2 -0
  31. package/options.test.d.mts.map +1 -0
  32. package/options.test.d.ts +2 -0
  33. package/options.test.d.ts.map +1 -0
  34. package/options.test.js +154 -0
  35. package/options.test.js.map +1 -0
  36. package/options.test.mjs +152 -0
  37. package/options.test.mjs.map +1 -0
  38. package/package.json +4 -3
  39. package/server.d.mts +3 -1
  40. package/server.d.mts.map +1 -1
  41. package/server.d.ts +3 -1
  42. package/server.d.ts.map +1 -1
  43. package/server.js +12 -8
  44. package/server.js.map +1 -1
  45. package/server.mjs +12 -8
  46. package/server.mjs.map +1 -1
  47. package/src/compat.test.ts +1068 -0
  48. package/src/compat.ts +437 -0
  49. package/src/index.ts +38 -122
  50. package/src/options.test.ts +193 -0
  51. package/src/options.ts +339 -0
  52. package/src/server.ts +15 -10
  53. package/src/tools/customers/create-customers.ts +2 -2
  54. package/src/tools/customers/customer-portal/create-customers-customer-portal.ts +2 -2
  55. package/src/tools/customers/list-customers.ts +2 -2
  56. package/src/tools/customers/retrieve-customers.ts +2 -2
  57. package/src/tools/customers/update-customers.ts +2 -2
  58. package/src/tools/discounts/create-discounts.ts +9 -4
  59. package/src/tools/discounts/delete-discounts.ts +2 -2
  60. package/src/tools/discounts/list-discounts.ts +2 -2
  61. package/src/tools/discounts/retrieve-discounts.ts +2 -2
  62. package/src/tools/discounts/update-discounts.ts +9 -4
  63. package/src/tools/disputes/list-disputes.ts +18 -10
  64. package/src/tools/disputes/retrieve-disputes.ts +2 -2
  65. package/src/tools/index.ts +19 -2
  66. package/src/tools/invoices/payments/retrieve-invoices-payments.ts +2 -2
  67. package/src/tools/license-key-instances/list-license-key-instances.ts +2 -2
  68. package/src/tools/license-key-instances/retrieve-license-key-instances.ts +2 -2
  69. package/src/tools/license-key-instances/update-license-key-instances.ts +2 -2
  70. package/src/tools/license-keys/list-license-keys.ts +7 -2
  71. package/src/tools/license-keys/retrieve-license-keys.ts +2 -2
  72. package/src/tools/license-keys/update-license-keys.ts +2 -2
  73. package/src/tools/licenses/activate-licenses.ts +2 -2
  74. package/src/tools/licenses/deactivate-licenses.ts +2 -2
  75. package/src/tools/licenses/validate-licenses.ts +2 -2
  76. package/src/tools/misc/list-supported-countries-misc.ts +1 -2
  77. package/src/tools/payments/create-payments.ts +345 -325
  78. package/src/tools/payments/list-payments.ts +11 -6
  79. package/src/tools/payments/retrieve-payments.ts +2 -2
  80. package/src/tools/payouts/list-payouts.ts +2 -2
  81. package/src/tools/products/create-products.ts +50 -39
  82. package/src/tools/products/delete-products.ts +2 -2
  83. package/src/tools/products/images/update-products-images.ts +2 -2
  84. package/src/tools/products/list-products.ts +2 -2
  85. package/src/tools/products/retrieve-products.ts +2 -2
  86. package/src/tools/products/unarchive-products.ts +2 -2
  87. package/src/tools/products/update-products.ts +32 -21
  88. package/src/tools/refunds/create-refunds.ts +2 -2
  89. package/src/tools/refunds/list-refunds.ts +7 -2
  90. package/src/tools/refunds/retrieve-refunds.ts +2 -2
  91. package/src/tools/subscriptions/change-plan-subscriptions.ts +2 -2
  92. package/src/tools/subscriptions/charge-subscriptions.ts +2 -2
  93. package/src/tools/subscriptions/create-subscriptions.ts +327 -310
  94. package/src/tools/subscriptions/list-subscriptions.ts +7 -2
  95. package/src/tools/subscriptions/retrieve-subscriptions.ts +2 -2
  96. package/src/tools/subscriptions/update-subscriptions.ts +283 -262
  97. package/src/tools/webhook-events/list-webhook-events.ts +2 -2
  98. package/src/tools/webhook-events/retrieve-webhook-events.ts +2 -2
  99. package/tools/customers/create-customers.d.mts +2 -2
  100. package/tools/customers/create-customers.d.mts.map +1 -1
  101. package/tools/customers/create-customers.d.ts +2 -2
  102. package/tools/customers/create-customers.d.ts.map +1 -1
  103. package/tools/customers/create-customers.js +1 -1
  104. package/tools/customers/create-customers.js.map +1 -1
  105. package/tools/customers/create-customers.mjs +1 -1
  106. package/tools/customers/create-customers.mjs.map +1 -1
  107. package/tools/customers/customer-portal/create-customers-customer-portal.d.mts +2 -2
  108. package/tools/customers/customer-portal/create-customers-customer-portal.d.mts.map +1 -1
  109. package/tools/customers/customer-portal/create-customers-customer-portal.d.ts +2 -2
  110. package/tools/customers/customer-portal/create-customers-customer-portal.d.ts.map +1 -1
  111. package/tools/customers/customer-portal/create-customers-customer-portal.js.map +1 -1
  112. package/tools/customers/customer-portal/create-customers-customer-portal.mjs.map +1 -1
  113. package/tools/customers/list-customers.d.mts +2 -2
  114. package/tools/customers/list-customers.d.mts.map +1 -1
  115. package/tools/customers/list-customers.d.ts +2 -2
  116. package/tools/customers/list-customers.d.ts.map +1 -1
  117. package/tools/customers/list-customers.js +1 -1
  118. package/tools/customers/list-customers.js.map +1 -1
  119. package/tools/customers/list-customers.mjs +1 -1
  120. package/tools/customers/list-customers.mjs.map +1 -1
  121. package/tools/customers/retrieve-customers.d.mts +2 -2
  122. package/tools/customers/retrieve-customers.d.mts.map +1 -1
  123. package/tools/customers/retrieve-customers.d.ts +2 -2
  124. package/tools/customers/retrieve-customers.d.ts.map +1 -1
  125. package/tools/customers/retrieve-customers.js +1 -1
  126. package/tools/customers/retrieve-customers.js.map +1 -1
  127. package/tools/customers/retrieve-customers.mjs +1 -1
  128. package/tools/customers/retrieve-customers.mjs.map +1 -1
  129. package/tools/customers/update-customers.d.mts +2 -2
  130. package/tools/customers/update-customers.d.mts.map +1 -1
  131. package/tools/customers/update-customers.d.ts +2 -2
  132. package/tools/customers/update-customers.d.ts.map +1 -1
  133. package/tools/customers/update-customers.js.map +1 -1
  134. package/tools/customers/update-customers.mjs.map +1 -1
  135. package/tools/discounts/create-discounts.d.mts +2 -2
  136. package/tools/discounts/create-discounts.d.mts.map +1 -1
  137. package/tools/discounts/create-discounts.d.ts +2 -2
  138. package/tools/discounts/create-discounts.d.ts.map +1 -1
  139. package/tools/discounts/create-discounts.js +8 -3
  140. package/tools/discounts/create-discounts.js.map +1 -1
  141. package/tools/discounts/create-discounts.mjs +8 -3
  142. package/tools/discounts/create-discounts.mjs.map +1 -1
  143. package/tools/discounts/delete-discounts.d.mts +2 -2
  144. package/tools/discounts/delete-discounts.d.mts.map +1 -1
  145. package/tools/discounts/delete-discounts.d.ts +2 -2
  146. package/tools/discounts/delete-discounts.d.ts.map +1 -1
  147. package/tools/discounts/delete-discounts.js +1 -1
  148. package/tools/discounts/delete-discounts.js.map +1 -1
  149. package/tools/discounts/delete-discounts.mjs +1 -1
  150. package/tools/discounts/delete-discounts.mjs.map +1 -1
  151. package/tools/discounts/list-discounts.d.mts +2 -2
  152. package/tools/discounts/list-discounts.d.mts.map +1 -1
  153. package/tools/discounts/list-discounts.d.ts +2 -2
  154. package/tools/discounts/list-discounts.d.ts.map +1 -1
  155. package/tools/discounts/list-discounts.js +1 -1
  156. package/tools/discounts/list-discounts.js.map +1 -1
  157. package/tools/discounts/list-discounts.mjs +1 -1
  158. package/tools/discounts/list-discounts.mjs.map +1 -1
  159. package/tools/discounts/retrieve-discounts.d.mts +2 -2
  160. package/tools/discounts/retrieve-discounts.d.mts.map +1 -1
  161. package/tools/discounts/retrieve-discounts.d.ts +2 -2
  162. package/tools/discounts/retrieve-discounts.d.ts.map +1 -1
  163. package/tools/discounts/retrieve-discounts.js +1 -1
  164. package/tools/discounts/retrieve-discounts.js.map +1 -1
  165. package/tools/discounts/retrieve-discounts.mjs +1 -1
  166. package/tools/discounts/retrieve-discounts.mjs.map +1 -1
  167. package/tools/discounts/update-discounts.d.mts +2 -2
  168. package/tools/discounts/update-discounts.d.mts.map +1 -1
  169. package/tools/discounts/update-discounts.d.ts +2 -2
  170. package/tools/discounts/update-discounts.d.ts.map +1 -1
  171. package/tools/discounts/update-discounts.js +7 -2
  172. package/tools/discounts/update-discounts.js.map +1 -1
  173. package/tools/discounts/update-discounts.mjs +7 -2
  174. package/tools/discounts/update-discounts.mjs.map +1 -1
  175. package/tools/disputes/list-disputes.d.mts +2 -2
  176. package/tools/disputes/list-disputes.d.mts.map +1 -1
  177. package/tools/disputes/list-disputes.d.ts +2 -2
  178. package/tools/disputes/list-disputes.d.ts.map +1 -1
  179. package/tools/disputes/list-disputes.js +17 -9
  180. package/tools/disputes/list-disputes.js.map +1 -1
  181. package/tools/disputes/list-disputes.mjs +17 -9
  182. package/tools/disputes/list-disputes.mjs.map +1 -1
  183. package/tools/disputes/retrieve-disputes.d.mts +2 -2
  184. package/tools/disputes/retrieve-disputes.d.mts.map +1 -1
  185. package/tools/disputes/retrieve-disputes.d.ts +2 -2
  186. package/tools/disputes/retrieve-disputes.d.ts.map +1 -1
  187. package/tools/disputes/retrieve-disputes.js +1 -1
  188. package/tools/disputes/retrieve-disputes.js.map +1 -1
  189. package/tools/disputes/retrieve-disputes.mjs +1 -1
  190. package/tools/disputes/retrieve-disputes.mjs.map +1 -1
  191. package/tools/index.d.mts +1 -1
  192. package/tools/index.d.mts.map +1 -1
  193. package/tools/index.d.ts +1 -1
  194. package/tools/index.d.ts.map +1 -1
  195. package/tools/index.js +10 -1
  196. package/tools/index.js.map +1 -1
  197. package/tools/index.mjs +10 -1
  198. package/tools/index.mjs.map +1 -1
  199. package/tools/invoices/payments/retrieve-invoices-payments.d.mts +2 -2
  200. package/tools/invoices/payments/retrieve-invoices-payments.d.mts.map +1 -1
  201. package/tools/invoices/payments/retrieve-invoices-payments.d.ts +2 -2
  202. package/tools/invoices/payments/retrieve-invoices-payments.d.ts.map +1 -1
  203. package/tools/invoices/payments/retrieve-invoices-payments.js +1 -1
  204. package/tools/invoices/payments/retrieve-invoices-payments.js.map +1 -1
  205. package/tools/invoices/payments/retrieve-invoices-payments.mjs +1 -1
  206. package/tools/invoices/payments/retrieve-invoices-payments.mjs.map +1 -1
  207. package/tools/license-key-instances/list-license-key-instances.d.mts +2 -2
  208. package/tools/license-key-instances/list-license-key-instances.d.mts.map +1 -1
  209. package/tools/license-key-instances/list-license-key-instances.d.ts +2 -2
  210. package/tools/license-key-instances/list-license-key-instances.d.ts.map +1 -1
  211. package/tools/license-key-instances/list-license-key-instances.js +1 -1
  212. package/tools/license-key-instances/list-license-key-instances.js.map +1 -1
  213. package/tools/license-key-instances/list-license-key-instances.mjs +1 -1
  214. package/tools/license-key-instances/list-license-key-instances.mjs.map +1 -1
  215. package/tools/license-key-instances/retrieve-license-key-instances.d.mts +2 -2
  216. package/tools/license-key-instances/retrieve-license-key-instances.d.mts.map +1 -1
  217. package/tools/license-key-instances/retrieve-license-key-instances.d.ts +2 -2
  218. package/tools/license-key-instances/retrieve-license-key-instances.d.ts.map +1 -1
  219. package/tools/license-key-instances/retrieve-license-key-instances.js +1 -1
  220. package/tools/license-key-instances/retrieve-license-key-instances.js.map +1 -1
  221. package/tools/license-key-instances/retrieve-license-key-instances.mjs +1 -1
  222. package/tools/license-key-instances/retrieve-license-key-instances.mjs.map +1 -1
  223. package/tools/license-key-instances/update-license-key-instances.d.mts +2 -2
  224. package/tools/license-key-instances/update-license-key-instances.d.mts.map +1 -1
  225. package/tools/license-key-instances/update-license-key-instances.d.ts +2 -2
  226. package/tools/license-key-instances/update-license-key-instances.d.ts.map +1 -1
  227. package/tools/license-key-instances/update-license-key-instances.js.map +1 -1
  228. package/tools/license-key-instances/update-license-key-instances.mjs.map +1 -1
  229. package/tools/license-keys/list-license-keys.d.mts +2 -2
  230. package/tools/license-keys/list-license-keys.d.mts.map +1 -1
  231. package/tools/license-keys/list-license-keys.d.ts +2 -2
  232. package/tools/license-keys/list-license-keys.d.ts.map +1 -1
  233. package/tools/license-keys/list-license-keys.js +6 -1
  234. package/tools/license-keys/list-license-keys.js.map +1 -1
  235. package/tools/license-keys/list-license-keys.mjs +6 -1
  236. package/tools/license-keys/list-license-keys.mjs.map +1 -1
  237. package/tools/license-keys/retrieve-license-keys.d.mts +2 -2
  238. package/tools/license-keys/retrieve-license-keys.d.mts.map +1 -1
  239. package/tools/license-keys/retrieve-license-keys.d.ts +2 -2
  240. package/tools/license-keys/retrieve-license-keys.d.ts.map +1 -1
  241. package/tools/license-keys/retrieve-license-keys.js +1 -1
  242. package/tools/license-keys/retrieve-license-keys.js.map +1 -1
  243. package/tools/license-keys/retrieve-license-keys.mjs +1 -1
  244. package/tools/license-keys/retrieve-license-keys.mjs.map +1 -1
  245. package/tools/license-keys/update-license-keys.d.mts +2 -2
  246. package/tools/license-keys/update-license-keys.d.mts.map +1 -1
  247. package/tools/license-keys/update-license-keys.d.ts +2 -2
  248. package/tools/license-keys/update-license-keys.d.ts.map +1 -1
  249. package/tools/license-keys/update-license-keys.js.map +1 -1
  250. package/tools/license-keys/update-license-keys.mjs.map +1 -1
  251. package/tools/licenses/activate-licenses.d.mts +2 -2
  252. package/tools/licenses/activate-licenses.d.mts.map +1 -1
  253. package/tools/licenses/activate-licenses.d.ts +2 -2
  254. package/tools/licenses/activate-licenses.d.ts.map +1 -1
  255. package/tools/licenses/activate-licenses.js +1 -1
  256. package/tools/licenses/activate-licenses.js.map +1 -1
  257. package/tools/licenses/activate-licenses.mjs +1 -1
  258. package/tools/licenses/activate-licenses.mjs.map +1 -1
  259. package/tools/licenses/deactivate-licenses.d.mts +2 -2
  260. package/tools/licenses/deactivate-licenses.d.mts.map +1 -1
  261. package/tools/licenses/deactivate-licenses.d.ts +2 -2
  262. package/tools/licenses/deactivate-licenses.d.ts.map +1 -1
  263. package/tools/licenses/deactivate-licenses.js +1 -1
  264. package/tools/licenses/deactivate-licenses.js.map +1 -1
  265. package/tools/licenses/deactivate-licenses.mjs +1 -1
  266. package/tools/licenses/deactivate-licenses.mjs.map +1 -1
  267. package/tools/licenses/validate-licenses.d.mts +2 -2
  268. package/tools/licenses/validate-licenses.d.mts.map +1 -1
  269. package/tools/licenses/validate-licenses.d.ts +2 -2
  270. package/tools/licenses/validate-licenses.d.ts.map +1 -1
  271. package/tools/licenses/validate-licenses.js +1 -1
  272. package/tools/licenses/validate-licenses.js.map +1 -1
  273. package/tools/licenses/validate-licenses.mjs +1 -1
  274. package/tools/licenses/validate-licenses.mjs.map +1 -1
  275. package/tools/misc/list-supported-countries-misc.d.mts +2 -2
  276. package/tools/misc/list-supported-countries-misc.d.mts.map +1 -1
  277. package/tools/misc/list-supported-countries-misc.d.ts +2 -2
  278. package/tools/misc/list-supported-countries-misc.d.ts.map +1 -1
  279. package/tools/misc/list-supported-countries-misc.js +0 -1
  280. package/tools/misc/list-supported-countries-misc.js.map +1 -1
  281. package/tools/misc/list-supported-countries-misc.mjs +0 -1
  282. package/tools/misc/list-supported-countries-misc.mjs.map +1 -1
  283. package/tools/payments/create-payments.d.mts +2 -2
  284. package/tools/payments/create-payments.d.mts.map +1 -1
  285. package/tools/payments/create-payments.d.ts +2 -2
  286. package/tools/payments/create-payments.d.ts.map +1 -1
  287. package/tools/payments/create-payments.js +342 -322
  288. package/tools/payments/create-payments.js.map +1 -1
  289. package/tools/payments/create-payments.mjs +342 -322
  290. package/tools/payments/create-payments.mjs.map +1 -1
  291. package/tools/payments/list-payments.d.mts +2 -2
  292. package/tools/payments/list-payments.d.mts.map +1 -1
  293. package/tools/payments/list-payments.d.ts +2 -2
  294. package/tools/payments/list-payments.d.ts.map +1 -1
  295. package/tools/payments/list-payments.js +10 -5
  296. package/tools/payments/list-payments.js.map +1 -1
  297. package/tools/payments/list-payments.mjs +10 -5
  298. package/tools/payments/list-payments.mjs.map +1 -1
  299. package/tools/payments/retrieve-payments.d.mts +2 -2
  300. package/tools/payments/retrieve-payments.d.mts.map +1 -1
  301. package/tools/payments/retrieve-payments.d.ts +2 -2
  302. package/tools/payments/retrieve-payments.d.ts.map +1 -1
  303. package/tools/payments/retrieve-payments.js +1 -1
  304. package/tools/payments/retrieve-payments.js.map +1 -1
  305. package/tools/payments/retrieve-payments.mjs +1 -1
  306. package/tools/payments/retrieve-payments.mjs.map +1 -1
  307. package/tools/payouts/list-payouts.d.mts +2 -2
  308. package/tools/payouts/list-payouts.d.mts.map +1 -1
  309. package/tools/payouts/list-payouts.d.ts +2 -2
  310. package/tools/payouts/list-payouts.d.ts.map +1 -1
  311. package/tools/payouts/list-payouts.js +1 -1
  312. package/tools/payouts/list-payouts.js.map +1 -1
  313. package/tools/payouts/list-payouts.mjs +1 -1
  314. package/tools/payouts/list-payouts.mjs.map +1 -1
  315. package/tools/products/create-products.d.mts +2 -2
  316. package/tools/products/create-products.d.mts.map +1 -1
  317. package/tools/products/create-products.d.ts +2 -2
  318. package/tools/products/create-products.d.ts.map +1 -1
  319. package/tools/products/create-products.js +48 -37
  320. package/tools/products/create-products.js.map +1 -1
  321. package/tools/products/create-products.mjs +48 -37
  322. package/tools/products/create-products.mjs.map +1 -1
  323. package/tools/products/delete-products.d.mts +2 -2
  324. package/tools/products/delete-products.d.mts.map +1 -1
  325. package/tools/products/delete-products.d.ts +2 -2
  326. package/tools/products/delete-products.d.ts.map +1 -1
  327. package/tools/products/delete-products.js +1 -1
  328. package/tools/products/delete-products.js.map +1 -1
  329. package/tools/products/delete-products.mjs +1 -1
  330. package/tools/products/delete-products.mjs.map +1 -1
  331. package/tools/products/images/update-products-images.d.mts +2 -2
  332. package/tools/products/images/update-products-images.d.mts.map +1 -1
  333. package/tools/products/images/update-products-images.d.ts +2 -2
  334. package/tools/products/images/update-products-images.d.ts.map +1 -1
  335. package/tools/products/images/update-products-images.js.map +1 -1
  336. package/tools/products/images/update-products-images.mjs.map +1 -1
  337. package/tools/products/list-products.d.mts +2 -2
  338. package/tools/products/list-products.d.mts.map +1 -1
  339. package/tools/products/list-products.d.ts +2 -2
  340. package/tools/products/list-products.d.ts.map +1 -1
  341. package/tools/products/list-products.js +1 -1
  342. package/tools/products/list-products.js.map +1 -1
  343. package/tools/products/list-products.mjs +1 -1
  344. package/tools/products/list-products.mjs.map +1 -1
  345. package/tools/products/retrieve-products.d.mts +2 -2
  346. package/tools/products/retrieve-products.d.mts.map +1 -1
  347. package/tools/products/retrieve-products.d.ts +2 -2
  348. package/tools/products/retrieve-products.d.ts.map +1 -1
  349. package/tools/products/retrieve-products.js +1 -1
  350. package/tools/products/retrieve-products.js.map +1 -1
  351. package/tools/products/retrieve-products.mjs +1 -1
  352. package/tools/products/retrieve-products.mjs.map +1 -1
  353. package/tools/products/unarchive-products.d.mts +2 -2
  354. package/tools/products/unarchive-products.d.mts.map +1 -1
  355. package/tools/products/unarchive-products.d.ts +2 -2
  356. package/tools/products/unarchive-products.d.ts.map +1 -1
  357. package/tools/products/unarchive-products.js +1 -1
  358. package/tools/products/unarchive-products.js.map +1 -1
  359. package/tools/products/unarchive-products.mjs +1 -1
  360. package/tools/products/unarchive-products.mjs.map +1 -1
  361. package/tools/products/update-products.d.mts +2 -2
  362. package/tools/products/update-products.d.mts.map +1 -1
  363. package/tools/products/update-products.d.ts +2 -2
  364. package/tools/products/update-products.d.ts.map +1 -1
  365. package/tools/products/update-products.js +28 -17
  366. package/tools/products/update-products.js.map +1 -1
  367. package/tools/products/update-products.mjs +28 -17
  368. package/tools/products/update-products.mjs.map +1 -1
  369. package/tools/refunds/create-refunds.d.mts +2 -2
  370. package/tools/refunds/create-refunds.d.mts.map +1 -1
  371. package/tools/refunds/create-refunds.d.ts +2 -2
  372. package/tools/refunds/create-refunds.d.ts.map +1 -1
  373. package/tools/refunds/create-refunds.js +1 -1
  374. package/tools/refunds/create-refunds.js.map +1 -1
  375. package/tools/refunds/create-refunds.mjs +1 -1
  376. package/tools/refunds/create-refunds.mjs.map +1 -1
  377. package/tools/refunds/list-refunds.d.mts +2 -2
  378. package/tools/refunds/list-refunds.d.mts.map +1 -1
  379. package/tools/refunds/list-refunds.d.ts +2 -2
  380. package/tools/refunds/list-refunds.d.ts.map +1 -1
  381. package/tools/refunds/list-refunds.js +6 -1
  382. package/tools/refunds/list-refunds.js.map +1 -1
  383. package/tools/refunds/list-refunds.mjs +6 -1
  384. package/tools/refunds/list-refunds.mjs.map +1 -1
  385. package/tools/refunds/retrieve-refunds.d.mts +2 -2
  386. package/tools/refunds/retrieve-refunds.d.mts.map +1 -1
  387. package/tools/refunds/retrieve-refunds.d.ts +2 -2
  388. package/tools/refunds/retrieve-refunds.d.ts.map +1 -1
  389. package/tools/refunds/retrieve-refunds.js +1 -1
  390. package/tools/refunds/retrieve-refunds.js.map +1 -1
  391. package/tools/refunds/retrieve-refunds.mjs +1 -1
  392. package/tools/refunds/retrieve-refunds.mjs.map +1 -1
  393. package/tools/subscriptions/change-plan-subscriptions.d.mts +2 -2
  394. package/tools/subscriptions/change-plan-subscriptions.d.mts.map +1 -1
  395. package/tools/subscriptions/change-plan-subscriptions.d.ts +2 -2
  396. package/tools/subscriptions/change-plan-subscriptions.d.ts.map +1 -1
  397. package/tools/subscriptions/change-plan-subscriptions.js.map +1 -1
  398. package/tools/subscriptions/change-plan-subscriptions.mjs.map +1 -1
  399. package/tools/subscriptions/charge-subscriptions.d.mts +2 -2
  400. package/tools/subscriptions/charge-subscriptions.d.mts.map +1 -1
  401. package/tools/subscriptions/charge-subscriptions.d.ts +2 -2
  402. package/tools/subscriptions/charge-subscriptions.d.ts.map +1 -1
  403. package/tools/subscriptions/charge-subscriptions.js.map +1 -1
  404. package/tools/subscriptions/charge-subscriptions.mjs.map +1 -1
  405. package/tools/subscriptions/create-subscriptions.d.mts +2 -2
  406. package/tools/subscriptions/create-subscriptions.d.mts.map +1 -1
  407. package/tools/subscriptions/create-subscriptions.d.ts +2 -2
  408. package/tools/subscriptions/create-subscriptions.d.ts.map +1 -1
  409. package/tools/subscriptions/create-subscriptions.js +325 -308
  410. package/tools/subscriptions/create-subscriptions.js.map +1 -1
  411. package/tools/subscriptions/create-subscriptions.mjs +325 -308
  412. package/tools/subscriptions/create-subscriptions.mjs.map +1 -1
  413. package/tools/subscriptions/list-subscriptions.d.mts +2 -2
  414. package/tools/subscriptions/list-subscriptions.d.mts.map +1 -1
  415. package/tools/subscriptions/list-subscriptions.d.ts +2 -2
  416. package/tools/subscriptions/list-subscriptions.d.ts.map +1 -1
  417. package/tools/subscriptions/list-subscriptions.js +6 -1
  418. package/tools/subscriptions/list-subscriptions.js.map +1 -1
  419. package/tools/subscriptions/list-subscriptions.mjs +6 -1
  420. package/tools/subscriptions/list-subscriptions.mjs.map +1 -1
  421. package/tools/subscriptions/retrieve-subscriptions.d.mts +2 -2
  422. package/tools/subscriptions/retrieve-subscriptions.d.mts.map +1 -1
  423. package/tools/subscriptions/retrieve-subscriptions.d.ts +2 -2
  424. package/tools/subscriptions/retrieve-subscriptions.d.ts.map +1 -1
  425. package/tools/subscriptions/retrieve-subscriptions.js +1 -1
  426. package/tools/subscriptions/retrieve-subscriptions.js.map +1 -1
  427. package/tools/subscriptions/retrieve-subscriptions.mjs +1 -1
  428. package/tools/subscriptions/retrieve-subscriptions.mjs.map +1 -1
  429. package/tools/subscriptions/update-subscriptions.d.mts +2 -2
  430. package/tools/subscriptions/update-subscriptions.d.mts.map +1 -1
  431. package/tools/subscriptions/update-subscriptions.d.ts +2 -2
  432. package/tools/subscriptions/update-subscriptions.d.ts.map +1 -1
  433. package/tools/subscriptions/update-subscriptions.js +281 -260
  434. package/tools/subscriptions/update-subscriptions.js.map +1 -1
  435. package/tools/subscriptions/update-subscriptions.mjs +281 -260
  436. package/tools/subscriptions/update-subscriptions.mjs.map +1 -1
  437. package/tools/webhook-events/list-webhook-events.d.mts +2 -2
  438. package/tools/webhook-events/list-webhook-events.d.mts.map +1 -1
  439. package/tools/webhook-events/list-webhook-events.d.ts +2 -2
  440. package/tools/webhook-events/list-webhook-events.d.ts.map +1 -1
  441. package/tools/webhook-events/list-webhook-events.js +1 -1
  442. package/tools/webhook-events/list-webhook-events.js.map +1 -1
  443. package/tools/webhook-events/list-webhook-events.mjs +1 -1
  444. package/tools/webhook-events/list-webhook-events.mjs.map +1 -1
  445. package/tools/webhook-events/retrieve-webhook-events.d.mts +2 -2
  446. package/tools/webhook-events/retrieve-webhook-events.d.mts.map +1 -1
  447. package/tools/webhook-events/retrieve-webhook-events.d.ts +2 -2
  448. package/tools/webhook-events/retrieve-webhook-events.d.ts.map +1 -1
  449. package/tools/webhook-events/retrieve-webhook-events.js +1 -1
  450. package/tools/webhook-events/retrieve-webhook-events.js.map +1 -1
  451. package/tools/webhook-events/retrieve-webhook-events.mjs +1 -1
  452. package/tools/webhook-events/retrieve-webhook-events.mjs.map +1 -1
package/README.md CHANGED
@@ -25,7 +25,7 @@ For clients with a configuration JSON, it might look something like this:
25
25
  "mcpServers": {
26
26
  "dodopayments_api": {
27
27
  "command": "npx",
28
- "args": ["-y", "dodopayments-mcp"],
28
+ "args": ["-y", "dodopayments-mcp", "--client=claude"],
29
29
  "env": {
30
30
  "DODO_PAYMENTS_API_KEY": "My Bearer Token"
31
31
  }
@@ -52,6 +52,58 @@ All of these command-line options can be repeated, combined together, and have c
52
52
 
53
53
  Use `--list` to see the list of available tools, or see below.
54
54
 
55
+ ### Specifying the MCP Client
56
+
57
+ Different clients have varying abilities to handle arbitrary tools and schemas.
58
+
59
+ You can specify the client you are using with the `--client` argument, and the MCP server will automatically
60
+ serve tools and schemas that are more compatible with that client.
61
+
62
+ - `--client=<type>`: Set all capabilities based on a known MCP client
63
+
64
+ - Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
65
+ - Example: `--client=cursor`
66
+
67
+ Additionally, if you have a client not on the above list, or the client has gotten better
68
+ over time, you can manually enable or disable certain capabilities:
69
+
70
+ - `--capability=<name>`: Specify individual client capabilities
71
+ - Available capabilities:
72
+ - `top-level-unions`: Enable support for top-level unions in tool schemas
73
+ - `valid-json`: Enable JSON string parsing for arguments
74
+ - `refs`: Enable support for $ref pointers in schemas
75
+ - `unions`: Enable support for union types (anyOf) in schemas
76
+ - `formats`: Enable support for format validations in schemas (e.g. date-time, email)
77
+ - `tool-name-length=N`: Set maximum tool name length to N characters
78
+ - Example: `--capability=top-level-unions --capability=tool-name-length=40`
79
+ - Example: `--capability=top-level-unions,tool-name-length=40`
80
+
81
+ ### Examples
82
+
83
+ 1. Filter for read operations on cards:
84
+
85
+ ```bash
86
+ --resource=cards --operation=read
87
+ ```
88
+
89
+ 2. Exclude specific tools while including others:
90
+
91
+ ```bash
92
+ --resource=cards --no-tool=create_cards
93
+ ```
94
+
95
+ 3. Configure for Cursor client with custom max tool name length:
96
+
97
+ ```bash
98
+ --client=cursor --capability=tool-name-length=40
99
+ ```
100
+
101
+ 4. Complex filtering with multiple criteria:
102
+
103
+ ```bash
104
+ --resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
105
+ ```
106
+
55
107
  ## Importing the tools and server individually
56
108
 
57
109
  ```js
package/compat.d.mts ADDED
@@ -0,0 +1,53 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import { Endpoint } from "./tools.mjs";
3
+ export interface ClientCapabilities {
4
+ topLevelUnions: boolean;
5
+ validJson: boolean;
6
+ refs: boolean;
7
+ unions: boolean;
8
+ formats: boolean;
9
+ toolNameLength: number | undefined;
10
+ }
11
+ export declare const defaultClientCapabilities: ClientCapabilities;
12
+ /**
13
+ * Attempts to parse strings into JSON objects if initial schema
14
+ * validation fails.
15
+ */
16
+ export declare function parseEmbeddedJSON(args: Record<string, unknown>, schema: Record<string, unknown>): Record<string, unknown>;
17
+ export type JSONSchema = {
18
+ type?: string;
19
+ properties?: Record<string, JSONSchema>;
20
+ required?: string[];
21
+ anyOf?: JSONSchema[];
22
+ $ref?: string;
23
+ $defs?: Record<string, JSONSchema>;
24
+ [key: string]: any;
25
+ };
26
+ /**
27
+ * Truncates tool names to the specified length while ensuring uniqueness.
28
+ * If truncation would cause duplicate names, appends a number to make them unique.
29
+ */
30
+ export declare function truncateToolNames(names: string[], maxLength: number): Map<string, string>;
31
+ /**
32
+ * Removes top-level unions from a tool by splitting it into multiple tools,
33
+ * one for each variant in the union.
34
+ */
35
+ export declare function removeTopLevelUnions(tool: Tool): Tool[];
36
+ /**
37
+ * Inlines all $refs in a schema, eliminating $defs.
38
+ * If a circular reference is detected, the circular property is removed.
39
+ */
40
+ export declare function inlineRefs(schema: JSONSchema): JSONSchema;
41
+ /**
42
+ * Removes anyOf fields from a schema, using only the first variant.
43
+ */
44
+ export declare function removeAnyOf(schema: JSONSchema): JSONSchema;
45
+ /**
46
+ * Removes format fields from a schema and appends them to the description.
47
+ */
48
+ export declare function removeFormats(schema: JSONSchema, formatsCapability: boolean): JSONSchema;
49
+ /**
50
+ * Applies all compatibility transformations to the endpoints based on the provided capabilities.
51
+ */
52
+ export declare function applyCompatibilityTransformations(endpoints: Endpoint[], capabilities: ClientCapabilities): Endpoint[];
53
+ //# sourceMappingURL=compat.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.d.mts","sourceRoot":"","sources":["src/compat.ts"],"names":[],"mappings":"OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,EAAE,QAAQ,EAAE;AAKnB,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MA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0,0 +1,53 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import { Endpoint } from "./tools.js";
3
+ export interface ClientCapabilities {
4
+ topLevelUnions: boolean;
5
+ validJson: boolean;
6
+ refs: boolean;
7
+ unions: boolean;
8
+ formats: boolean;
9
+ toolNameLength: number | undefined;
10
+ }
11
+ export declare const defaultClientCapabilities: ClientCapabilities;
12
+ /**
13
+ * Attempts to parse strings into JSON objects if initial schema
14
+ * validation fails.
15
+ */
16
+ export declare function parseEmbeddedJSON(args: Record<string, unknown>, schema: Record<string, unknown>): Record<string, unknown>;
17
+ export type JSONSchema = {
18
+ type?: string;
19
+ properties?: Record<string, JSONSchema>;
20
+ required?: string[];
21
+ anyOf?: JSONSchema[];
22
+ $ref?: string;
23
+ $defs?: Record<string, JSONSchema>;
24
+ [key: string]: any;
25
+ };
26
+ /**
27
+ * Truncates tool names to the specified length while ensuring uniqueness.
28
+ * If truncation would cause duplicate names, appends a number to make them unique.
29
+ */
30
+ export declare function truncateToolNames(names: string[], maxLength: number): Map<string, string>;
31
+ /**
32
+ * Removes top-level unions from a tool by splitting it into multiple tools,
33
+ * one for each variant in the union.
34
+ */
35
+ export declare function removeTopLevelUnions(tool: Tool): Tool[];
36
+ /**
37
+ * Inlines all $refs in a schema, eliminating $defs.
38
+ * If a circular reference is detected, the circular property is removed.
39
+ */
40
+ export declare function inlineRefs(schema: JSONSchema): JSONSchema;
41
+ /**
42
+ * Removes anyOf fields from a schema, using only the first variant.
43
+ */
44
+ export declare function removeAnyOf(schema: JSONSchema): JSONSchema;
45
+ /**
46
+ * Removes format fields from a schema and appends them to the description.
47
+ */
48
+ export declare function removeFormats(schema: JSONSchema, formatsCapability: boolean): JSONSchema;
49
+ /**
50
+ * Applies all compatibility transformations to the endpoints based on the provided capabilities.
51
+ */
52
+ export declare function applyCompatibilityTransformations(endpoints: Endpoint[], capabilities: ClientCapabilities): Endpoint[];
53
+ //# sourceMappingURL=compat.d.ts.map
@@ -0,0 +1 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CAazD;AAoED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CA0C1D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,GAAG,UAAU,CAkCxF;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,SAAS,EAAE,QAAQ,EAAE,EACrB,YAAY,EAAE,kBAAkB,GAC/B,QAAQ,EAAE,CAiEZ"}
package/compat.js ADDED
@@ -0,0 +1,351 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.applyCompatibilityTransformations = exports.removeFormats = exports.removeAnyOf = exports.inlineRefs = exports.removeTopLevelUnions = exports.truncateToolNames = exports.parseEmbeddedJSON = exports.defaultClientCapabilities = void 0;
7
+ const ajv_1 = __importDefault(require("ajv"));
8
+ const ajv = new ajv_1.default();
9
+ exports.defaultClientCapabilities = {
10
+ topLevelUnions: true,
11
+ validJson: true,
12
+ refs: true,
13
+ unions: true,
14
+ formats: true,
15
+ toolNameLength: undefined,
16
+ };
17
+ /**
18
+ * Attempts to parse strings into JSON objects if initial schema
19
+ * validation fails.
20
+ */
21
+ function parseEmbeddedJSON(args, schema) {
22
+ if (ajv.validate(schema, args)) {
23
+ return args;
24
+ }
25
+ let updated = false;
26
+ const newArgs = Object.assign({}, args);
27
+ for (const [key, value] of Object.entries(newArgs)) {
28
+ if (typeof value === 'string') {
29
+ try {
30
+ const parsed = JSON.parse(value);
31
+ newArgs[key] = parsed;
32
+ updated = true;
33
+ }
34
+ catch (e) {
35
+ // Not valid JSON, leave as is
36
+ }
37
+ }
38
+ }
39
+ if (updated) {
40
+ return newArgs;
41
+ }
42
+ return args;
43
+ }
44
+ exports.parseEmbeddedJSON = parseEmbeddedJSON;
45
+ /**
46
+ * Truncates tool names to the specified length while ensuring uniqueness.
47
+ * If truncation would cause duplicate names, appends a number to make them unique.
48
+ */
49
+ function truncateToolNames(names, maxLength) {
50
+ if (maxLength <= 0) {
51
+ return new Map();
52
+ }
53
+ const renameMap = new Map();
54
+ const usedNames = new Set();
55
+ const toTruncate = names.filter((name) => name.length > maxLength);
56
+ if (toTruncate.length === 0) {
57
+ return renameMap;
58
+ }
59
+ const willCollide = new Set(toTruncate.map((name) => name.slice(0, maxLength - 1))).size < toTruncate.length;
60
+ if (!willCollide) {
61
+ for (const name of toTruncate) {
62
+ const truncatedName = name.slice(0, maxLength);
63
+ renameMap.set(name, truncatedName);
64
+ }
65
+ }
66
+ else {
67
+ const baseLength = maxLength - 1;
68
+ for (const name of toTruncate) {
69
+ const baseName = name.slice(0, baseLength);
70
+ let counter = 1;
71
+ while (usedNames.has(baseName + counter)) {
72
+ counter++;
73
+ }
74
+ const finalName = baseName + counter;
75
+ renameMap.set(name, finalName);
76
+ usedNames.add(finalName);
77
+ }
78
+ }
79
+ return renameMap;
80
+ }
81
+ exports.truncateToolNames = truncateToolNames;
82
+ /**
83
+ * Removes top-level unions from a tool by splitting it into multiple tools,
84
+ * one for each variant in the union.
85
+ */
86
+ function removeTopLevelUnions(tool) {
87
+ const inputSchema = tool.inputSchema;
88
+ const variants = inputSchema.anyOf;
89
+ if (!variants || !Array.isArray(variants) || variants.length === 0) {
90
+ return [tool];
91
+ }
92
+ const defs = inputSchema.$defs || {};
93
+ return variants.map((variant, index) => {
94
+ const variantSchema = {
95
+ ...inputSchema,
96
+ ...variant,
97
+ type: 'object',
98
+ properties: {
99
+ ...(inputSchema.properties || {}),
100
+ ...(variant.properties || {}),
101
+ },
102
+ };
103
+ delete variantSchema.anyOf;
104
+ if (!variantSchema['description']) {
105
+ variantSchema['description'] = tool.description;
106
+ }
107
+ const usedDefs = findUsedDefs(variant, defs);
108
+ if (Object.keys(usedDefs).length > 0) {
109
+ variantSchema.$defs = usedDefs;
110
+ }
111
+ else {
112
+ delete variantSchema.$defs;
113
+ }
114
+ return {
115
+ ...tool,
116
+ name: `${tool.name}_${toSnakeCase(variant['title'] || `variant${index + 1}`)}`,
117
+ description: variant['description'] || tool.description,
118
+ inputSchema: variantSchema,
119
+ };
120
+ });
121
+ }
122
+ exports.removeTopLevelUnions = removeTopLevelUnions;
123
+ function findUsedDefs(schema, defs) {
124
+ const usedDefs = {};
125
+ if (typeof schema !== 'object' || schema === null) {
126
+ return usedDefs;
127
+ }
128
+ if (schema.$ref) {
129
+ const refParts = schema.$ref.split('/');
130
+ if (refParts[0] === '#' && refParts[1] === '$defs' && refParts[2]) {
131
+ const defName = refParts[2];
132
+ const def = defs[defName];
133
+ if (def) {
134
+ usedDefs[defName] = def;
135
+ Object.assign(usedDefs, findUsedDefs(def, defs));
136
+ }
137
+ }
138
+ return usedDefs;
139
+ }
140
+ for (const key in schema) {
141
+ if (key !== '$defs' && typeof schema[key] === 'object' && schema[key] !== null) {
142
+ Object.assign(usedDefs, findUsedDefs(schema[key], defs));
143
+ }
144
+ }
145
+ return usedDefs;
146
+ }
147
+ /**
148
+ * Inlines all $refs in a schema, eliminating $defs.
149
+ * If a circular reference is detected, the circular property is removed.
150
+ */
151
+ function inlineRefs(schema) {
152
+ if (!schema || typeof schema !== 'object') {
153
+ return schema;
154
+ }
155
+ const clonedSchema = { ...schema };
156
+ const defs = schema.$defs || {};
157
+ delete clonedSchema.$defs;
158
+ const result = inlineRefsRecursive(clonedSchema, defs, new Set());
159
+ // The top level can never be null
160
+ return result === null ? {} : result;
161
+ }
162
+ exports.inlineRefs = inlineRefs;
163
+ function inlineRefsRecursive(schema, defs, refPath) {
164
+ if (!schema || typeof schema !== 'object') {
165
+ return schema;
166
+ }
167
+ if (Array.isArray(schema)) {
168
+ return schema.map((item) => {
169
+ const processed = inlineRefsRecursive(item, defs, refPath);
170
+ return processed === null ? {} : processed;
171
+ });
172
+ }
173
+ const result = { ...schema };
174
+ if ('$ref' in result && typeof result.$ref === 'string') {
175
+ if (result.$ref.startsWith('#/$defs/')) {
176
+ const refName = result.$ref.split('/').pop();
177
+ const def = defs[refName];
178
+ // If we've already seen this ref in our path, we have a circular reference
179
+ if (refPath.has(result.$ref)) {
180
+ // For circular references, we completely remove the property
181
+ // by returning null. The parent will remove it.
182
+ return null;
183
+ }
184
+ if (def) {
185
+ const newRefPath = new Set(refPath);
186
+ newRefPath.add(result.$ref);
187
+ const inlinedDef = inlineRefsRecursive({ ...def }, defs, newRefPath);
188
+ if (inlinedDef === null) {
189
+ return { ...result };
190
+ }
191
+ // Merge the inlined definition with the original schema's properties
192
+ // but preserve things like description, etc.
193
+ const { $ref, ...rest } = result;
194
+ return { ...inlinedDef, ...rest };
195
+ }
196
+ }
197
+ // Keep external refs as-is
198
+ return result;
199
+ }
200
+ for (const key in result) {
201
+ if (result[key] && typeof result[key] === 'object') {
202
+ const processed = inlineRefsRecursive(result[key], defs, refPath);
203
+ if (processed === null) {
204
+ // Remove properties that would cause circular references
205
+ delete result[key];
206
+ }
207
+ else {
208
+ result[key] = processed;
209
+ }
210
+ }
211
+ }
212
+ return result;
213
+ }
214
+ /**
215
+ * Removes anyOf fields from a schema, using only the first variant.
216
+ */
217
+ function removeAnyOf(schema) {
218
+ if (!schema || typeof schema !== 'object') {
219
+ return schema;
220
+ }
221
+ if (Array.isArray(schema)) {
222
+ return schema.map((item) => removeAnyOf(item));
223
+ }
224
+ const result = { ...schema };
225
+ if ('anyOf' in result && Array.isArray(result.anyOf) && result.anyOf.length > 0) {
226
+ const firstVariant = result.anyOf[0];
227
+ if (firstVariant && typeof firstVariant === 'object') {
228
+ // Special handling for properties to ensure deep merge
229
+ if (firstVariant.properties && result.properties) {
230
+ result.properties = {
231
+ ...result.properties,
232
+ ...firstVariant.properties,
233
+ };
234
+ }
235
+ else if (firstVariant.properties) {
236
+ result.properties = { ...firstVariant.properties };
237
+ }
238
+ for (const key in firstVariant) {
239
+ if (key !== 'properties') {
240
+ result[key] = firstVariant[key];
241
+ }
242
+ }
243
+ }
244
+ delete result.anyOf;
245
+ }
246
+ for (const key in result) {
247
+ if (result[key] && typeof result[key] === 'object') {
248
+ result[key] = removeAnyOf(result[key]);
249
+ }
250
+ }
251
+ return result;
252
+ }
253
+ exports.removeAnyOf = removeAnyOf;
254
+ /**
255
+ * Removes format fields from a schema and appends them to the description.
256
+ */
257
+ function removeFormats(schema, formatsCapability) {
258
+ if (formatsCapability) {
259
+ return schema;
260
+ }
261
+ if (!schema || typeof schema !== 'object') {
262
+ return schema;
263
+ }
264
+ if (Array.isArray(schema)) {
265
+ return schema.map((item) => removeFormats(item, formatsCapability));
266
+ }
267
+ const result = { ...schema };
268
+ if ('format' in result && typeof result['format'] === 'string') {
269
+ const formatStr = `(format: "${result['format']}")`;
270
+ if ('description' in result && typeof result['description'] === 'string') {
271
+ result['description'] = `${result['description']} ${formatStr}`;
272
+ }
273
+ else {
274
+ result['description'] = formatStr;
275
+ }
276
+ delete result['format'];
277
+ }
278
+ for (const key in result) {
279
+ if (result[key] && typeof result[key] === 'object') {
280
+ result[key] = removeFormats(result[key], formatsCapability);
281
+ }
282
+ }
283
+ return result;
284
+ }
285
+ exports.removeFormats = removeFormats;
286
+ /**
287
+ * Applies all compatibility transformations to the endpoints based on the provided capabilities.
288
+ */
289
+ function applyCompatibilityTransformations(endpoints, capabilities) {
290
+ let transformedEndpoints = [...endpoints];
291
+ // Handle top-level unions first as this changes tool names
292
+ if (!capabilities.topLevelUnions) {
293
+ const newEndpoints = [];
294
+ for (const endpoint of transformedEndpoints) {
295
+ const variantTools = removeTopLevelUnions(endpoint.tool);
296
+ if (variantTools.length === 1) {
297
+ newEndpoints.push(endpoint);
298
+ }
299
+ else {
300
+ for (const variantTool of variantTools) {
301
+ newEndpoints.push({
302
+ ...endpoint,
303
+ tool: variantTool,
304
+ });
305
+ }
306
+ }
307
+ }
308
+ transformedEndpoints = newEndpoints;
309
+ }
310
+ if (capabilities.toolNameLength) {
311
+ const toolNames = transformedEndpoints.map((endpoint) => endpoint.tool.name);
312
+ const renameMap = truncateToolNames(toolNames, capabilities.toolNameLength);
313
+ transformedEndpoints = transformedEndpoints.map((endpoint) => ({
314
+ ...endpoint,
315
+ tool: {
316
+ ...endpoint.tool,
317
+ name: renameMap.get(endpoint.tool.name) ?? endpoint.tool.name,
318
+ },
319
+ }));
320
+ }
321
+ if (!capabilities.refs || !capabilities.unions || !capabilities.formats) {
322
+ transformedEndpoints = transformedEndpoints.map((endpoint) => {
323
+ let schema = endpoint.tool.inputSchema;
324
+ if (!capabilities.refs) {
325
+ schema = inlineRefs(schema);
326
+ }
327
+ if (!capabilities.unions) {
328
+ schema = removeAnyOf(schema);
329
+ }
330
+ if (!capabilities.formats) {
331
+ schema = removeFormats(schema, capabilities.formats);
332
+ }
333
+ return {
334
+ ...endpoint,
335
+ tool: {
336
+ ...endpoint.tool,
337
+ inputSchema: schema,
338
+ },
339
+ };
340
+ });
341
+ }
342
+ return transformedEndpoints;
343
+ }
344
+ exports.applyCompatibilityTransformations = applyCompatibilityTransformations;
345
+ function toSnakeCase(str) {
346
+ return str
347
+ .replace(/\s+/g, '_')
348
+ .replace(/([a-z])([A-Z])/g, '$1_$2')
349
+ .toLowerCase();
350
+ }
351
+ //# sourceMappingURL=compat.js.map
package/compat.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["src/compat.ts"],"names":[],"mappings":";;;;;;AAEA,8CAAsB;AAEtB,MAAM,GAAG,GAAG,IAAI,aAAG,EAAE,CAAC;AAWT,QAAA,yBAAyB,GAAuB;IAC3D,cAAc,EAAE,IAAI;IACpB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,SAAS;CAC1B,CAAC;AAEF;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,IAA6B,EAAE,MAA+B;IAC9F,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAA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