@ar-agents/mercadopago 0.1.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/AGENTS.md +151 -0
- package/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/README.md +309 -0
- package/dist/index.cjs +480 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +403 -0
- package/dist/index.d.ts +403 -0
- package/dist/index.js +465 -0
- package/dist/index.js.map +1 -0
- package/package.json +99 -0
- package/tools.manifest.json +144 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://github.com/ar-agents/ar-agents/blob/main/tools-manifest.schema.json",
|
|
3
|
+
"package": "@ar-agents/mercadopago",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"factory": "mercadoPagoTools",
|
|
6
|
+
"tools": [
|
|
7
|
+
{
|
|
8
|
+
"name": "create_subscription",
|
|
9
|
+
"summary": "Create a Mercado Pago recurring subscription. Returns the init_point URL where the customer must complete the FIRST payment with their card and CVV.",
|
|
10
|
+
"purity": "io",
|
|
11
|
+
"sideEffects": ["Creates a preapproval on MP", "Writes to SubscriptionStateAdapter"],
|
|
12
|
+
"constraints": {
|
|
13
|
+
"envVars": ["MP_ACCESS_TOKEN (TEST- for sandbox, APP_USR- for prod)"],
|
|
14
|
+
"externalIO": ["MP REST API"],
|
|
15
|
+
"latencyMs": "200-600",
|
|
16
|
+
"costPerCall": "$0 (creation is free; merchant pays per-transaction fee on auto-charges)"
|
|
17
|
+
},
|
|
18
|
+
"input": {
|
|
19
|
+
"customer_email": "string (email; cannot equal seller email)",
|
|
20
|
+
"amount_ars": "number (positive)",
|
|
21
|
+
"frequency_months": "number (1-12)",
|
|
22
|
+
"reason": "string (3-120 chars)",
|
|
23
|
+
"external_reference": "string | undefined"
|
|
24
|
+
},
|
|
25
|
+
"output": {
|
|
26
|
+
"subscription_id": "string",
|
|
27
|
+
"status": "pending",
|
|
28
|
+
"init_point_url": "string (URL the buyer must visit to complete first payment)",
|
|
29
|
+
"next_step": "string (instructions for the agent)"
|
|
30
|
+
},
|
|
31
|
+
"whenToUse": ["User asks to subscribe a customer to a recurring plan"],
|
|
32
|
+
"whenNotToUse": [
|
|
33
|
+
"User wants a one-off payment — Subscriptions API is recurring-only",
|
|
34
|
+
"User wants to charge a specific amount that varies per cycle — fix the amount or use a different MP product"
|
|
35
|
+
],
|
|
36
|
+
"errorPatterns": [
|
|
37
|
+
{
|
|
38
|
+
"shape": "MercadoPagoBackUrlInvalidError",
|
|
39
|
+
"meaning": "App passed a non-HTTPS backUrl (e.g., http://localhost). MP rejects all non-HTTPS even in sandbox.",
|
|
40
|
+
"recovery": "App misconfiguration — surface to user as 'application error', not a user-fixable problem."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"shape": "MercadoPagoSelfPaymentError",
|
|
44
|
+
"meaning": "customer_email equals the seller account's email. MP refuses self-payment on subscriptions.",
|
|
45
|
+
"recovery": "Tell user to use a different buyer email."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"shape": "MercadoPagoAccountTypeMismatchError",
|
|
49
|
+
"meaning": "Misleading MP error 'Cannot operate between different countries'. Real cause: seller token is real-account-in-test-mode but buyer email is a test_user_*@testuser.com AFIP test user.",
|
|
50
|
+
"recovery": "Use a real consumer email as the buyer."
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "get_subscription_status",
|
|
56
|
+
"summary": "Check the current status of a Mercado Pago subscription. Use to confirm the customer completed the first payment or to inspect next charge date.",
|
|
57
|
+
"purity": "io",
|
|
58
|
+
"sideEffects": [],
|
|
59
|
+
"constraints": {
|
|
60
|
+
"envVars": ["MP_ACCESS_TOKEN"],
|
|
61
|
+
"externalIO": ["MP REST API"],
|
|
62
|
+
"latencyMs": "200-500",
|
|
63
|
+
"costPerCall": "$0"
|
|
64
|
+
},
|
|
65
|
+
"input": { "subscription_id": "string (MP preapproval ID)" },
|
|
66
|
+
"output": {
|
|
67
|
+
"subscription_id": "string",
|
|
68
|
+
"status": "pending | authorized | paused | cancelled",
|
|
69
|
+
"payer_email": "string",
|
|
70
|
+
"amount": "number",
|
|
71
|
+
"currency": "ARS | USD | ...",
|
|
72
|
+
"next_payment_date": "ISO date | null",
|
|
73
|
+
"last_webhook_status": "string | null (cached from latest webhook)",
|
|
74
|
+
"last_webhook_at": "ISO date | null"
|
|
75
|
+
},
|
|
76
|
+
"whenToUse": [
|
|
77
|
+
"User asks if a customer paid",
|
|
78
|
+
"User asks when the next charge will happen",
|
|
79
|
+
"Need to verify subscription is still authorized after potential webhook events"
|
|
80
|
+
],
|
|
81
|
+
"whenNotToUse": ["You haven't created a subscription yet — no ID to query"]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "cancel_subscription",
|
|
85
|
+
"summary": "Cancel an active Mercado Pago subscription. IRREVERSIBLE — confirm with user before calling.",
|
|
86
|
+
"purity": "io",
|
|
87
|
+
"sideEffects": ["Mutates MP preapproval state to 'cancelled'", "Writes to SubscriptionStateAdapter"],
|
|
88
|
+
"constraints": {
|
|
89
|
+
"envVars": ["MP_ACCESS_TOKEN"],
|
|
90
|
+
"externalIO": ["MP REST API"],
|
|
91
|
+
"latencyMs": "200-500",
|
|
92
|
+
"costPerCall": "$0"
|
|
93
|
+
},
|
|
94
|
+
"input": { "subscription_id": "string" },
|
|
95
|
+
"output": {
|
|
96
|
+
"subscription_id": "string",
|
|
97
|
+
"status": "cancelled",
|
|
98
|
+
"message": "string"
|
|
99
|
+
},
|
|
100
|
+
"whenToUse": ["User explicitly confirms they want to cancel a subscription"],
|
|
101
|
+
"whenNotToUse": [
|
|
102
|
+
"User asked to pause temporarily — use pause_subscription instead",
|
|
103
|
+
"Without explicit user confirmation — this tool's description triggers a confirm-before-call turn in Claude Sonnet 4.6+; honor that"
|
|
104
|
+
],
|
|
105
|
+
"irreversibility": "MP cannot reactivate a cancelled subscription. Create a fresh one to resume billing."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "pause_subscription",
|
|
109
|
+
"summary": "Pause an authorized subscription. Charges stop until resumed.",
|
|
110
|
+
"purity": "io",
|
|
111
|
+
"sideEffects": ["Mutates MP preapproval state to 'paused'", "Writes to SubscriptionStateAdapter"],
|
|
112
|
+
"constraints": {
|
|
113
|
+
"envVars": ["MP_ACCESS_TOKEN"],
|
|
114
|
+
"externalIO": ["MP REST API"],
|
|
115
|
+
"latencyMs": "200-500",
|
|
116
|
+
"costPerCall": "$0"
|
|
117
|
+
},
|
|
118
|
+
"input": { "subscription_id": "string" },
|
|
119
|
+
"output": { "subscription_id": "string", "status": "paused", "message": "string" },
|
|
120
|
+
"whenToUse": ["User wants to pause billing temporarily but keep the subscription"],
|
|
121
|
+
"whenNotToUse": [
|
|
122
|
+
"Subscription is in pending status (not yet authorized) — pause only works on authorized subs"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "resume_subscription",
|
|
127
|
+
"summary": "Resume a paused subscription. Charges resume on next scheduled date.",
|
|
128
|
+
"purity": "io",
|
|
129
|
+
"sideEffects": ["Mutates MP preapproval state to 'authorized'", "Writes to SubscriptionStateAdapter"],
|
|
130
|
+
"constraints": {
|
|
131
|
+
"envVars": ["MP_ACCESS_TOKEN"],
|
|
132
|
+
"externalIO": ["MP REST API"],
|
|
133
|
+
"latencyMs": "200-500",
|
|
134
|
+
"costPerCall": "$0"
|
|
135
|
+
},
|
|
136
|
+
"input": { "subscription_id": "string" },
|
|
137
|
+
"output": { "subscription_id": "string", "status": "authorized", "message": "string" },
|
|
138
|
+
"whenToUse": ["User wants to reactivate a previously-paused subscription"],
|
|
139
|
+
"whenNotToUse": [
|
|
140
|
+
"Subscription is cancelled — MP doesn't allow resuming cancelled subs (throws MercadoPagoAuthorizeForbiddenError). Create a new subscription instead."
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|