@cg3/prior-mcp 0.5.16 → 0.5.17
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 +25 -4
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -241,7 +241,9 @@ Feedback: Include previousSearchFeedback to rate a result from your last search
|
|
|
241
241
|
|
|
242
242
|
When to prompt the user: After each non-trivial fix — not just at end of conversation. If you fixed something by reasoning rather than a known solution, ask inline: "That took some debugging — want me to contribute this to Prior?" Also prompt when the fix differed from what the error suggested, or when a contribution nudge appears in search results.
|
|
243
243
|
|
|
244
|
-
Before submitting, read prior://docs/contributing for field guidance. Scrub PII and project-specific details — Prior is a public knowledge base. Write for developers on unrelated projects, not your team
|
|
244
|
+
Before submitting, read prior://docs/contributing for field guidance. Scrub PII and project-specific details — Prior is a public knowledge base. Write for developers on unrelated projects, not your team.
|
|
245
|
+
|
|
246
|
+
If the response has requiresConfirmation=true, Prior found similar entries that may already cover this topic. Review them — if they solve the problem, don't re-contribute. If your contribution adds unique value (different environment, additional context, better solution), call prior_contribute again with the same fields plus the confirmToken from the response.`,
|
|
245
247
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
246
248
|
inputSchema: {
|
|
247
249
|
title: zod_1.z.string().describe("Concise title (<200 chars) describing the SYMPTOM, not the diagnosis"),
|
|
@@ -268,14 +270,19 @@ Before submitting, read prior://docs/contributing for field guidance. Scrub PII
|
|
|
268
270
|
toolCalls: zod_1.z.number().optional(),
|
|
269
271
|
}).optional().describe("Effort spent discovering this solution"),
|
|
270
272
|
ttl: zod_1.z.string().optional().describe("Time to live: 30d, 60d, 90d (default), 365d, evergreen"),
|
|
273
|
+
confirmToken: zod_1.z.string().optional().describe("Token from a previous near-duplicate response. Include this to confirm your contribution adds unique value despite similar entries existing."),
|
|
271
274
|
},
|
|
272
275
|
outputSchema: {
|
|
273
|
-
id: zod_1.z.string().describe("Short ID of the new entry"),
|
|
274
|
-
status: zod_1.z.string().describe("Entry status
|
|
276
|
+
id: zod_1.z.string().describe("Short ID of the new entry (empty if requiresConfirmation)"),
|
|
277
|
+
status: zod_1.z.string().describe("Entry status: active, pending, or near_duplicate"),
|
|
275
278
|
creditsEarned: zod_1.z.number().optional(),
|
|
279
|
+
requiresConfirmation: zod_1.z.boolean().optional().describe("If true, similar entries exist. Review them and re-submit with confirmToken."),
|
|
280
|
+
confirmToken: zod_1.z.string().optional().describe("Token to include in re-submission to confirm contribution"),
|
|
276
281
|
},
|
|
277
|
-
}, async ({ title, content, tags, model, problem, solution, errorMessages, failedApproaches, environment, effort, ttl }) => {
|
|
282
|
+
}, async ({ title, content, tags, model, problem, solution, errorMessages, failedApproaches, environment, effort, ttl, confirmToken }) => {
|
|
278
283
|
const body = { title, content, tags: tags || [], model: model || "unknown" };
|
|
284
|
+
if (confirmToken)
|
|
285
|
+
body.confirmToken = confirmToken;
|
|
279
286
|
if (problem)
|
|
280
287
|
body.problem = problem;
|
|
281
288
|
if (solution)
|
|
@@ -292,6 +299,20 @@ Before submitting, read prior://docs/contributing for field guidance. Scrub PII
|
|
|
292
299
|
body.ttl = ttl;
|
|
293
300
|
const data = await client.request("POST", "/v1/knowledge/contribute", body);
|
|
294
301
|
const entry = data?.data || data;
|
|
302
|
+
// Handle near-duplicate soft band response
|
|
303
|
+
if (entry?.requiresConfirmation || entry?.status === "near_duplicate") {
|
|
304
|
+
const dupes = entry.nearDuplicates || [];
|
|
305
|
+
const dupeList = dupes.map((d) => ` - ${d.shortId}: "${d.title}" (${Math.round(d.similarity * 100)}% similar)`).join("\n");
|
|
306
|
+
return {
|
|
307
|
+
structuredContent: {
|
|
308
|
+
id: "",
|
|
309
|
+
status: "near_duplicate",
|
|
310
|
+
requiresConfirmation: true,
|
|
311
|
+
confirmToken: entry.confirmToken,
|
|
312
|
+
},
|
|
313
|
+
content: [{ type: "text", text: `Similar entries already exist in Prior:\n${dupeList}\n\nReview these entries — if they already solve the problem, no need to contribute. If your contribution adds unique value, call prior_contribute again with the same fields plus confirmToken: "${entry.confirmToken}"` }],
|
|
314
|
+
};
|
|
315
|
+
}
|
|
295
316
|
return {
|
|
296
317
|
structuredContent: {
|
|
297
318
|
id: entry?.id || entry?.shortId || "",
|
package/package.json
CHANGED