@payloadcms/plugin-mcp 4.0.0-internal.a0ef1b8 → 4.0.0-internal.a1317b2
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/LICENSE.md +1 -1
- package/bin.js +7 -0
- package/dist/defaultAccess.d.ts +3 -0
- package/dist/defaultAccess.d.ts.map +1 -0
- package/dist/defaultAccess.js +3 -0
- package/dist/defaultAccess.js.map +1 -0
- package/dist/defineTool.d.ts +8 -8
- package/dist/defineTool.d.ts.map +1 -1
- package/dist/endpoint/access.d.ts +12 -5
- package/dist/endpoint/access.d.ts.map +1 -1
- package/dist/endpoint/access.js +75 -88
- package/dist/endpoint/access.js.map +1 -1
- package/dist/endpoint/index.d.ts +1 -1
- package/dist/endpoint/index.d.ts.map +1 -1
- package/dist/endpoint/index.js +68 -17
- package/dist/endpoint/index.js.map +1 -1
- package/dist/exports/client.d.ts +1 -1
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/internal.d.ts +2 -0
- package/dist/exports/internal.d.ts.map +1 -0
- package/dist/exports/internal.js +3 -0
- package/dist/exports/internal.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -20
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts +5 -5
- package/dist/mcp/buildMcpServer.d.ts.map +1 -1
- package/dist/mcp/buildMcpServer.js +145 -80
- package/dist/mcp/buildMcpServer.js.map +1 -1
- package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/authTools.js +122 -61
- package/dist/mcp/builtin/collections/authTools.js.map +1 -1
- package/dist/mcp/builtin/collections/countTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countTool.js +63 -0
- package/dist/mcp/builtin/collections/countTool.js.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js +60 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/createTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/createTool.js +111 -68
- package/dist/mcp/builtin/collections/createTool.js.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.js +51 -61
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -1
- package/dist/mcp/builtin/collections/duplicateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.js +86 -0
- package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts +28 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.js +123 -0
- package/dist/mcp/builtin/collections/fileInput.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js +86 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js +77 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findTool.js +55 -72
- package/dist/mcp/builtin/collections/findTool.js.map +1 -1
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js +74 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js +84 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +87 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js +69 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/updateTool.js +104 -136
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -1
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js +55 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js.map +1 -0
- package/dist/mcp/builtin/formatEntityError.d.ts +16 -0
- package/dist/mcp/builtin/formatEntityError.d.ts.map +1 -0
- package/dist/mcp/builtin/formatEntityError.js +55 -0
- package/dist/mcp/builtin/formatEntityError.js.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts +2 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.js +69 -0
- package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js +60 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/findTool.js +27 -36
- package/dist/mcp/builtin/globals/findTool.js.map +1 -1
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js +68 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js +78 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +65 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js +70 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/updateTool.js +44 -62
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -1
- package/dist/mcp/builtinTools.d.ts +150 -19
- package/dist/mcp/builtinTools.d.ts.map +1 -1
- package/dist/mcp/builtinTools.js +125 -20
- package/dist/mcp/builtinTools.js.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts +0 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.js +124 -58
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -1
- package/dist/stdio.d.ts +3 -3
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +84 -46
- package/dist/stdio.js.map +1 -1
- package/dist/types.d.ts +114 -112
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -4
- package/dist/types.js.map +1 -1
- package/dist/utils/camelCase.d.ts.map +1 -1
- package/dist/utils/getPluginConfig.d.ts +1 -1
- package/dist/utils/getPluginConfig.js +1 -1
- package/dist/utils/getPluginConfig.js.map +1 -1
- package/dist/utils/resolveProjectRoot.d.ts.map +1 -1
- package/dist/utils/toStandardSchema.d.ts.map +1 -1
- package/package.json +11 -18
- package/src/defaultAccess.ts +3 -0
- package/src/endpoint/access.ts +80 -101
- package/src/endpoint/index.ts +58 -16
- package/src/exports/client.ts +2 -1
- package/src/exports/internal.ts +1 -0
- package/src/index.ts +12 -20
- package/src/mcp/buildMcpServer.ts +179 -114
- package/src/mcp/builtin/collections/authTools.ts +119 -75
- package/src/mcp/builtin/collections/countTool.ts +61 -0
- package/src/mcp/builtin/collections/countVersionsTool.ts +60 -0
- package/src/mcp/builtin/collections/createTool.ts +104 -88
- package/src/mcp/builtin/collections/deleteTool.ts +48 -74
- package/src/mcp/builtin/collections/duplicateTool.ts +83 -0
- package/src/mcp/builtin/collections/fileInput.spec.ts +93 -0
- package/src/mcp/builtin/collections/fileInput.ts +169 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +67 -0
- package/src/mcp/builtin/collections/findTool.ts +55 -108
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +66 -0
- package/src/mcp/builtin/collections/findVersionsTool.ts +83 -0
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +80 -0
- package/src/mcp/builtin/collections/restoreVersionTool.ts +65 -0
- package/src/mcp/builtin/collections/updateTool.ts +101 -142
- package/src/mcp/builtin/collections/uploadInstructionsTool.ts +64 -0
- package/src/mcp/builtin/formatEntityError.ts +77 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +68 -0
- package/src/mcp/builtin/globals/countVersionsTool.ts +60 -0
- package/src/mcp/builtin/globals/findTool.ts +27 -57
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +64 -0
- package/src/mcp/builtin/globals/findVersionsTool.ts +69 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +63 -0
- package/src/mcp/builtin/globals/restoreVersionTool.ts +68 -0
- package/src/mcp/builtin/globals/updateTool.ts +51 -79
- package/src/mcp/builtinTools.ts +118 -41
- package/src/mcp/sanitizeMCPConfig.ts +120 -78
- package/src/stdio.ts +79 -46
- package/src/types.ts +130 -117
- package/src/utils/getPluginConfig.ts +1 -1
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- package/dist/collection/getAccessField.d.ts +0 -12
- package/dist/collection/getAccessField.d.ts.map +0 -1
- package/dist/collection/getAccessField.js +0 -57
- package/dist/collection/getAccessField.js.map +0 -1
- package/dist/collection/index.d.ts +0 -6
- package/dist/collection/index.d.ts.map +0 -1
- package/dist/collection/index.js +0 -60
- package/dist/collection/index.js.map +0 -1
- package/dist/components/AccessField/index.client.d.ts +0 -10
- package/dist/components/AccessField/index.client.d.ts.map +0 -1
- package/dist/components/AccessField/index.client.js +0 -305
- package/dist/components/AccessField/index.client.js.map +0 -1
- package/dist/components/AccessField/index.css +0 -93
- package/dist/utils/getVirtualFieldNames.d.ts +0 -14
- package/dist/utils/getVirtualFieldNames.d.ts.map +0 -1
- package/dist/utils/getVirtualFieldNames.js +0 -35
- package/dist/utils/getVirtualFieldNames.js.map +0 -1
- package/dist/utils/localAPIDefaults.d.ts +0 -20
- package/dist/utils/localAPIDefaults.d.ts.map +0 -1
- package/dist/utils/localAPIDefaults.js +0 -19
- package/dist/utils/localAPIDefaults.js.map +0 -1
- package/dist/utils/schemaConversion/buildToolInput.d.ts +0 -29
- package/dist/utils/schemaConversion/buildToolInput.d.ts.map +0 -1
- package/dist/utils/schemaConversion/buildToolInput.js +0 -51
- package/dist/utils/schemaConversion/buildToolInput.js.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +0 -7
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js +0 -20
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +0 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +0 -15
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js +0 -464
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +0 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +0 -158
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +0 -1
- package/dist/utils/transformPointDataToPayload.d.ts +0 -7
- package/dist/utils/transformPointDataToPayload.d.ts.map +0 -1
- package/dist/utils/transformPointDataToPayload.js +0 -28
- package/dist/utils/transformPointDataToPayload.js.map +0 -1
- package/src/@types/assets.d.ts +0 -3
- package/src/collection/getAccessField.ts +0 -64
- package/src/collection/index.ts +0 -64
- package/src/components/AccessField/index.client.tsx +0 -344
- package/src/components/AccessField/index.css +0 -93
- package/src/utils/getVirtualFieldNames.ts +0 -53
- package/src/utils/localAPIDefaults.ts +0 -22
- package/src/utils/schemaConversion/buildToolInput.ts +0 -68
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +0 -27
- package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +0 -103
- package/src/utils/schemaConversion/sanitizeEntitySchema.ts +0 -529
- package/src/utils/transformPointDataToPayload.ts +0 -40
|
@@ -1,90 +1,133 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createDocumentsInputSchema, getCollectionVirtualFieldNames, hasDraftValidationEnabled, stripVirtualFields, transformPointDataToPayload, validateCollectionData } from 'payload';
|
|
2
|
+
import { defaultAccess } from '../../../defaultAccess.js';
|
|
2
3
|
import { defineCollectionTool } from '../../../defineTool.js';
|
|
3
4
|
import { getLogger } from '../../../utils/getLogger.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { formatEntityError } from '../formatEntityError.js';
|
|
6
|
+
import { fileInputSchema, resolveFile } from './fileInput.js';
|
|
7
|
+
const DEFAULT_DESCRIPTION = 'Create one or more documents. Each can have different data or a file. Prefer uploadReference after upload, externalURL for URLs, or base64 for small local files.';
|
|
8
|
+
export const createDocumentsTool = defineCollectionTool({
|
|
9
|
+
access: (args)=>defaultAccess(args) && Boolean(args.permissions?.collections?.[args.slug]?.create),
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
idempotentHint: false,
|
|
13
|
+
openWorldHint: false,
|
|
14
|
+
readOnlyHint: false,
|
|
15
|
+
title: 'Create Documents'
|
|
16
|
+
},
|
|
11
17
|
description: DEFAULT_DESCRIPTION,
|
|
12
|
-
input: ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
fallbackLocale: z.string().describe('Optional: fallback locale code to use when requested locale is not available').optional(),
|
|
17
|
-
locale: z.string().describe('Optional: locale code to create the document in (e.g., "en", "es"). Defaults to the default locale').optional(),
|
|
18
|
-
select: z.string().describe('Optional: define exactly which fields you\'d like to create (JSON), e.g., \'{"title": "My Post"}\'').optional()
|
|
19
|
-
},
|
|
20
|
-
dataDescription: 'The document fields to create',
|
|
21
|
-
dataSchema: sanitizeEntitySchema(collectionSchema)
|
|
22
|
-
})
|
|
23
|
-
}).handler(async ({ authorizedMCP, collectionSlug, input, req })=>{
|
|
18
|
+
input: createDocumentsInputSchema({
|
|
19
|
+
file: fileInputSchema
|
|
20
|
+
})
|
|
21
|
+
}).handler(async ({ slug, authorizedMCP, input, req })=>{
|
|
24
22
|
const payload = req.payload;
|
|
23
|
+
const collectionConfig = payload.collections[slug]?.config;
|
|
25
24
|
const logger = getLogger({
|
|
26
25
|
payload
|
|
27
26
|
});
|
|
28
|
-
const {
|
|
29
|
-
|
|
27
|
+
const { depth, documents, draft, fallbackLocale, locale, populate, publishAllLocales, select } = input;
|
|
28
|
+
const shouldUsePartialSchema = draft === true && collectionConfig !== undefined && !hasDraftValidationEnabled(collectionConfig);
|
|
29
|
+
logger.info(`Creating ${documents.length} documents in collection: ${slug}`);
|
|
30
30
|
try {
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
let
|
|
35
|
-
|
|
31
|
+
const virtualFieldNames = getCollectionVirtualFieldNames(payload.config, slug);
|
|
32
|
+
const docs = [];
|
|
33
|
+
const errors = [];
|
|
34
|
+
let validationSchema;
|
|
35
|
+
for (const [index, document] of documents.entries()){
|
|
36
36
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
const inputData = stripVirtualFields(document.data, virtualFieldNames);
|
|
38
|
+
validateCollectionData({
|
|
39
|
+
slug,
|
|
40
|
+
data: inputData,
|
|
41
|
+
partial: shouldUsePartialSchema,
|
|
42
|
+
req
|
|
43
|
+
});
|
|
44
|
+
const parsedData = transformPointDataToPayload(inputData);
|
|
45
|
+
const file = await resolveFile({
|
|
46
|
+
slug,
|
|
47
|
+
input: document.file,
|
|
48
|
+
req
|
|
49
|
+
});
|
|
50
|
+
const result = await payload.create({
|
|
51
|
+
collection: slug,
|
|
52
|
+
data: parsedData,
|
|
53
|
+
depth,
|
|
54
|
+
draft,
|
|
55
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
56
|
+
populate,
|
|
57
|
+
publishAllLocales,
|
|
58
|
+
req,
|
|
59
|
+
...file ? {
|
|
60
|
+
file
|
|
61
|
+
} : {},
|
|
62
|
+
...locale ? {
|
|
63
|
+
locale
|
|
64
|
+
} : {},
|
|
65
|
+
...fallbackLocale !== undefined ? {
|
|
66
|
+
fallbackLocale
|
|
67
|
+
} : {},
|
|
68
|
+
...select ? {
|
|
69
|
+
select
|
|
70
|
+
} : {}
|
|
71
|
+
});
|
|
72
|
+
docs.push({
|
|
73
|
+
doc: result,
|
|
74
|
+
index
|
|
75
|
+
});
|
|
76
|
+
} catch (error) {
|
|
77
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
78
|
+
const formattedError = formatEntityError({
|
|
79
|
+
slug,
|
|
80
|
+
action: 'creating',
|
|
81
|
+
entity: 'collection',
|
|
82
|
+
error,
|
|
83
|
+
req
|
|
84
|
+
});
|
|
85
|
+
const structuredContent = formattedError.structuredContent;
|
|
86
|
+
const schema = structuredContent?.schema;
|
|
87
|
+
const errorContent = formattedError.content[0];
|
|
88
|
+
const formattedMessage = errorContent?.type === 'text' ? errorContent.text.split('\n\nUse this schema')[0] ?? message : message;
|
|
89
|
+
if (!validationSchema && schema && typeof schema === 'object') {
|
|
90
|
+
validationSchema = schema;
|
|
91
|
+
}
|
|
92
|
+
logger.error(`Error creating document at index ${index} in ${slug}: ${message}`);
|
|
93
|
+
errors.push({
|
|
94
|
+
index,
|
|
95
|
+
message: formattedMessage
|
|
96
|
+
});
|
|
48
97
|
}
|
|
49
98
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
fallbackLocale
|
|
62
|
-
} : {},
|
|
63
|
-
...selectClause ? {
|
|
64
|
-
select: selectClause
|
|
65
|
-
} : {}
|
|
66
|
-
});
|
|
67
|
-
logger.info(`Successfully created document in ${collectionSlug} with ID: ${result.id}`);
|
|
99
|
+
const batchResult = {
|
|
100
|
+
docs,
|
|
101
|
+
errors
|
|
102
|
+
};
|
|
103
|
+
const retryMessage = errors.length > 0 ? '\nRetry failed indexes only.' : '';
|
|
104
|
+
const schemaMessage = validationSchema ? `\n\nUse this schema for data:\n\`\`\`json\n${JSON.stringify(validationSchema)}\n\`\`\`` : '';
|
|
105
|
+
const structuredContent = validationSchema ? {
|
|
106
|
+
...batchResult,
|
|
107
|
+
schema: validationSchema
|
|
108
|
+
} : batchResult;
|
|
109
|
+
logger.info(`Created ${docs.length} of ${documents.length} documents in ${slug}`);
|
|
68
110
|
return {
|
|
69
111
|
content: [
|
|
70
112
|
{
|
|
71
113
|
type: 'text',
|
|
72
|
-
text: `
|
|
114
|
+
text: `Created ${docs.length} of ${documents.length} documents in collection "${slug}".${retryMessage}\nResults:\n\`\`\`json\n${JSON.stringify(batchResult)}\n\`\`\`${schemaMessage}`
|
|
73
115
|
}
|
|
74
116
|
],
|
|
75
|
-
doc:
|
|
117
|
+
doc: structuredContent,
|
|
118
|
+
isError: docs.length === 0 && errors.length > 0,
|
|
119
|
+
structuredContent
|
|
76
120
|
};
|
|
77
121
|
} catch (error) {
|
|
78
|
-
const
|
|
79
|
-
logger.error(`Error creating
|
|
80
|
-
return {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
122
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
123
|
+
logger.error(`Error creating documents in ${slug}: ${message}`);
|
|
124
|
+
return formatEntityError({
|
|
125
|
+
slug,
|
|
126
|
+
action: 'creating',
|
|
127
|
+
entity: 'collection',
|
|
128
|
+
error,
|
|
129
|
+
req
|
|
130
|
+
});
|
|
88
131
|
}
|
|
89
132
|
});
|
|
90
133
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/mcp/builtin/collections/createTool.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/mcp/builtin/collections/createTool.ts"],"sourcesContent":["import {\n createDocumentsInputSchema,\n getCollectionVirtualFieldNames,\n hasDraftValidationEnabled,\n stripVirtualFields,\n transformPointDataToPayload,\n validateCollectionData,\n} from 'payload'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineCollectionTool } from '../../../defineTool.js'\nimport { getLogger } from '../../../utils/getLogger.js'\nimport { formatEntityError } from '../formatEntityError.js'\nimport { fileInputSchema, resolveFile } from './fileInput.js'\n\nconst DEFAULT_DESCRIPTION =\n 'Create one or more documents. Each can have different data or a file. Prefer uploadReference after upload, externalURL for URLs, or base64 for small local files.'\n\nexport const createDocumentsTool = defineCollectionTool({\n access: (args) =>\n defaultAccess(args) && Boolean(args.permissions?.collections?.[args.slug]?.create),\n annotations: {\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: false,\n readOnlyHint: false,\n title: 'Create Documents',\n },\n description: DEFAULT_DESCRIPTION,\n input: createDocumentsInputSchema({ file: fileInputSchema }),\n}).handler(async ({ slug, authorizedMCP, input, req }) => {\n const payload = req.payload\n const collectionConfig = payload.collections[slug]?.config\n const logger = getLogger({ payload })\n const { depth, documents, draft, fallbackLocale, locale, populate, publishAllLocales, select } =\n input\n const shouldUsePartialSchema =\n draft === true && collectionConfig !== undefined && !hasDraftValidationEnabled(collectionConfig)\n\n logger.info(`Creating ${documents.length} documents in collection: ${slug}`)\n\n try {\n const virtualFieldNames = getCollectionVirtualFieldNames(payload.config, slug)\n const docs: Array<{ doc: Record<string, unknown>; index: number }> = []\n const errors: Array<{ index: number; message: string }> = []\n let validationSchema: Record<string, unknown> | undefined\n\n for (const [index, document] of documents.entries()) {\n try {\n const inputData = stripVirtualFields(document.data, virtualFieldNames)\n validateCollectionData({\n slug,\n data: inputData,\n partial: shouldUsePartialSchema,\n req,\n })\n\n const parsedData = transformPointDataToPayload(inputData)\n const file = await resolveFile({ slug, input: document.file, req })\n const result = await payload.create({\n collection: slug,\n data: parsedData,\n depth,\n draft,\n overrideAccess: authorizedMCP.overrideAccess,\n populate,\n publishAllLocales,\n req,\n ...(file ? { file } : {}),\n ...(locale ? { locale } : {}),\n ...(fallbackLocale !== undefined ? { fallbackLocale } : {}),\n ...(select ? { select } : {}),\n })\n\n docs.push({ doc: result as Record<string, unknown>, index })\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error'\n const formattedError = formatEntityError({\n slug,\n action: 'creating',\n entity: 'collection',\n error,\n req,\n })\n const structuredContent = formattedError.structuredContent as\n | { schema?: unknown }\n | undefined\n const schema = structuredContent?.schema\n const errorContent = formattedError.content[0]\n const formattedMessage =\n errorContent?.type === 'text'\n ? (errorContent.text.split('\\n\\nUse this schema')[0] ?? message)\n : message\n\n if (!validationSchema && schema && typeof schema === 'object') {\n validationSchema = schema as Record<string, unknown>\n }\n\n logger.error(`Error creating document at index ${index} in ${slug}: ${message}`)\n errors.push({ index, message: formattedMessage })\n }\n }\n\n const batchResult = { docs, errors }\n const retryMessage = errors.length > 0 ? '\\nRetry failed indexes only.' : ''\n const schemaMessage = validationSchema\n ? `\\n\\nUse this schema for data:\\n\\`\\`\\`json\\n${JSON.stringify(validationSchema)}\\n\\`\\`\\``\n : ''\n const structuredContent = validationSchema\n ? { ...batchResult, schema: validationSchema }\n : batchResult\n\n logger.info(`Created ${docs.length} of ${documents.length} documents in ${slug}`)\n\n return {\n content: [\n {\n type: 'text',\n text: `Created ${docs.length} of ${documents.length} documents in collection \"${slug}\".${retryMessage}\\nResults:\\n\\`\\`\\`json\\n${JSON.stringify(batchResult)}\\n\\`\\`\\`${schemaMessage}`,\n },\n ],\n doc: structuredContent as unknown as Record<string, unknown>,\n isError: docs.length === 0 && errors.length > 0,\n structuredContent,\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error'\n\n logger.error(`Error creating documents in ${slug}: ${message}`)\n return formatEntityError({ slug, action: 'creating', entity: 'collection', error, req })\n }\n})\n"],"names":["createDocumentsInputSchema","getCollectionVirtualFieldNames","hasDraftValidationEnabled","stripVirtualFields","transformPointDataToPayload","validateCollectionData","defaultAccess","defineCollectionTool","getLogger","formatEntityError","fileInputSchema","resolveFile","DEFAULT_DESCRIPTION","createDocumentsTool","access","args","Boolean","permissions","collections","slug","create","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","file","handler","authorizedMCP","req","payload","collectionConfig","config","logger","depth","documents","draft","fallbackLocale","locale","populate","publishAllLocales","select","shouldUsePartialSchema","undefined","info","length","virtualFieldNames","docs","errors","validationSchema","index","document","entries","inputData","data","partial","parsedData","result","collection","overrideAccess","push","doc","error","message","Error","formattedError","action","entity","structuredContent","schema","errorContent","content","formattedMessage","type","text","split","batchResult","retryMessage","schemaMessage","JSON","stringify","isError"],"mappings":"AAAA,SACEA,0BAA0B,EAC1BC,8BAA8B,EAC9BC,yBAAyB,EACzBC,kBAAkB,EAClBC,2BAA2B,EAC3BC,sBAAsB,QACjB,UAAS;AAEhB,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,SAAS,QAAQ,8BAA6B;AACvD,SAASC,iBAAiB,QAAQ,0BAAyB;AAC3D,SAASC,eAAe,EAAEC,WAAW,QAAQ,iBAAgB;AAE7D,MAAMC,sBACJ;AAEF,OAAO,MAAMC,sBAAsBN,qBAAqB;IACtDO,QAAQ,CAACC,OACPT,cAAcS,SAASC,QAAQD,KAAKE,WAAW,EAAEC,aAAa,CAACH,KAAKI,IAAI,CAAC,EAAEC;IAC7EC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAaf;IACbgB,OAAO5B,2BAA2B;QAAE6B,MAAMnB;IAAgB;AAC5D,GAAGoB,OAAO,CAAC,OAAO,EAAEX,IAAI,EAAEY,aAAa,EAAEH,KAAK,EAAEI,GAAG,EAAE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,MAAM,CAAC,QAAQ,EAAE3B,KAAKF,MAAM,CAAC,IAAI,EAAEV,UAAUU,MAAM,CAAC,0BAA0B,EAAE7B,KAAK,EAAE,EAAE6D,aAAa,wBAAwB,EAAEE,KAAKC,SAAS,CAACJ,aAAa,QAAQ,EAAEE,eAAe;gBACvL;aACD;YACDjB,KAAKO;YACLa,SAASlC,KAAKF,MAAM,KAAK,KAAKG,OAAOH,MAAM,GAAG;YAC9CuB;QACF;IACF,EAAE,OAAON,OAAO;QACd,MAAMC,UAAUD,iBAAiBE,QAAQF,MAAMC,OAAO,GAAG;QAEzD9B,OAAO6B,KAAK,CAAC,CAAC,4BAA4B,EAAE9C,KAAK,EAAE,EAAE+C,SAAS;QAC9D,OAAOzD,kBAAkB;YAAEU;YAAMkD,QAAQ;YAAYC,QAAQ;YAAcL;YAAOjC;QAAI;IACxF;AACF,GAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const deleteDocumentsTool: import("../../../types.js").CollectionTool;
|
|
2
2
|
//# sourceMappingURL=deleteTool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/collections/deleteTool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deleteTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/collections/deleteTool.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB,4CAuF9B,CAAA"}
|
|
@@ -1,29 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { deleteDocumentsInputSchema } from 'payload';
|
|
2
|
+
import { defaultAccess } from '../../../defaultAccess.js';
|
|
2
3
|
import { defineCollectionTool } from '../../../defineTool.js';
|
|
3
4
|
import { getLogger } from '../../../utils/getLogger.js';
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const DEFAULT_DESCRIPTION = 'Delete documents in any collection by passing the collection slug and ID or where clause.';
|
|
6
|
+
export const deleteDocumentsTool = defineCollectionTool({
|
|
7
|
+
access: (args)=>defaultAccess(args) && Boolean(args.permissions?.collections?.[args.slug]?.delete),
|
|
8
|
+
annotations: {
|
|
9
|
+
destructiveHint: true,
|
|
10
|
+
idempotentHint: false,
|
|
11
|
+
openWorldHint: false,
|
|
12
|
+
readOnlyHint: false,
|
|
13
|
+
title: 'Delete Documents'
|
|
14
|
+
},
|
|
7
15
|
description: DEFAULT_DESCRIPTION,
|
|
8
|
-
input:
|
|
9
|
-
|
|
10
|
-
z.string(),
|
|
11
|
-
z.number()
|
|
12
|
-
]).describe('Optional: specific document ID to delete').optional(),
|
|
13
|
-
depth: z.number().int().min(0).max(10).describe('Depth of population for relationships in response').optional().default(0),
|
|
14
|
-
fallbackLocale: z.string().describe('Optional: fallback locale code to use when requested locale is not available').optional(),
|
|
15
|
-
locale: z.string().describe('Optional: locale code for the operation (e.g., "en", "es"). Defaults to the default locale').optional(),
|
|
16
|
-
where: z.string().describe('Optional: JSON string for where clause to delete multiple documents').optional()
|
|
17
|
-
})
|
|
18
|
-
}).handler(async ({ authorizedMCP, collectionSlug, input, req })=>{
|
|
16
|
+
input: deleteDocumentsInputSchema
|
|
17
|
+
}).handler(async ({ slug, authorizedMCP, input, req })=>{
|
|
19
18
|
const payload = req.payload;
|
|
20
19
|
const logger = getLogger({
|
|
21
20
|
payload
|
|
22
21
|
});
|
|
23
22
|
const { id, depth, fallbackLocale, locale, where } = input;
|
|
24
|
-
logger.info(`Deleting document from collection: ${
|
|
23
|
+
logger.info(`Deleting document from collection: ${slug}${id ? ` with ID: ${id}` : ' with where clause'}${locale ? `, locale: ${locale}` : ''}`);
|
|
25
24
|
try {
|
|
26
|
-
if (
|
|
25
|
+
if (id !== undefined) {
|
|
26
|
+
const result = await payload.delete({
|
|
27
|
+
id,
|
|
28
|
+
collection: slug,
|
|
29
|
+
depth,
|
|
30
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
31
|
+
req,
|
|
32
|
+
...locale && {
|
|
33
|
+
locale
|
|
34
|
+
},
|
|
35
|
+
...fallbackLocale !== undefined && {
|
|
36
|
+
fallbackLocale
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
content: [
|
|
41
|
+
{
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: `Document deleted successfully from collection "${slug}"!\nDeleted document:\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
doc: result
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (where === undefined) {
|
|
27
50
|
return {
|
|
28
51
|
content: [
|
|
29
52
|
{
|
|
@@ -33,55 +56,22 @@ export const deleteCollectionTool = defineCollectionTool({
|
|
|
33
56
|
]
|
|
34
57
|
};
|
|
35
58
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
whereClause = JSON.parse(where);
|
|
40
|
-
} catch {
|
|
41
|
-
logger.warn(`Invalid where clause JSON: ${where}`);
|
|
42
|
-
return {
|
|
43
|
-
content: [
|
|
44
|
-
{
|
|
45
|
-
type: 'text',
|
|
46
|
-
text: 'Error: Invalid JSON in where clause'
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const deleteOptions = {
|
|
53
|
-
collection: collectionSlug,
|
|
59
|
+
const result = await payload.delete({
|
|
60
|
+
collection: slug,
|
|
54
61
|
depth,
|
|
62
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
55
63
|
req,
|
|
56
|
-
|
|
64
|
+
where,
|
|
57
65
|
...locale && {
|
|
58
66
|
locale
|
|
59
67
|
},
|
|
60
|
-
...fallbackLocale && {
|
|
68
|
+
...fallbackLocale !== undefined && {
|
|
61
69
|
fallbackLocale
|
|
62
70
|
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
deleteOptions.where = whereClause;
|
|
68
|
-
}
|
|
69
|
-
const result = await payload.delete(deleteOptions);
|
|
70
|
-
if (id) {
|
|
71
|
-
return {
|
|
72
|
-
content: [
|
|
73
|
-
{
|
|
74
|
-
type: 'text',
|
|
75
|
-
text: `Document deleted successfully from collection "${collectionSlug}"!\nDeleted document:\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
doc: result
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
const bulkResult = result;
|
|
82
|
-
const docs = bulkResult.docs || [];
|
|
83
|
-
const errors = bulkResult.errors || [];
|
|
84
|
-
let responseText = `Document deleted successfully from collection "${collectionSlug}"!\nDeleted: ${docs.length} documents\nErrors: ${errors.length}\n---`;
|
|
71
|
+
});
|
|
72
|
+
const docs = result.docs || [];
|
|
73
|
+
const errors = result.errors || [];
|
|
74
|
+
let responseText = `Document deleted successfully from collection "${slug}"!\nDeleted: ${docs.length} documents\nErrors: ${errors.length}\n---`;
|
|
85
75
|
if (docs.length > 0) {
|
|
86
76
|
responseText += `\n\nDeleted documents:\n\`\`\`json\n${JSON.stringify(docs)}\n\`\`\``;
|
|
87
77
|
}
|
|
@@ -102,12 +92,12 @@ export const deleteCollectionTool = defineCollectionTool({
|
|
|
102
92
|
};
|
|
103
93
|
} catch (error) {
|
|
104
94
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
105
|
-
logger.error(`Error deleting document from ${
|
|
95
|
+
logger.error(`Error deleting document from ${slug}: ${errorMessage}`);
|
|
106
96
|
return {
|
|
107
97
|
content: [
|
|
108
98
|
{
|
|
109
99
|
type: 'text',
|
|
110
|
-
text: `Error deleting document from collection "${
|
|
100
|
+
text: `Error deleting document from collection "${slug}": ${errorMessage}`
|
|
111
101
|
}
|
|
112
102
|
]
|
|
113
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/mcp/builtin/collections/deleteTool.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/mcp/builtin/collections/deleteTool.ts"],"sourcesContent":["import { deleteDocumentsInputSchema } from 'payload'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineCollectionTool } from '../../../defineTool.js'\nimport { getLogger } from '../../../utils/getLogger.js'\n\nconst DEFAULT_DESCRIPTION =\n 'Delete documents in any collection by passing the collection slug and ID or where clause.'\n\nexport const deleteDocumentsTool = defineCollectionTool({\n access: (args) =>\n defaultAccess(args) && Boolean(args.permissions?.collections?.[args.slug]?.delete),\n annotations: {\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n readOnlyHint: false,\n title: 'Delete Documents',\n },\n description: DEFAULT_DESCRIPTION,\n input: deleteDocumentsInputSchema,\n}).handler(async ({ slug, authorizedMCP, input, req }) => {\n const payload = req.payload\n const logger = getLogger({ payload })\n\n const { id, depth, fallbackLocale, locale, where } = input\n\n logger.info(\n `Deleting document from collection: ${slug}${id ? ` with ID: ${id}` : ' with where clause'}${locale ? `, locale: ${locale}` : ''}`,\n )\n\n try {\n if (id !== undefined) {\n const result = await payload.delete({\n id,\n collection: slug,\n depth,\n overrideAccess: authorizedMCP.overrideAccess,\n req,\n ...(locale && { locale }),\n ...(fallbackLocale !== undefined && { fallbackLocale }),\n })\n\n return {\n content: [\n {\n type: 'text',\n text: `Document deleted successfully from collection \"${slug}\"!\\nDeleted document:\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n doc: result as Record<string, unknown>,\n }\n }\n\n if (where === undefined) {\n return {\n content: [{ type: 'text', text: 'Error: Either id or where clause must be provided' }],\n }\n }\n\n const result = await payload.delete({\n collection: slug,\n depth,\n overrideAccess: authorizedMCP.overrideAccess,\n req,\n where,\n ...(locale && { locale }),\n ...(fallbackLocale !== undefined && { fallbackLocale }),\n })\n const docs = result.docs || []\n const errors = result.errors || []\n\n let responseText = `Document deleted successfully from collection \"${slug}\"!\\nDeleted: ${docs.length} documents\\nErrors: ${errors.length}\\n---`\n if (docs.length > 0) {\n responseText += `\\n\\nDeleted documents:\\n\\`\\`\\`json\\n${JSON.stringify(docs)}\\n\\`\\`\\``\n }\n if (errors.length > 0) {\n responseText += `\\n\\nErrors:\\n\\`\\`\\`json\\n${JSON.stringify(errors)}\\n\\`\\`\\``\n }\n\n return {\n content: [{ type: 'text', text: responseText }],\n doc: { docs, errors } as unknown as Record<string, unknown>,\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n logger.error(`Error deleting document from ${slug}: ${errorMessage}`)\n return {\n content: [\n {\n type: 'text',\n text: `Error deleting document from collection \"${slug}\": ${errorMessage}`,\n },\n ],\n }\n }\n})\n"],"names":["deleteDocumentsInputSchema","defaultAccess","defineCollectionTool","getLogger","DEFAULT_DESCRIPTION","deleteDocumentsTool","access","args","Boolean","permissions","collections","slug","delete","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","handler","authorizedMCP","req","payload","logger","id","depth","fallbackLocale","locale","where","info","undefined","result","collection","overrideAccess","content","type","text","JSON","stringify","doc","docs","errors","responseText","length","error","errorMessage","Error","message"],"mappings":"AAAA,SAASA,0BAA0B,QAAQ,UAAS;AAEpD,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,SAAS,QAAQ,8BAA6B;AAEvD,MAAMC,sBACJ;AAEF,OAAO,MAAMC,sBAAsBH,qBAAqB;IACtDI,QAAQ,CAACC,OACPN,cAAcM,SAASC,QAAQD,KAAKE,WAAW,EAAEC,aAAa,CAACH,KAAKI,IAAI,CAAC,EAAEC;IAC7EC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAaf;IACbgB,OAAOpB;AACT,GAAGqB,OAAO,CAAC,OAAO,EAAEV,IAAI,EAAEW,aA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CAA+C,EAAEjC,KAAK,aAAa,EAAE+B,KAAKG,MAAM,CAAC,oBAAoB,EAAEF,OAAOE,MAAM,CAAC,KAAK,CAAC;QAC/I,IAAIH,KAAKG,MAAM,GAAG,GAAG;YACnBD,gBAAgB,CAAC,oCAAoC,EAAEL,KAAKC,SAAS,CAACE,MAAM,QAAQ,CAAC;QACvF;QACA,IAAIC,OAAOE,MAAM,GAAG,GAAG;YACrBD,gBAAgB,CAAC,yBAAyB,EAAEL,KAAKC,SAAS,CAACG,QAAQ,QAAQ,CAAC;QAC9E;QAEA,OAAO;YACLP,SAAS;gBAAC;oBAAEC,MAAM;oBAAQC,MAAMM;gBAAa;aAAE;YAC/CH,KAAK;gBAAEC;gBAAMC;YAAO;QACtB;IACF,EAAE,OAAOG,OAAO;QACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;QAC9DxB,OAAOqB,KAAK,CAAC,CAAC,6BAA6B,EAAEnC,KAAK,EAAE,EAAEoC,cAAc;QACpE,OAAO;YACLX,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,yCAAyC,EAAE3B,KAAK,GAAG,EAAEoC,cAAc;gBAC5E;aACD;QACH;IACF;AACF,GAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplicateTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/collections/duplicateTool.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,qBAAqB,4CAkEhC,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { duplicateDocumentInputSchema, getCollectionVirtualFieldNames, stripVirtualFields, transformPointDataToPayload, validateCollectionData } from 'payload';
|
|
2
|
+
import { defaultAccess } from '../../../defaultAccess.js';
|
|
3
|
+
import { defineCollectionTool } from '../../../defineTool.js';
|
|
4
|
+
import { getLogger } from '../../../utils/getLogger.js';
|
|
5
|
+
import { formatEntityError } from '../formatEntityError.js';
|
|
6
|
+
const DEFAULT_DESCRIPTION = 'Duplicate a document in any collection by passing the collection slug and source document ID.';
|
|
7
|
+
export const duplicateDocumentTool = defineCollectionTool({
|
|
8
|
+
access: (args)=>defaultAccess(args) && Boolean(args.permissions?.collections?.[args.slug]?.create),
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
idempotentHint: false,
|
|
12
|
+
openWorldHint: false,
|
|
13
|
+
readOnlyHint: false,
|
|
14
|
+
title: 'Duplicate Document'
|
|
15
|
+
},
|
|
16
|
+
description: DEFAULT_DESCRIPTION,
|
|
17
|
+
input: duplicateDocumentInputSchema
|
|
18
|
+
}).handler(async ({ slug, authorizedMCP, input, req })=>{
|
|
19
|
+
const payload = req.payload;
|
|
20
|
+
const logger = getLogger({
|
|
21
|
+
payload
|
|
22
|
+
});
|
|
23
|
+
const { id, data, depth, draft, fallbackLocale, locale, populate, select, selectedLocales } = input;
|
|
24
|
+
logger.info(`Duplicating document in collection: ${slug} with ID: ${id}`);
|
|
25
|
+
try {
|
|
26
|
+
const virtualFieldNames = getCollectionVirtualFieldNames(payload.config, slug);
|
|
27
|
+
const inputData = data ? stripVirtualFields(data, virtualFieldNames) : undefined;
|
|
28
|
+
if (inputData) {
|
|
29
|
+
validateCollectionData({
|
|
30
|
+
slug,
|
|
31
|
+
data: inputData,
|
|
32
|
+
partial: true,
|
|
33
|
+
req
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const parsedData = inputData ? transformPointDataToPayload(inputData) : undefined;
|
|
37
|
+
const result = await payload.duplicate({
|
|
38
|
+
id,
|
|
39
|
+
collection: slug,
|
|
40
|
+
depth,
|
|
41
|
+
draft,
|
|
42
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
43
|
+
req,
|
|
44
|
+
...parsedData ? {
|
|
45
|
+
data: parsedData
|
|
46
|
+
} : {},
|
|
47
|
+
...locale ? {
|
|
48
|
+
locale
|
|
49
|
+
} : {},
|
|
50
|
+
...fallbackLocale !== undefined ? {
|
|
51
|
+
fallbackLocale
|
|
52
|
+
} : {},
|
|
53
|
+
...populate ? {
|
|
54
|
+
populate
|
|
55
|
+
} : {},
|
|
56
|
+
...select ? {
|
|
57
|
+
select
|
|
58
|
+
} : {},
|
|
59
|
+
...selectedLocales ? {
|
|
60
|
+
selectedLocales
|
|
61
|
+
} : {}
|
|
62
|
+
});
|
|
63
|
+
logger.info(`Successfully duplicated document in ${slug} from ID: ${id}`);
|
|
64
|
+
return {
|
|
65
|
+
content: [
|
|
66
|
+
{
|
|
67
|
+
type: 'text',
|
|
68
|
+
text: `Document duplicated successfully in collection "${slug}"!\nDuplicated document:\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
doc: result
|
|
72
|
+
};
|
|
73
|
+
} catch (error) {
|
|
74
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
75
|
+
logger.error(`Error duplicating document in ${slug}: ${errorMessage}`);
|
|
76
|
+
return formatEntityError({
|
|
77
|
+
slug,
|
|
78
|
+
action: 'duplicating',
|
|
79
|
+
entity: 'collection',
|
|
80
|
+
error,
|
|
81
|
+
req
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=duplicateTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/mcp/builtin/collections/duplicateTool.ts"],"sourcesContent":["import {\n duplicateDocumentInputSchema,\n getCollectionVirtualFieldNames,\n stripVirtualFields,\n transformPointDataToPayload,\n validateCollectionData,\n} from 'payload'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineCollectionTool } from '../../../defineTool.js'\nimport { getLogger } from '../../../utils/getLogger.js'\nimport { formatEntityError } from '../formatEntityError.js'\n\nconst DEFAULT_DESCRIPTION =\n 'Duplicate a document in any collection by passing the collection slug and source document ID.'\n\nexport const duplicateDocumentTool = defineCollectionTool({\n access: (args) =>\n defaultAccess(args) && Boolean(args.permissions?.collections?.[args.slug]?.create),\n annotations: {\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: false,\n readOnlyHint: false,\n title: 'Duplicate Document',\n },\n description: DEFAULT_DESCRIPTION,\n input: duplicateDocumentInputSchema,\n}).handler(async ({ slug, authorizedMCP, input, req }) => {\n const payload = req.payload\n const logger = getLogger({ payload })\n const { id, data, depth, draft, fallbackLocale, locale, populate, select, selectedLocales } =\n input\n\n logger.info(`Duplicating document in collection: ${slug} with ID: ${id}`)\n\n try {\n const virtualFieldNames = getCollectionVirtualFieldNames(payload.config, slug)\n const inputData = data ? stripVirtualFields(data, virtualFieldNames) : undefined\n\n if (inputData) {\n validateCollectionData({\n slug,\n data: inputData,\n partial: true,\n req,\n })\n }\n\n const parsedData = inputData ? transformPointDataToPayload(inputData) : undefined\n\n const result = await payload.duplicate({\n id,\n collection: slug,\n depth,\n draft,\n overrideAccess: authorizedMCP.overrideAccess,\n req,\n ...(parsedData ? { data: parsedData } : {}),\n ...(locale ? { locale } : {}),\n ...(fallbackLocale !== undefined ? { fallbackLocale } : {}),\n ...(populate ? { populate } : {}),\n ...(select ? { select } : {}),\n ...(selectedLocales ? { selectedLocales } : {}),\n })\n\n logger.info(`Successfully duplicated document in ${slug} from ID: ${id}`)\n\n return {\n content: [\n {\n type: 'text',\n text: `Document duplicated successfully in collection \"${slug}\"!\\nDuplicated document:\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n doc: result as Record<string, unknown>,\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n logger.error(`Error duplicating document in ${slug}: ${errorMessage}`)\n return formatEntityError({ slug, action: 'duplicating', entity: 'collection', error, req })\n }\n})\n"],"names":["duplicateDocumentInputSchema","getCollectionVirtualFieldNames","stripVirtualFields","transformPointDataToPayload","validateCollectionData","defaultAccess","defineCollectionTool","getLogger","formatEntityError","DEFAULT_DESCRIPTION","duplicateDocumentTool","access","args","Boolean","permissions","collections","slug","create","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","handler","authorizedMCP","req","payload","logger","id","data","depth","draft","fallbackLocale","locale","populate","select","selectedLocales","info","virtualFieldNames","config","inputData","undefined","partial","parsedData","result","duplicate","collection","overrideAccess","content","type","text","JSON","stringify","doc","error","errorMessage","Error","message","action","entity"],"mappings":"AAAA,SACEA,4BAA4B,EAC5BC,8BAA8B,EAC9BC,kBAAkB,EAClBC,2BAA2B,EAC3BC,sBAAsB,QACjB,UAAS;AAEhB,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,SAAS,QAAQ,8BAA6B;AACvD,SAASC,iBAAiB,QAAQ,0BAAyB;AAE3D,MAAMC,sBACJ;AAEF,OAAO,MAAMC,wBAAwBJ,qBAAqB;IACxDK,QAAQ,CAACC,OACPP,cAAcO,SAASC,QAAQD,KAAKE,WAAW,EAAEC,aAAa,CAACH,KAAKI,IAAI,CAAC,EAAEC;IAC7EC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAaf;IACbgB,OAAOzB;AACT,GAAG0B,OAAO,CAAC,OAAO,EAAEV,IAAI,EAAEW,aAAa,EAAEF,KAAK,EAAEG,GAAG,EAAE;IACnD,MAAMC,UAAUD,IAAIC,OAAO;IAC3B,MAAMC,SAASvB,UAAU;QAAEsB;IAAQ;IACnC,MAAM,EAAEE,EAAE,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,eAAe,EAAE,GACzFd;IAEFK,OAAOU,IAAI,CAAC,CAAC,oCAAoC,EAAExB,KAAK,UAAU,EAAEe,IAAI;IAExE,IAAI;QACF,MAAMU,oBAAoBxC,+BAA+B4B,QAAQa,MAAM,EAAE1B;QACzE,MAAM2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
|
2
|
+
import { z } from 'payload';
|
|
3
|
+
export declare const fileInputSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
4
|
+
name: z.ZodMiniString<string>;
|
|
5
|
+
data: z.ZodMiniString<string>;
|
|
6
|
+
mimeType: z.ZodMiniString<string>;
|
|
7
|
+
source: z.ZodMiniLiteral<"base64">;
|
|
8
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
9
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
10
|
+
source: z.ZodMiniLiteral<"externalURL">;
|
|
11
|
+
url: z.ZodMiniURL;
|
|
12
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
13
|
+
file: z.ZodMiniObject<{
|
|
14
|
+
filename: z.ZodMiniString<string>;
|
|
15
|
+
mimeType: z.ZodMiniString<string>;
|
|
16
|
+
size: z.ZodMiniInt;
|
|
17
|
+
uploadReference: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
source: z.ZodMiniLiteral<"uploadReference">;
|
|
20
|
+
}, z.core.$strict>], "source">;
|
|
21
|
+
type FileInput = z.infer<typeof fileInputSchema>;
|
|
22
|
+
export declare function resolveFile({ slug, input, req, }: {
|
|
23
|
+
input?: FileInput;
|
|
24
|
+
req: PayloadRequest;
|
|
25
|
+
slug: CollectionSlug;
|
|
26
|
+
}): Promise<File | undefined>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=fileInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileInput.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/collections/fileInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAY,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7E,OAAO,EAAY,CAAC,EAAE,MAAM,SAAS,CAAA;AAoBrC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;8BAwBzB,CAAA;AAEH,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEhD,wBAAsB,WAAW,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,GAAG,GACJ,EAAE;IACD,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,GAAG,EAAE,cAAc,CAAA;IACnB,IAAI,EAAE,cAAc,CAAA;CACrB,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CA2E5B"}
|