@gwdn/nexus-mcp 0.7.0 → 0.8.1
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/dist/server.d.ts +7 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +25 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/classify-document.d.ts +38 -0
- package/dist/tools/classify-document.d.ts.map +1 -0
- package/dist/tools/classify-document.js +45 -0
- package/dist/tools/classify-document.js.map +1 -0
- package/dist/tools/delete-document.d.ts +29 -0
- package/dist/tools/delete-document.d.ts.map +1 -0
- package/dist/tools/delete-document.js +34 -0
- package/dist/tools/delete-document.js.map +1 -0
- package/dist/tools/directives.d.ts +135 -0
- package/dist/tools/directives.d.ts.map +1 -0
- package/dist/tools/directives.js +231 -0
- package/dist/tools/directives.js.map +1 -0
- package/dist/tools/reviews.d.ts +1 -1
- package/dist/tools/update-document.d.ts +38 -0
- package/dist/tools/update-document.d.ts.map +1 -0
- package/dist/tools/update-document.js +51 -0
- package/dist/tools/update-document.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/server.test.ts +2 -2
- package/src/server.ts +110 -1
- package/src/tools/classify-document.ts +55 -0
- package/src/tools/delete-document.ts +43 -0
- package/src/tools/directives.ts +303 -0
- package/src/tools/update-document.ts +66 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* doc_update -- Layer 2 Coordination
|
|
3
|
+
*
|
|
4
|
+
* Update title, body, or source_url of an ingest item.
|
|
5
|
+
* Supports full body replacement or append mode.
|
|
6
|
+
* Delegates to POST /api/mcp/documents (action: doc_update).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
import { nexusPost } from '../nexus-api.js'
|
|
11
|
+
|
|
12
|
+
export const updateDocumentSchema = {
|
|
13
|
+
document_id: z.string().uuid().describe('Document UUID to update'),
|
|
14
|
+
title: z.string().max(500).optional().describe('New document title'),
|
|
15
|
+
body: z
|
|
16
|
+
.string()
|
|
17
|
+
.max(100_000)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('New document body (replaces existing content)'),
|
|
20
|
+
source_url: z.string().url().optional().describe('Updated source URL'),
|
|
21
|
+
append_body: z
|
|
22
|
+
.string()
|
|
23
|
+
.max(100_000)
|
|
24
|
+
.optional()
|
|
25
|
+
.describe(
|
|
26
|
+
'Content to append to existing body (ignored if body is also provided)',
|
|
27
|
+
),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type UpdateDocumentArgs = {
|
|
31
|
+
document_id: string
|
|
32
|
+
title?: string
|
|
33
|
+
body?: string
|
|
34
|
+
source_url?: string
|
|
35
|
+
append_body?: string
|
|
36
|
+
user_id: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function updateDocument(args: UpdateDocumentArgs) {
|
|
40
|
+
const result = await nexusPost('/api/mcp/documents', {
|
|
41
|
+
action: 'doc_update',
|
|
42
|
+
document_id: args.document_id,
|
|
43
|
+
title: args.title,
|
|
44
|
+
body: args.body,
|
|
45
|
+
source_url: args.source_url,
|
|
46
|
+
append_body: args.append_body,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
if (!result.ok) {
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: 'text' as const,
|
|
54
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
isError: true,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
content: [
|
|
63
|
+
{ type: 'text' as const, text: JSON.stringify(result.data, null, 2) },
|
|
64
|
+
],
|
|
65
|
+
}
|
|
66
|
+
}
|