@theronap/cortex-mcp 0.9.133 → 0.9.134

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/lib/server.mjs +39 -0
  2. package/package.json +1 -1
package/lib/server.mjs CHANGED
@@ -2253,6 +2253,45 @@ function renderNudge(payload) {
2253
2253
  },
2254
2254
  )
2255
2255
 
2256
+ server.registerTool(
2257
+ 'supersede_record',
2258
+ {
2259
+ title: 'Mark a record as no longer the answer',
2260
+ description: "Say that a record is wrong, outdated or replaced — WITHOUT deleting it. Use it when you re-capture something properly and the old copy should stop showing up: a transcript filed with a bad occurred_at, a duplicate capture, a low-fidelity copy replaced by a content_path one. \u26a0 NOTHING IS DESTROYED AND THIS IS REVERSIBLE (`restore: true`). The row, its page attachments and its containment all stay exactly as they were; only the READS change — it disappears from its pages, from its container's contents, and from the \"holds N\" count on find_sessions. It stays SEARCHABLE on purpose: hiding a record from search would be most of the way to deleting it without the audit trail. \u26a0 THERE IS NO DELETE, DELIBERATELY (ADR-0049) — 13 of the 15 foreign keys to a record CASCADE, so a real delete would unfile everything inside a container, drop clearance anchors and rewrite the claim ledger, while still leaving revision rows behind. If you actually need content destroyed rather than hidden, say so to the user rather than reaching for this. \u26a0 REFUSED ON A CONTAINER (a class session, a meeting): hiding an event that still holds other records leaves their placements pointing at nothing. Supersede the records INSIDE it instead.",
2261
+ inputSchema: {
2262
+ record_id: z.string().describe('the record that is no longer the answer'),
2263
+ reason: z.string().optional().describe('WHY it is no longer right — required unless restoring, and the one thing that cannot be inferred later'),
2264
+ superseded_by: z.string().optional().describe('the record that REPLACES it, if there is one. Must be in the same brain. Optional: "this is wrong" is a complete statement on its own.'),
2265
+ restore: z.boolean().optional().describe('true = undo a previous supersede and make it current again'),
2266
+ },
2267
+ },
2268
+ async ({ record_id, reason, superseded_by, restore }) => {
2269
+ let res
2270
+ try {
2271
+ res = await fetchCortex(`${BASE}/api/records/supersede`, {
2272
+ method: 'POST',
2273
+ headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
2274
+ body: JSON.stringify({ recordId: record_id, reason, supersededBy: superseded_by, restore }),
2275
+ })
2276
+ } catch (e) {
2277
+ return toolError(`Could not reach Agnoclast: ${e.message}`)
2278
+ }
2279
+ const body = await res.json().catch(() => ({}))
2280
+ if (!res.ok || !body?.ok) {
2281
+ return toolError(`Could not supersede ${record_id}: ${body?.error ?? res.status}${body?.detail ? ` \u2014 ${body.detail}` : ''}`)
2282
+ }
2283
+ if (restore) {
2284
+ return { content: [{ type: 'text', text: `Restored ${record_id} — it is a current record again and reappears on its pages and in its container.` }] }
2285
+ }
2286
+ const l = [`Superseded ${record_id}.`]
2287
+ if (body.supersededBy) l.push(`Replaced by ${body.supersededBy}.`)
2288
+ // \u26a0 SAY WHAT DID NOT HAPPEN. The caller's next question is always whether this deleted
2289
+ // something. It did not, and a reader who assumes it did will not think to restore.
2290
+ l.push('Nothing was deleted — the row, its page attachments and its containment are intact. It is hidden from its pages, its container contents and session holds-counts, and stays searchable. `restore: true` reverses this.')
2291
+ return { content: [{ type: 'text', text: l.join('\n') }] }
2292
+ },
2293
+ )
2294
+
2256
2295
  server.registerTool(
2257
2296
  'find_sessions',
2258
2297
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.133",
3
+ "version": "0.9.134",
4
4
  "description": "Connect your AI assistant to Cortex — your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {