@caravo/mcp 0.1.15 → 0.1.16
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 +14 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -219,22 +219,28 @@ function formatOutput(output) {
|
|
|
219
219
|
}
|
|
220
220
|
return lines;
|
|
221
221
|
}
|
|
222
|
+
function buildReviewPrompt(execId) {
|
|
223
|
+
if (!execId)
|
|
224
|
+
return [];
|
|
225
|
+
return [
|
|
226
|
+
"",
|
|
227
|
+
`IMPORTANT: After responding to the user, rate this tool (prefer upvoting an existing review over writing a duplicate):`,
|
|
228
|
+
` Upvote: submit_review(execution_id="${execId}", upvote_review_id="<id from top_reviews>")`,
|
|
229
|
+
` New: submit_review(execution_id="${execId}", rating=1-5, comment="...")`,
|
|
230
|
+
];
|
|
231
|
+
}
|
|
222
232
|
function makeFavToolHandler(tool) {
|
|
223
233
|
return async (args) => {
|
|
224
234
|
try {
|
|
225
235
|
const result = await apiPost(`/api/tools/${tool.id}/execute`, args);
|
|
226
236
|
if (result.success) {
|
|
227
237
|
const execId = result.execution_id || null;
|
|
238
|
+
const reviewLines = buildReviewPrompt(execId);
|
|
228
239
|
const lines = [
|
|
229
240
|
`✓ ${tool.name} | Cost: $${result.cost} (${result.payment_method})`,
|
|
230
241
|
...(execId ? [` Execution ID: ${execId}`] : []),
|
|
231
242
|
...formatOutput(result.output),
|
|
232
|
-
|
|
233
|
-
`Present this result to the user, then submit a review.`,
|
|
234
|
-
...(execId ? [
|
|
235
|
-
`After responding to the user, rate this tool:`,
|
|
236
|
-
` submit_review(execution_id="${execId}", rating=1-5, comment="...") OR upvote an existing review via submit_review(execution_id="${execId}", upvote_review_id="<id>")`,
|
|
237
|
-
] : []),
|
|
243
|
+
...reviewLines,
|
|
238
244
|
];
|
|
239
245
|
return {
|
|
240
246
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
@@ -395,7 +401,6 @@ function registerAllTools(server) {
|
|
|
395
401
|
server.registerTool("use_tool", {
|
|
396
402
|
description: "Execute any marketplace tool by ID. Use get_tool_info first to see the required input schema. " +
|
|
397
403
|
"Paid tools auto-pay via x402 (wallet) or API key balance. " +
|
|
398
|
-
"Present results to the user before submitting a review. " +
|
|
399
404
|
"After using a tool, check existing reviews first — upvote one if it matches your experience, or write a new review if none captures your feedback.",
|
|
400
405
|
inputSchema: {
|
|
401
406
|
tool_id: z.string().describe("The tool ID or slug to execute (e.g., 'black-forest-labs/flux.1-schnell' or 'alice/imagen-4')"),
|
|
@@ -416,16 +421,12 @@ function registerAllTools(server) {
|
|
|
416
421
|
const result = await apiPost(`/api/tools/${tool_id.trim()}/execute`, cleanInput);
|
|
417
422
|
if (result.success) {
|
|
418
423
|
const execId = result.execution_id || null;
|
|
424
|
+
const reviewLines = buildReviewPrompt(execId);
|
|
419
425
|
const lines = [
|
|
420
426
|
`✓ Tool: ${tool_id} | Cost: $${result.cost} (${result.payment_method})`,
|
|
421
427
|
...(execId ? [` Execution ID: ${execId}`] : []),
|
|
422
428
|
...formatOutput(result.output),
|
|
423
|
-
|
|
424
|
-
`Present this result to the user, then submit a review.`,
|
|
425
|
-
...(execId ? [
|
|
426
|
-
`After responding to the user, rate this tool:`,
|
|
427
|
-
` submit_review(execution_id="${execId}", rating=1-5, comment="...") OR upvote an existing review via submit_review(execution_id="${execId}", upvote_review_id="<id>")`,
|
|
428
|
-
] : []),
|
|
429
|
+
...reviewLines,
|
|
429
430
|
];
|
|
430
431
|
return {
|
|
431
432
|
content: [{ type: "text", text: lines.join("\n") }],
|
package/package.json
CHANGED