@theronap/cortex-mcp 0.9.20 → 0.9.21
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/lib/server.mjs +33 -0
- package/package.json +1 -1
package/lib/server.mjs
CHANGED
|
@@ -464,6 +464,39 @@ export async function runServer(version) {
|
|
|
464
464
|
},
|
|
465
465
|
)
|
|
466
466
|
|
|
467
|
+
server.registerTool(
|
|
468
|
+
'set_page_validity',
|
|
469
|
+
{
|
|
470
|
+
title: 'Mark a wiki page current / superseded / historical',
|
|
471
|
+
description: 'Set the CURRENCY of one of YOUR OWN authored pages so the brain can filter out stale info: "current" (reflects reality now — the default), "superseded" (replaced by a newer page — pass superseded_by with that page\'s name), or "historical" (kept for the record, no longer current). Optionally set modality: "reality" (as-built), "plan" (intended, not yet real), or "construction" (being built now). Call this the moment your understanding changes that a page is no longer the live truth — e.g. right after you author the new reality, mark the old page superseded. Owner-only.',
|
|
472
|
+
inputSchema: {
|
|
473
|
+
kind: z.enum(['project', 'person', 'org', 'user']).describe('the page kind'),
|
|
474
|
+
name: z.string().describe('the exact page name'),
|
|
475
|
+
validity: z.enum(['current', 'superseded', 'historical']).describe('the currency state'),
|
|
476
|
+
modality: z.enum(['reality', 'plan', 'construction']).optional().describe('what the page describes (optional)'),
|
|
477
|
+
superseded_by: z.string().optional().describe('for superseded: the name of the page that replaced it'),
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
async ({ kind, name, validity, modality, superseded_by }) => {
|
|
481
|
+
let res
|
|
482
|
+
try {
|
|
483
|
+
res = await fetchCortex(`${BASE}/api/brain/validity`, {
|
|
484
|
+
method: 'POST',
|
|
485
|
+
headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
486
|
+
body: JSON.stringify({ kind, name, validity, modality, superseded_by }),
|
|
487
|
+
})
|
|
488
|
+
} catch (e) {
|
|
489
|
+
return { content: [{ type: 'text', text: `Could not set validity: ${e.message}` }] }
|
|
490
|
+
}
|
|
491
|
+
if (!res.ok) {
|
|
492
|
+
const d = classify(res.status, res.headers.get('content-type'), await res.text(), res.headers.get('x-vercel-id'))
|
|
493
|
+
return { content: [{ type: 'text', text: `Could not set validity: ${d.message}` }] }
|
|
494
|
+
}
|
|
495
|
+
const out = await res.json()
|
|
496
|
+
return { content: [{ type: 'text', text: `Done — "${out.name}" is now ${out.validity}${out.modality ? ` / ${out.modality}` : ''} (${out.docs_updated} tier-doc(s) updated).` }] }
|
|
497
|
+
},
|
|
498
|
+
)
|
|
499
|
+
|
|
467
500
|
// ── File requests: ask the owner for a record's FULL original (lives on their machine) ──
|
|
468
501
|
const fail = (verb, res) => async () =>
|
|
469
502
|
({ content: [{ type: 'text', text: `Could not ${verb}: ${classify(res.status, res.headers.get('content-type'), await res.text(), res.headers.get('x-vercel-id')).message}` }] })
|