@theronap/cortex-mcp 0.9.159 → 0.9.160

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 +45 -0
  2. package/package.json +1 -1
package/lib/server.mjs CHANGED
@@ -2151,6 +2151,51 @@ function renderNudge(payload) {
2151
2151
  },
2152
2152
  )
2153
2153
 
2154
+ server.registerTool(
2155
+ 'staged_look',
2156
+ {
2157
+ title: 'Read a staged arrival before deciding where it goes',
2158
+ description: 'Read ONE staged arrival\'s envelope — sender, subject, recipients, thread, the generated summary, and the identifiers holding it — without claiming or changing anything. Use it before `place_staged_record` whenever the subject alone does not tell you WHAT KIND of thing this is. ⚠ THE SUBJECT LIES MORE OFTEN THAN YOU WOULD THINK: `staged_records` lists subjects only, and a message reading `Re: [owner/repo] fix(triage)…` is as likely to be a bot\'s deployment-status comment as a human discussing the PR — measured 2026-09-21, `vercel[bot]` accounts for 26 of the pending arrivals whose subject names that repo. The `from` header settles it in one look. ⚠ THIS IS THE ENVELOPE, NOT THE LETTER. A staged arrival stores headers and a generated summary; the message BODY is not persisted, so `bodyStored` is always false. Do not describe an arrival as something you READ — you saw who sent it and what it was titled. Looking is free, changes nothing, and needs no release.',
2159
+ inputSchema: {
2160
+ stagedId: z.string().describe('staged arrival id, from `staged_records` or the session-start arrivals block'),
2161
+ },
2162
+ },
2163
+ async ({ stagedId }) => {
2164
+ let res
2165
+ try {
2166
+ res = await fetchCortex(`${BASE}/api/staged/look?stagedId=${encodeURIComponent(stagedId)}`, {
2167
+ headers: { Authorization: `Bearer ${TOKEN}` },
2168
+ })
2169
+ } catch (e) {
2170
+ return toolError(`Could not read that staged arrival: ${e.message}`)
2171
+ }
2172
+ const out = await res.json().catch(() => null)
2173
+ if (res.status === 404) {
2174
+ return toolError(`No staged arrival ${stagedId} of yours. Staged rows are per-person and in no brain, so this means it is not yours or does not exist — the two are deliberately indistinguishable.`)
2175
+ }
2176
+ if (!res.ok) return toolError(`Could not read staged arrival ${stagedId}: ${out?.error ?? res.status}`)
2177
+
2178
+ const l = out?.look ?? {}
2179
+ const line = (label, v) => (v ? ` ${label.padEnd(9)} ${v}\n` : '')
2180
+ const held = Array.isArray(l.blockingIdentifiers) && l.blockingIdentifiers.length
2181
+ ? `\n⚠ HELD ON UNCLAIMED IDENTIFIERS — no page claims these, so it cannot finish until they are dispositioned:\n${l.blockingIdentifiers.map((i) => ` · ${i}`).join('\n')}\n`
2182
+ : ''
2183
+ return {
2184
+ content: [{
2185
+ type: 'text',
2186
+ text:
2187
+ `${l.title ?? '(untitled)'}\n` +
2188
+ ` ${l.sourceType} · arrived ${l.receivedAt ?? '?'} · occurred ${l.occurredAt ?? '?'}\n\n` +
2189
+ line('from', l.from) + line('subject', l.subject) + line('to', l.to) +
2190
+ line('account', l.account) + line('thread', l.threadId) +
2191
+ (l.summary ? `\n summary ${l.summary}\n` : '') +
2192
+ held +
2193
+ `\n⚠ This is the ENVELOPE. The message body was never stored (bodyStored: ${l.bodyStored === true}), so you have seen who sent it and what it was called — not what it says. Judge accordingly, and do not report having read it.`,
2194
+ }],
2195
+ }
2196
+ },
2197
+ )
2198
+
2154
2199
  server.registerTool(
2155
2200
  'discard_staged',
2156
2201
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.159",
3
+ "version": "0.9.160",
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": {