lowdown-proxy 0.1.8 → 0.1.9
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/mcp-server.js +25 -8
- package/package.json +1 -1
package/dist/mcp-server.js
CHANGED
|
@@ -45,11 +45,14 @@ server.tool("compare_tools", "Compare multiple tools or agents by their recorded
|
|
|
45
45
|
"Returns a ranked list with success rates and confidence levels.", {
|
|
46
46
|
candidates: z.array(z.string()).min(2).max(5).describe("List of tool/agent identifiers to compare"),
|
|
47
47
|
task_type: z.string().optional().describe("Filter by task type if you want task-specific comparison"),
|
|
48
|
-
}, async ({ candidates }) => {
|
|
49
|
-
// 후보들을 병렬로 조회
|
|
48
|
+
}, async ({ candidates, task_type }) => {
|
|
49
|
+
// 후보들을 병렬로 조회 (task_type 있으면 필터 적용)
|
|
50
50
|
const results = await Promise.all(candidates.map(async (target) => {
|
|
51
51
|
try {
|
|
52
|
-
const
|
|
52
|
+
const url = task_type
|
|
53
|
+
? `${BASE_URL}/api/reputation/${encodeURIComponent(target)}?task_type=${encodeURIComponent(task_type)}`
|
|
54
|
+
: `${BASE_URL}/api/reputation/${encodeURIComponent(target)}`;
|
|
55
|
+
const res = await fetch(url, { headers: { "x-lowdown-source": "organic" } });
|
|
53
56
|
return await res.json();
|
|
54
57
|
}
|
|
55
58
|
catch {
|
|
@@ -69,16 +72,30 @@ server.tool("compare_tools", "Compare multiple tools or agents by their recorded
|
|
|
69
72
|
const summary = ranked
|
|
70
73
|
.map((r, i) => {
|
|
71
74
|
const rate = r.success_rate !== null ? `${(Number(r.success_rate) * 100).toFixed(0)}%` : "no data";
|
|
72
|
-
|
|
75
|
+
const latency = r.avg_latency_ms ? `, latency: ${r.avg_latency_ms}ms` : "";
|
|
76
|
+
return `${i + 1}. ${r.target} — success: ${rate}, interactions: ${r.interactions}, confidence: ${r.confidence}${latency}`;
|
|
73
77
|
})
|
|
74
78
|
.join("\n");
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
// recommendation + reason 자동 생성
|
|
80
|
+
const best = ranked[0];
|
|
81
|
+
let recommendation = null;
|
|
82
|
+
if (best?.interactions >= 5 && best?.success_rate !== null) {
|
|
83
|
+
const rate = `${(Number(best.success_rate) * 100).toFixed(0)}%`;
|
|
84
|
+
const latencyNote = best.avg_latency_ms ? ` with avg latency ${best.avg_latency_ms}ms` : "";
|
|
85
|
+
const taskNote = task_type ? ` for ${task_type}` : "";
|
|
86
|
+
recommendation = {
|
|
87
|
+
target: best.target,
|
|
88
|
+
reason: `Highest success rate${taskNote} (${rate}) across ${best.interactions} observations${latencyNote}.`,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
78
91
|
return {
|
|
79
92
|
content: [{
|
|
80
93
|
type: "text",
|
|
81
|
-
text:
|
|
94
|
+
text: JSON.stringify({
|
|
95
|
+
task_type: task_type ?? null,
|
|
96
|
+
candidates: ranked,
|
|
97
|
+
recommendation: recommendation ?? { target: null, reason: "Insufficient interaction history for a reliable comparison." },
|
|
98
|
+
}, null, 2),
|
|
82
99
|
}],
|
|
83
100
|
};
|
|
84
101
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lowdown-proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"mcpName": "io.github.PetShopBros/lowdown-proxy",
|
|
5
5
|
"description": "Record and query AI agent/tool/service interactions. Shared reputation layer for the multi-agent ecosystem.",
|
|
6
6
|
"type": "module",
|