@cg3/prior-mcp 0.4.3 → 0.4.5
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/tools.js +2 -0
- package/dist/utils.js +6 -3
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -63,6 +63,7 @@ See prior://docs/search-tips for detailed guidance.`,
|
|
|
63
63
|
tags: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
64
64
|
qualityScore: zod_1.z.number().nullable().optional(),
|
|
65
65
|
relevanceScore: zod_1.z.number().nullable().optional(),
|
|
66
|
+
errorMessages: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
66
67
|
failedApproaches: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
67
68
|
feedbackActions: zod_1.z.object({
|
|
68
69
|
useful: zod_1.z.object({
|
|
@@ -109,6 +110,7 @@ See prior://docs/search-tips for detailed guidance.`,
|
|
|
109
110
|
tags: r.tags,
|
|
110
111
|
qualityScore: r.qualityScore,
|
|
111
112
|
relevanceScore: r.relevanceScore,
|
|
113
|
+
errorMessages: r.errorMessages,
|
|
112
114
|
failedApproaches: r.failedApproaches,
|
|
113
115
|
feedbackActions: {
|
|
114
116
|
useful: { entryId: r.id, outcome: "useful" },
|
package/dist/utils.js
CHANGED
|
@@ -20,14 +20,17 @@ function detectHost() {
|
|
|
20
20
|
function formatResults(data) {
|
|
21
21
|
const json = JSON.stringify(data, null, 2);
|
|
22
22
|
// Append feedback nudge for search results
|
|
23
|
+
// Backend wraps in {ok, data: {results: [...]}, error} — unwrap first
|
|
23
24
|
const d = data;
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const inner = d?.data || d;
|
|
26
|
+
const results = inner?.results;
|
|
27
|
+
if (results && Array.isArray(results) && results.length > 0) {
|
|
28
|
+
const topResult = results[0];
|
|
26
29
|
const topId = topResult?.id;
|
|
27
30
|
// Check if the first result has an 'id' property with a meaningful value
|
|
28
31
|
// Exclude null, undefined, and empty string
|
|
29
32
|
if (topResult && 'id' in topResult && topId !== null && topId !== undefined && topId !== '') {
|
|
30
|
-
const ids =
|
|
33
|
+
const ids = results.map(r => r?.id || '').join(", ");
|
|
31
34
|
return json + `\n\n---\nYou already paid 1 credit for this search. Get it back — call prior_feedback with ONE of:\n` +
|
|
32
35
|
` worked: prior_feedback(entryId="${topId}", outcome="useful")\n` +
|
|
33
36
|
` didn't work: prior_feedback(entryId="${topId}", outcome="not_useful", reason="describe why")\n` +
|
package/package.json
CHANGED