@theronap/cortex-mcp 0.9.102 → 0.9.103
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 +42 -1
- package/package.json +1 -1
package/lib/server.mjs
CHANGED
|
@@ -2128,7 +2128,48 @@ export async function runServer(version) {
|
|
|
2128
2128
|
const out = await res.json().catch(() => null)
|
|
2129
2129
|
if (!res.ok) return toolError(`Could not alias "${name}": ${out?.error ?? res.status}`)
|
|
2130
2130
|
if (!out) return { content: [{ type: 'text', text: `Aliased "${name}", but the server returned no body — re-read the page to confirm.` }] }
|
|
2131
|
-
|
|
2131
|
+
// Render what the server actually OBSERVED, never a fixed sentence. The old copy asserted both
|
|
2132
|
+
// "now resolves to X" and "out of the wanted-page backlog" unconditionally — it said the second
|
|
2133
|
+
// about a probe name nothing referenced, and said the first for a month about three aliases a
|
|
2134
|
+
// page-less node was shadowing (#687). The route now checks both and reports them.
|
|
2135
|
+
const lines = [`Aliased [[${out.alias}]] -> "${out.target}" (${out.target_kind}).`]
|
|
2136
|
+
if (out.resolves === true) lines.push('Verified: the name resolves to that page now.')
|
|
2137
|
+
else if (out.resolves === false) lines.push('\u26a0 WRITTEN BUT NOT RESOLVING — the alias row is saved, yet the name still does not lead to that page, so something is shadowing it. Re-running this will not help; report it rather than retrying.')
|
|
2138
|
+
else lines.push('Could not verify resolution on this call — re-read the page to confirm.')
|
|
2139
|
+
lines.push(out.backlogCleared
|
|
2140
|
+
? "It's out of the wanted-page backlog."
|
|
2141
|
+
: 'It was not in the wanted-page backlog, so nothing was cleared there.')
|
|
2142
|
+
return { content: [{ type: 'text', text: lines.join(' ') }] }
|
|
2143
|
+
},
|
|
2144
|
+
)
|
|
2145
|
+
|
|
2146
|
+
server.registerTool(
|
|
2147
|
+
'unalias_page',
|
|
2148
|
+
{
|
|
2149
|
+
title: 'Withdraw an alias',
|
|
2150
|
+
description: 'Remove a name -> page redirect created by `alias_page`, when the alias was wrong or is no longer wanted. The name stops resolving to that page and goes BACK into the org\'s wanted-page backlog, so it can be authored or re-aliased. Aliasing used to be one-way — a mistaken redirect silently sent every future reader of that name somewhere else, with no way back. This does NOT touch the target page itself, only the redirect.',
|
|
2151
|
+
inputSchema: {
|
|
2152
|
+
name: z.string().describe('the aliased [[Name]] to stop redirecting'),
|
|
2153
|
+
},
|
|
2154
|
+
},
|
|
2155
|
+
async ({ name }) => {
|
|
2156
|
+
let res
|
|
2157
|
+
try {
|
|
2158
|
+
res = await fetchCortex(`${BASE}/api/brain/alias?name=${encodeURIComponent(name)}`, {
|
|
2159
|
+
method: 'DELETE',
|
|
2160
|
+
headers: { Authorization: `Bearer ${TOKEN}` },
|
|
2161
|
+
})
|
|
2162
|
+
} catch (e) {
|
|
2163
|
+
return toolError(`Could not withdraw the alias: ${e.message}`)
|
|
2164
|
+
}
|
|
2165
|
+
const out = await res.json().catch(() => null)
|
|
2166
|
+
if (!res.ok) return toolError(`Could not withdraw "${name}": ${out?.message ?? out?.error ?? res.status}`)
|
|
2167
|
+
if (!out) return { content: [{ type: 'text', text: `Withdrew the alias for "${name}", but the server returned no body — re-read the page to confirm.` }] }
|
|
2168
|
+
const lines = [`Withdrew the alias [[${out.alias}]] in ${out.brain}.`]
|
|
2169
|
+
lines.push(out.backlogReopened
|
|
2170
|
+
? 'The name is back in the wanted-page backlog.'
|
|
2171
|
+
: 'It was not marked authored in the backlog, so nothing there changed.')
|
|
2172
|
+
return { content: [{ type: 'text', text: lines.join(' ') }] }
|
|
2132
2173
|
},
|
|
2133
2174
|
)
|
|
2134
2175
|
|
package/package.json
CHANGED