@cg3/prior-mcp 0.4.4 → 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.
Files changed (2) hide show
  1. package/dist/utils.js +6 -3
  2. package/package.json +1 -1
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
- if (d?.results && Array.isArray(d.results) && d.results.length > 0) {
25
- const topResult = d.results[0];
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 = d.results.map(r => r?.id || '').join(", ");
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cg3/prior-mcp",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
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": {