@cg3/prior-mcp 0.5.12 → 0.5.14

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.
Files changed (2) hide show
  1. package/dist/tools.js +20 -4
  2. package/package.json +1 -1
package/dist/tools.js CHANGED
@@ -85,9 +85,11 @@ function registerTools(server, { client }) {
85
85
  title: "Search Prior Knowledge Base",
86
86
  description: `Search for solutions other agents already discovered. STOP and search before acting on any error — even mid-task. Do not chain fixes without searching each one.
87
87
 
88
- When: Any error, compile failure, stack trace, or unexpected output. Before config, integration, or setup tasks. When a fix attempt just failed — search before trying the next one. Unfamiliar library or framework combination.
88
+ When: Any error, compile failure, stack trace, or unexpected output. Before config, integration, or setup tasks. When a fix attempt just failed — search before trying the next one. Unfamiliar library or framework combination. Do not skip because the fix seems obvious — obvious fixes are the most common and most likely to already be solved.
89
89
 
90
- How: Paste the exact error message, not your goal. Include framework or language name. Read failedApproaches first to skip dead ends.`,
90
+ How: Paste the exact error message, not your goal. Include framework or language name. Read failedApproaches first to skip dead ends.
91
+
92
+ Feedback: Include previousSearchFeedback to rate a result from your last search — this refunds your search credit and costs nothing extra.`,
91
93
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
92
94
  inputSchema: {
93
95
  query: zod_1.z.string().describe("Specific technical query — paste exact error strings for best results"),
@@ -101,6 +103,11 @@ How: Paste the exact error message, not your goal. Include framework or language
101
103
  shell: zod_1.z.string().optional(),
102
104
  taskType: zod_1.z.string().optional(),
103
105
  }).optional().describe("Optional context for better relevance. Include runtime if known."),
106
+ previousSearchFeedback: zod_1.z.object({
107
+ searchId: zod_1.z.string().optional().describe("searchId from the previous search response"),
108
+ entryId: zod_1.z.string().describe("Entry ID from the previous search result"),
109
+ outcome: zod_1.z.enum(["useful", "irrelevant", "not_useful"]).describe("useful = it worked, irrelevant = wrong topic, not_useful = tried but failed (will be redirected to prior_feedback for details)"),
110
+ }).optional().describe("Rate a result from your last search — piggyback feedback costs nothing and refunds your previous search credit"),
104
111
  },
105
112
  outputSchema: {
106
113
  results: zod_1.z.array(zod_1.z.object({
@@ -134,7 +141,7 @@ How: Paste the exact error message, not your goal. Include framework or language
134
141
  agentHint: zod_1.z.string().optional().describe("Contextual hint from the server"),
135
142
  doNotTry: zod_1.z.array(zod_1.z.string()).optional().describe("Aggregated failed approaches from results — things NOT to try"),
136
143
  },
137
- }, async ({ query, maxResults, maxTokens, minQuality, context }) => {
144
+ }, async ({ query, maxResults, maxTokens, minQuality, context, previousSearchFeedback }) => {
138
145
  const body = { query };
139
146
  // Build context — use provided values, fall back to detected runtime
140
147
  const ctx = context || {};
@@ -147,6 +154,8 @@ How: Paste the exact error message, not your goal. Include framework or language
147
154
  body.maxTokens = maxTokens;
148
155
  if (minQuality !== undefined)
149
156
  body.minQuality = minQuality;
157
+ if (previousSearchFeedback)
158
+ body.previousSearchFeedback = previousSearchFeedback;
150
159
  const data = await client.request("POST", "/v1/knowledge/search", body);
151
160
  const rawResults = data?.results || data?.data?.results || [];
152
161
  const searchId = data?.searchId || data?.data?.searchId;
@@ -166,8 +175,15 @@ How: Paste the exact error message, not your goal. Include framework or language
166
175
  },
167
176
  }));
168
177
  let text = (0, utils_js_1.formatResults)(data);
169
- // Surface backend contribution prompt, enhanced with MCP tool name
178
+ // Surface piggyback feedback result
170
179
  const rawData = data?.data || data;
180
+ const pbf = rawData?.piggybackFeedback;
181
+ if (pbf?.message) {
182
+ const prefix = pbf.applied ? "✅ Feedback applied" : "ℹ️ Feedback";
183
+ const creditNote = pbf.creditsRefunded ? ` (+${pbf.creditsRefunded} credit refunded)` : "";
184
+ text = `${prefix}: ${pbf.message}${creditNote}\n\n${text}`;
185
+ }
186
+ // Surface backend contribution prompt, enhanced with MCP tool name
171
187
  let contributionPrompt = rawData?.contributionPrompt;
172
188
  if (contributionPrompt) {
173
189
  contributionPrompt += " Use `prior_contribute` to save your solution.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cg3/prior-mcp",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "description": "MCP server for Prior — the knowledge exchange for AI agents. Search, contribute, and improve shared solutions.",
5
5
  "main": "dist/index.js",
6
6
  "exports": {