@cg3/prior-mcp 0.5.16 → 0.5.18
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 +35 -5
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -103,6 +103,9 @@ Feedback: Include previousSearchFeedback to rate a result from your last search
|
|
|
103
103
|
shell: zod_1.z.string().optional(),
|
|
104
104
|
taskType: zod_1.z.string().optional(),
|
|
105
105
|
}).optional().describe("Optional context for better relevance. Include runtime if known."),
|
|
106
|
+
requiredTags: zod_1.z.array(zod_1.z.string()).optional().describe("Only return entries that have ALL of these tags"),
|
|
107
|
+
excludeTags: zod_1.z.array(zod_1.z.string()).optional().describe("Exclude entries that have ANY of these tags"),
|
|
108
|
+
preferredTags: zod_1.z.array(zod_1.z.string()).optional().describe("Boost entries with these tags (soft signal, does not exclude non-matches)"),
|
|
106
109
|
previousSearchFeedback: zod_1.z.object({
|
|
107
110
|
searchId: zod_1.z.string().optional().describe("searchId from the previous search response"),
|
|
108
111
|
entryId: zod_1.z.string().describe("Entry ID from the previous search result"),
|
|
@@ -141,7 +144,7 @@ Feedback: Include previousSearchFeedback to rate a result from your last search
|
|
|
141
144
|
agentHint: zod_1.z.string().optional().describe("Contextual hint from the server"),
|
|
142
145
|
doNotTry: zod_1.z.array(zod_1.z.string()).optional().describe("Aggregated failed approaches from results — things NOT to try"),
|
|
143
146
|
},
|
|
144
|
-
}, async ({ query, maxResults, maxTokens, minQuality, context, previousSearchFeedback }) => {
|
|
147
|
+
}, async ({ query, maxResults, maxTokens, minQuality, context, requiredTags, excludeTags, preferredTags, previousSearchFeedback }) => {
|
|
145
148
|
const body = { query };
|
|
146
149
|
// Build context — use provided values, fall back to detected runtime
|
|
147
150
|
const ctx = context || {};
|
|
@@ -154,6 +157,12 @@ Feedback: Include previousSearchFeedback to rate a result from your last search
|
|
|
154
157
|
body.maxTokens = maxTokens;
|
|
155
158
|
if (minQuality !== undefined)
|
|
156
159
|
body.minQuality = minQuality;
|
|
160
|
+
if (requiredTags?.length)
|
|
161
|
+
body.requiredTags = requiredTags;
|
|
162
|
+
if (excludeTags?.length)
|
|
163
|
+
body.excludeTags = excludeTags;
|
|
164
|
+
if (preferredTags?.length)
|
|
165
|
+
body.preferredTags = preferredTags;
|
|
157
166
|
if (previousSearchFeedback)
|
|
158
167
|
body.previousSearchFeedback = previousSearchFeedback;
|
|
159
168
|
const data = await client.request("POST", "/v1/knowledge/search", body);
|
|
@@ -241,7 +250,9 @@ Feedback: Include previousSearchFeedback to rate a result from your last search
|
|
|
241
250
|
|
|
242
251
|
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
252
|
|
|
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
|
|
253
|
+
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.
|
|
254
|
+
|
|
255
|
+
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
256
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
246
257
|
inputSchema: {
|
|
247
258
|
title: zod_1.z.string().describe("Concise title (<200 chars) describing the SYMPTOM, not the diagnosis"),
|
|
@@ -268,14 +279,19 @@ Before submitting, read prior://docs/contributing for field guidance. Scrub PII
|
|
|
268
279
|
toolCalls: zod_1.z.number().optional(),
|
|
269
280
|
}).optional().describe("Effort spent discovering this solution"),
|
|
270
281
|
ttl: zod_1.z.string().optional().describe("Time to live: 30d, 60d, 90d (default), 365d, evergreen"),
|
|
282
|
+
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
283
|
},
|
|
272
284
|
outputSchema: {
|
|
273
|
-
id: zod_1.z.string().describe("Short ID of the new entry"),
|
|
274
|
-
status: zod_1.z.string().describe("Entry status
|
|
285
|
+
id: zod_1.z.string().describe("Short ID of the new entry (empty if requiresConfirmation)"),
|
|
286
|
+
status: zod_1.z.string().describe("Entry status: active, pending, or near_duplicate"),
|
|
275
287
|
creditsEarned: zod_1.z.number().optional(),
|
|
288
|
+
requiresConfirmation: zod_1.z.boolean().optional().describe("If true, similar entries exist. Review them and re-submit with confirmToken."),
|
|
289
|
+
confirmToken: zod_1.z.string().optional().describe("Token to include in re-submission to confirm contribution"),
|
|
276
290
|
},
|
|
277
|
-
}, async ({ title, content, tags, model, problem, solution, errorMessages, failedApproaches, environment, effort, ttl }) => {
|
|
291
|
+
}, async ({ title, content, tags, model, problem, solution, errorMessages, failedApproaches, environment, effort, ttl, confirmToken }) => {
|
|
278
292
|
const body = { title, content, tags: tags || [], model: model || "unknown" };
|
|
293
|
+
if (confirmToken)
|
|
294
|
+
body.confirmToken = confirmToken;
|
|
279
295
|
if (problem)
|
|
280
296
|
body.problem = problem;
|
|
281
297
|
if (solution)
|
|
@@ -292,6 +308,20 @@ Before submitting, read prior://docs/contributing for field guidance. Scrub PII
|
|
|
292
308
|
body.ttl = ttl;
|
|
293
309
|
const data = await client.request("POST", "/v1/knowledge/contribute", body);
|
|
294
310
|
const entry = data?.data || data;
|
|
311
|
+
// Handle near-duplicate soft band response
|
|
312
|
+
if (entry?.requiresConfirmation || entry?.status === "near_duplicate") {
|
|
313
|
+
const dupes = entry.nearDuplicates || [];
|
|
314
|
+
const dupeList = dupes.map((d) => ` - ${d.shortId}: "${d.title}" (${Math.round(d.similarity * 100)}% similar)`).join("\n");
|
|
315
|
+
return {
|
|
316
|
+
structuredContent: {
|
|
317
|
+
id: "",
|
|
318
|
+
status: "near_duplicate",
|
|
319
|
+
requiresConfirmation: true,
|
|
320
|
+
confirmToken: entry.confirmToken,
|
|
321
|
+
},
|
|
322
|
+
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}"` }],
|
|
323
|
+
};
|
|
324
|
+
}
|
|
295
325
|
return {
|
|
296
326
|
structuredContent: {
|
|
297
327
|
id: entry?.id || entry?.shortId || "",
|
package/package.json
CHANGED