@theronap/agnoclast-mcp 0.9.277 → 0.9.278
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/found_documents.mjs +14 -1
- package/lib/release_gate.mjs +1 -1
- package/lib/server.mjs +29 -2
- package/package.json +1 -1
package/lib/found_documents.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// find_documents' answer (file browser, Theron 2026-10-27): every stored file the caller can see, one block
|
|
2
|
-
// per file — its page
|
|
2
|
+
// per file — its page and brain, the folder people filed it in, and why it matched a search.
|
|
3
3
|
|
|
4
4
|
const TYPE_NAMES = { sheet: 'spreadsheet', doc: 'Word', text: 'text', other: 'other' }
|
|
5
5
|
|
|
@@ -10,8 +10,21 @@ export function formatFoundDocuments(out, query) {
|
|
|
10
10
|
for (const f of files) {
|
|
11
11
|
lines.push(`${f.pinned ? '📌' : '-'} "${f.title}" — id ${f.id} · ${TYPE_NAMES[f.type] ?? f.type} · v${f.version} · ${Math.round(f.sizeBytes / 1024)} KB · ${String(f.updatedAt).slice(0, 10)}${f.updatedBy ? ` by ${f.updatedBy}` : ''}${f.readable === 'ok' ? '' : ' · not readable as text'}`)
|
|
12
12
|
lines.push(` on ${f.page ? `"${f.page.title ?? 'untitled page'}"` : 'no page (its page was deleted)'} · ${f.brain.name}`)
|
|
13
|
+
const inFolder = folderPathText(out.folders ?? [], f.folderId)
|
|
14
|
+
if (inFolder) lines.push(` in folder "${inFolder}" (folder id ${f.folderId})`)
|
|
13
15
|
if (f.match?.in === 'text' && f.match.snippet) lines.push(` matched inside: "${f.match.snippet}"`)
|
|
14
16
|
else if (f.match?.in === 'page') lines.push(' matched its page\'s title')
|
|
15
17
|
}
|
|
16
18
|
return lines.join('\n')
|
|
17
19
|
}
|
|
20
|
+
|
|
21
|
+
// "Finance › Taxes", walking up from a folder; null when the file is not in a folder the caller can see.
|
|
22
|
+
function folderPathText(folders, id) {
|
|
23
|
+
const names = []
|
|
24
|
+
const seen = new Set()
|
|
25
|
+
for (let at = folders.find((x) => x.id === id); at && !seen.has(at.id); at = folders.find((x) => x.id === at.parentId)) {
|
|
26
|
+
seen.add(at.id)
|
|
27
|
+
names.unshift(at.name)
|
|
28
|
+
}
|
|
29
|
+
return names.length ? names.join(' › ') : null
|
|
30
|
+
}
|
package/lib/release_gate.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// that web/lib/engine/release.test.ts pins to the server's registry.
|
|
6
6
|
|
|
7
7
|
/** Tools any release flag gates — hidden when the server cannot be asked. Mirror of allGatedTools(). */
|
|
8
|
-
export const GATED_FALLBACK = ['arrivals', 'attach_document', 'document_diff', 'export_page', 'file_arrival', 'find_documents', 'get_document', 'import_document_as_page', 'intake_shadow', 'list_documents', 'my_messages', 'pin_document', 'read_conversation', 'read_document', 'send_message', 'set_manager', 'upload_document_version']
|
|
8
|
+
export const GATED_FALLBACK = ['arrivals', 'attach_document', 'document_diff', 'export_page', 'file_arrival', 'file_document', 'find_documents', 'get_document', 'import_document_as_page', 'intake_shadow', 'list_documents', 'my_messages', 'pin_document', 'read_conversation', 'read_document', 'send_message', 'set_manager', 'upload_document_version']
|
|
9
9
|
|
|
10
10
|
export const RELEASE_FETCH_TIMEOUT_MS = 2500
|
|
11
11
|
|
package/lib/server.mjs
CHANGED
|
@@ -7506,23 +7506,25 @@ function renderNudge(payload) {
|
|
|
7506
7506
|
'find_documents',
|
|
7507
7507
|
{
|
|
7508
7508
|
title: 'Find stored files you can see',
|
|
7509
|
-
description: 'Search every file kept in Agnoclast that you can see, across all pages and brains — no page needed. Matches the file name, the page it lives on, or the words inside it (a match inside the file shows the words around it). Newest first; filter by type, brain, page, pinned, or changed since. Each file names its page
|
|
7509
|
+
description: 'Search every file kept in Agnoclast that you can see, across all pages and brains — no page needed. Matches the file name, the page it lives on, or the words inside it (a match inside the file shows the words around it). Newest first; filter by type, brain, page, folder, pinned, or changed since. Each file names its page and brain, and the folder people filed it in, if any (file_document files one). Then read_document to read one, document_diff to see what changed, get_document to download it. list_documents is the one-page view.',
|
|
7510
7510
|
inputSchema: {
|
|
7511
7511
|
query: z.string().optional().describe('words to find in the file name, its page\'s title, or the text inside the file'),
|
|
7512
7512
|
type: z.enum(['sheet', 'doc', 'text', 'other']).optional().describe('sheet = Excel/spreadsheet, doc = Word, text = CSV/plain text'),
|
|
7513
7513
|
brain: z.string().optional().describe('only this brain (its name or id)'),
|
|
7514
7514
|
page: z.string().optional().describe('only files on this page (a document id)'),
|
|
7515
|
+
folder: z.string().optional().describe('only files in this folder or the folders inside it (a folder id, printed as "folder id …")'),
|
|
7515
7516
|
pinned: z.boolean().optional().describe('true = pinned files only'),
|
|
7516
7517
|
changed_since: z.string().optional().describe('ISO date: only files with a version at or after it'),
|
|
7517
7518
|
limit: z.number().int().min(1).max(500).optional().describe('default 50'),
|
|
7518
7519
|
},
|
|
7519
7520
|
},
|
|
7520
|
-
async ({ query, type, brain, page, pinned, changed_since, limit }) => {
|
|
7521
|
+
async ({ query, type, brain, page, folder, pinned, changed_since, limit }) => {
|
|
7521
7522
|
const q = new URLSearchParams({ limit: String(limit ?? 50) })
|
|
7522
7523
|
if (query) q.set('q', query)
|
|
7523
7524
|
if (type) q.set('type', type)
|
|
7524
7525
|
if (brain) q.set('brain', brain)
|
|
7525
7526
|
if (page) q.set('page', page)
|
|
7527
|
+
if (folder) q.set('folder', folder)
|
|
7526
7528
|
if (pinned !== undefined) q.set('pinned', String(pinned))
|
|
7527
7529
|
if (changed_since) q.set('since', changed_since)
|
|
7528
7530
|
let res
|
|
@@ -7533,6 +7535,31 @@ function renderNudge(payload) {
|
|
|
7533
7535
|
},
|
|
7534
7536
|
)
|
|
7535
7537
|
|
|
7538
|
+
server.registerTool(
|
|
7539
|
+
'file_document',
|
|
7540
|
+
{
|
|
7541
|
+
title: 'Put a stored file in a folder',
|
|
7542
|
+
description: 'File a stored file in one of its brain\'s folders (the folders people make on the Files tab, shared by everyone in the brain), or take it out of its folder. A folder is only a label: it never changes who can open the file — the file\'s page still decides. A file is in at most one folder. Get file_id from find_documents or list_documents; name the folder or pass the "folder id …" find_documents prints.',
|
|
7543
|
+
inputSchema: {
|
|
7544
|
+
file_id: z.string().describe('the stored file\'s id'),
|
|
7545
|
+
folder: z.string().nullable().describe('the folder\'s name (in the file\'s brain) or its id; null to take the file out of its folder'),
|
|
7546
|
+
},
|
|
7547
|
+
},
|
|
7548
|
+
async ({ file_id, folder }) => {
|
|
7549
|
+
let res
|
|
7550
|
+
try {
|
|
7551
|
+
res = await fetchCortex(`${BASE}/api/stored-files/${encodeURIComponent(file_id)}/folder`, {
|
|
7552
|
+
method: 'POST', headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
7553
|
+
body: JSON.stringify({ folderId: folder ?? null }),
|
|
7554
|
+
})
|
|
7555
|
+
} catch (e) { return toolError(`Could not file it: ${e.message}`) }
|
|
7556
|
+
if (!res.ok) return docFail('file it', res)
|
|
7557
|
+
const out = await res.json()
|
|
7558
|
+
if (!out.changed) return { content: [{ type: 'text', text: folder ? `It was already in that folder.` : 'It was not in a folder.' }] }
|
|
7559
|
+
return { content: [{ type: 'text', text: folder ? `Filed it in "${folder}" (folder id ${out.folderId}).` : 'Took it out of its folder.' }] }
|
|
7560
|
+
},
|
|
7561
|
+
)
|
|
7562
|
+
|
|
7536
7563
|
server.registerTool(
|
|
7537
7564
|
'read_document',
|
|
7538
7565
|
{
|
package/package.json
CHANGED