@caravo/mcp 0.1.13 → 0.1.14
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/dist/index.js +49 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -210,11 +210,29 @@ function makeFavToolHandler(tool) {
|
|
|
210
210
|
{
|
|
211
211
|
type: "text",
|
|
212
212
|
text: [
|
|
213
|
-
`Payment required for ${tool.name} ($${tool.pricing.price_per_call})
|
|
214
|
-
|
|
215
|
-
`
|
|
216
|
-
`
|
|
217
|
-
|
|
213
|
+
`Payment required for ${tool.name} ($${tool.pricing.price_per_call}). Two options:`,
|
|
214
|
+
``,
|
|
215
|
+
`Option A — Caravo balance (recommended):`,
|
|
216
|
+
` Run the "login" tool to connect your account, then top up at https://caravo.ai/dashboard`,
|
|
217
|
+
``,
|
|
218
|
+
`Option B — USDC wallet (no registration):`,
|
|
219
|
+
` Send USDC on Base to ${wallet.address}`,
|
|
220
|
+
].join("\n"),
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
isError: true,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
if (result.error === "Insufficient balance") {
|
|
227
|
+
return {
|
|
228
|
+
content: [
|
|
229
|
+
{
|
|
230
|
+
type: "text",
|
|
231
|
+
text: [
|
|
232
|
+
`Insufficient Caravo balance (have $${result.balance ?? 0}, need $${result.cost ?? "?"}).`,
|
|
233
|
+
``,
|
|
234
|
+
`Top up your balance at https://caravo.ai/dashboard`,
|
|
235
|
+
`Or enable auto top-up in your dashboard settings to never run out.`,
|
|
218
236
|
].join("\n"),
|
|
219
237
|
},
|
|
220
238
|
],
|
|
@@ -379,16 +397,37 @@ function registerAllTools(server) {
|
|
|
379
397
|
};
|
|
380
398
|
}
|
|
381
399
|
if (result.x402Version || result.accepts) {
|
|
400
|
+
const price = result.accepts?.[0]?.amount
|
|
401
|
+
? `$${(parseInt(result.accepts[0].amount) / 1e6).toFixed(6)}`
|
|
402
|
+
: "?";
|
|
403
|
+
return {
|
|
404
|
+
content: [
|
|
405
|
+
{
|
|
406
|
+
type: "text",
|
|
407
|
+
text: [
|
|
408
|
+
`Payment required (${price}). Two options:`,
|
|
409
|
+
``,
|
|
410
|
+
`Option A — Caravo balance (recommended):`,
|
|
411
|
+
` Run the "login" tool to connect your account, then top up at https://caravo.ai/dashboard`,
|
|
412
|
+
``,
|
|
413
|
+
`Option B — USDC wallet (no registration):`,
|
|
414
|
+
` Send USDC on Base to ${wallet.address}`,
|
|
415
|
+
].join("\n"),
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
isError: true,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
if (result.error === "Insufficient balance") {
|
|
382
422
|
return {
|
|
383
423
|
content: [
|
|
384
424
|
{
|
|
385
425
|
type: "text",
|
|
386
426
|
text: [
|
|
387
|
-
`
|
|
388
|
-
|
|
389
|
-
`
|
|
390
|
-
`
|
|
391
|
-
` Amount: at least $${result.accepts?.[0]?.amount ? (parseInt(result.accepts[0].amount) / 1e6).toFixed(6) : "?"}`,
|
|
427
|
+
`Insufficient Caravo balance (have $${result.balance ?? 0}, need $${result.cost ?? "?"}).`,
|
|
428
|
+
``,
|
|
429
|
+
`Top up your balance at https://caravo.ai/dashboard`,
|
|
430
|
+
`Or enable auto top-up in your dashboard settings to never run out.`,
|
|
392
431
|
].join("\n"),
|
|
393
432
|
},
|
|
394
433
|
],
|
package/package.json
CHANGED