@payloadcms/plugin-mcp 3.85.0 → 4.0.0-internal.1f9ae9a
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/README.md +2 -2
- package/bin.js +39 -0
- package/dist/collection/getAccessField.d.ts +12 -0
- package/dist/collection/getAccessField.d.ts.map +1 -0
- package/dist/collection/getAccessField.js +57 -0
- package/dist/collection/getAccessField.js.map +1 -0
- package/dist/collection/index.d.ts +6 -0
- package/dist/collection/index.d.ts.map +1 -0
- package/dist/collection/index.js +59 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/components/AccessField/index.client.d.ts +10 -0
- package/dist/components/AccessField/index.client.d.ts.map +1 -0
- package/dist/components/AccessField/index.client.js +305 -0
- package/dist/components/AccessField/index.client.js.map +1 -0
- package/dist/components/AccessField/index.css +93 -0
- package/dist/defineTool.d.ts +26 -0
- package/dist/defineTool.d.ts.map +1 -0
- package/dist/defineTool.js +37 -0
- package/dist/defineTool.js.map +1 -0
- package/dist/endpoint/access.d.ts +10 -0
- package/dist/endpoint/access.d.ts.map +1 -0
- package/dist/endpoint/access.js +106 -0
- package/dist/endpoint/access.js.map +1 -0
- package/dist/endpoint/index.d.ts +3 -0
- package/dist/endpoint/index.d.ts.map +1 -0
- package/dist/endpoint/index.js +36 -0
- package/dist/endpoint/index.js.map +1 -0
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +4 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -67
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts +19 -0
- package/dist/mcp/buildMcpServer.d.ts.map +1 -0
- package/dist/mcp/buildMcpServer.js +163 -0
- package/dist/mcp/buildMcpServer.js.map +1 -0
- package/dist/mcp/builtin/collections/authTools.d.ts +7 -0
- package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/authTools.js +250 -0
- package/dist/mcp/builtin/collections/authTools.js.map +1 -0
- package/dist/mcp/builtin/collections/createTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/createTool.js +87 -0
- package/dist/mcp/builtin/collections/createTool.js.map +1 -0
- package/dist/mcp/builtin/collections/deleteTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/deleteTool.js +117 -0
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findTool.js +159 -0
- package/dist/mcp/builtin/collections/findTool.js.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.js +187 -0
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findTool.js +76 -0
- package/dist/mcp/builtin/globals/findTool.js.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.js +92 -0
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -0
- package/dist/mcp/builtinTools.d.ts +37 -0
- package/dist/mcp/builtinTools.d.ts.map +1 -0
- package/dist/mcp/builtinTools.js +64 -0
- package/dist/mcp/builtinTools.js.map +1 -0
- package/dist/mcp/sanitizeMCPConfig.d.ts +17 -0
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -0
- package/dist/mcp/sanitizeMCPConfig.js +167 -0
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -0
- package/dist/stdio.d.ts +8 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +89 -0
- package/dist/stdio.js.map +1 -0
- package/dist/types.d.ts +262 -455
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/camelCase.d.ts.map +1 -1
- package/dist/utils/getLogger.d.ts +10 -0
- package/dist/utils/getLogger.d.ts.map +1 -0
- package/dist/utils/getLogger.js +22 -0
- package/dist/utils/getLogger.js.map +1 -0
- package/dist/utils/getPluginConfig.d.ts +12 -0
- package/dist/utils/getPluginConfig.d.ts.map +1 -0
- package/dist/utils/getPluginConfig.js +15 -0
- package/dist/utils/getPluginConfig.js.map +1 -0
- package/dist/utils/localAPIDefaults.d.ts +20 -0
- package/dist/utils/localAPIDefaults.d.ts.map +1 -0
- package/dist/utils/localAPIDefaults.js +19 -0
- package/dist/utils/localAPIDefaults.js.map +1 -0
- package/dist/utils/resolveProjectRoot.d.ts +7 -0
- package/dist/utils/resolveProjectRoot.d.ts.map +1 -0
- package/dist/utils/resolveProjectRoot.js +15 -0
- package/dist/utils/resolveProjectRoot.js.map +1 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.d.ts +7 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.js +37 -0
- package/dist/utils/schemaConversion/prepareCollectionSchema.js.map +1 -0
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +2 -2
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +1 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts +2 -2
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js.map +1 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts +2 -2
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts.map +1 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js +7 -4
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js.map +1 -1
- package/dist/utils/schemaConversion/transformPointFields.d.ts +2 -2
- package/dist/utils/schemaConversion/transformPointFields.d.ts.map +1 -1
- package/dist/utils/schemaConversion/transformPointFields.js +7 -1
- package/dist/utils/schemaConversion/transformPointFields.js.map +1 -1
- package/dist/utils/toStandardSchema.d.ts +5 -0
- package/dist/utils/toStandardSchema.d.ts.map +1 -0
- package/dist/utils/toStandardSchema.js +4 -0
- package/dist/utils/toStandardSchema.js.map +1 -0
- package/package.json +35 -10
- package/src/collection/getAccessField.ts +64 -0
- package/src/collection/index.ts +63 -0
- package/src/components/AccessField/index.client.tsx +344 -0
- package/src/components/AccessField/index.css +93 -0
- package/src/defineTool.ts +44 -0
- package/src/endpoint/access.ts +132 -0
- package/src/endpoint/index.ts +35 -0
- package/src/exports/client.ts +2 -0
- package/src/index.ts +35 -85
- package/src/mcp/buildMcpServer.ts +224 -0
- package/src/mcp/builtin/collections/authTools.ts +233 -0
- package/src/mcp/builtin/collections/createTool.ts +116 -0
- package/src/mcp/builtin/collections/deleteTool.ts +123 -0
- package/src/mcp/builtin/collections/findTool.ts +187 -0
- package/src/mcp/builtin/collections/updateTool.ts +205 -0
- package/src/mcp/builtin/globals/findTool.ts +96 -0
- package/src/mcp/builtin/globals/updateTool.ts +118 -0
- package/src/mcp/builtinTools.ts +84 -0
- package/src/mcp/sanitizeMCPConfig.ts +239 -0
- package/src/stdio.ts +98 -0
- package/src/types.ts +295 -490
- package/src/utils/getLogger.ts +22 -0
- package/src/utils/getPluginConfig.ts +24 -0
- package/src/utils/localAPIDefaults.ts +22 -0
- package/src/utils/resolveProjectRoot.ts +17 -0
- package/src/utils/schemaConversion/prepareCollectionSchema.ts +39 -0
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +3 -3
- package/src/utils/schemaConversion/sanitizeJsonSchema.ts +4 -4
- package/src/utils/schemaConversion/simplifyRelationshipFields.ts +11 -6
- package/src/utils/schemaConversion/transformPointFields.ts +6 -5
- package/src/utils/toStandardSchema.ts +9 -0
- package/dist/collections/createApiKeysCollection.d.ts +0 -7
- package/dist/collections/createApiKeysCollection.d.ts.map +0 -1
- package/dist/collections/createApiKeysCollection.js +0 -317
- package/dist/collections/createApiKeysCollection.js.map +0 -1
- package/dist/defaults.d.ts +0 -4
- package/dist/defaults.d.ts.map +0 -1
- package/dist/defaults.js +0 -5
- package/dist/defaults.js.map +0 -1
- package/dist/endpoints/mcp.d.ts +0 -4
- package/dist/endpoints/mcp.d.ts.map +0 -1
- package/dist/endpoints/mcp.js +0 -71
- package/dist/endpoints/mcp.js.map +0 -1
- package/dist/mcp/createRequest.d.ts +0 -3
- package/dist/mcp/createRequest.d.ts.map +0 -1
- package/dist/mcp/createRequest.js +0 -14
- package/dist/mcp/createRequest.js.map +0 -1
- package/dist/mcp/getMcpHandler.d.ts +0 -4
- package/dist/mcp/getMcpHandler.d.ts.map +0 -1
- package/dist/mcp/getMcpHandler.js +0 -231
- package/dist/mcp/getMcpHandler.js.map +0 -1
- package/dist/mcp/helpers/config.d.ts +0 -22
- package/dist/mcp/helpers/config.d.ts.map +0 -1
- package/dist/mcp/helpers/config.js +0 -153
- package/dist/mcp/helpers/config.js.map +0 -1
- package/dist/mcp/helpers/fields.d.ts +0 -19
- package/dist/mcp/helpers/fields.d.ts.map +0 -1
- package/dist/mcp/helpers/fields.js +0 -102
- package/dist/mcp/helpers/fields.js.map +0 -1
- package/dist/mcp/helpers/fileValidation.d.ts +0 -67
- package/dist/mcp/helpers/fileValidation.d.ts.map +0 -1
- package/dist/mcp/helpers/fileValidation.js +0 -267
- package/dist/mcp/helpers/fileValidation.js.map +0 -1
- package/dist/mcp/registerTool.d.ts +0 -6
- package/dist/mcp/registerTool.d.ts.map +0 -1
- package/dist/mcp/registerTool.js +0 -18
- package/dist/mcp/registerTool.js.map +0 -1
- package/dist/mcp/tools/auth/auth.d.ts +0 -4
- package/dist/mcp/tools/auth/auth.d.ts.map +0 -1
- package/dist/mcp/tools/auth/auth.js +0 -57
- package/dist/mcp/tools/auth/auth.js.map +0 -1
- package/dist/mcp/tools/auth/forgotPassword.d.ts +0 -4
- package/dist/mcp/tools/auth/forgotPassword.d.ts.map +0 -1
- package/dist/mcp/tools/auth/forgotPassword.js +0 -48
- package/dist/mcp/tools/auth/forgotPassword.js.map +0 -1
- package/dist/mcp/tools/auth/login.d.ts +0 -4
- package/dist/mcp/tools/auth/login.d.ts.map +0 -1
- package/dist/mcp/tools/auth/login.js +0 -51
- package/dist/mcp/tools/auth/login.js.map +0 -1
- package/dist/mcp/tools/auth/resetPassword.d.ts +0 -4
- package/dist/mcp/tools/auth/resetPassword.d.ts.map +0 -1
- package/dist/mcp/tools/auth/resetPassword.js +0 -49
- package/dist/mcp/tools/auth/resetPassword.js.map +0 -1
- package/dist/mcp/tools/auth/unlock.d.ts +0 -4
- package/dist/mcp/tools/auth/unlock.d.ts.map +0 -1
- package/dist/mcp/tools/auth/unlock.js +0 -48
- package/dist/mcp/tools/auth/unlock.js.map +0 -1
- package/dist/mcp/tools/auth/verify.d.ts +0 -4
- package/dist/mcp/tools/auth/verify.d.ts.map +0 -1
- package/dist/mcp/tools/auth/verify.js +0 -45
- package/dist/mcp/tools/auth/verify.js.map +0 -1
- package/dist/mcp/tools/collection/create.d.ts +0 -10
- package/dist/mcp/tools/collection/create.d.ts.map +0 -1
- package/dist/mcp/tools/collection/create.js +0 -139
- package/dist/mcp/tools/collection/create.js.map +0 -1
- package/dist/mcp/tools/collection/delete.d.ts +0 -10
- package/dist/mcp/tools/collection/delete.d.ts.map +0 -1
- package/dist/mcp/tools/collection/delete.js +0 -154
- package/dist/mcp/tools/collection/delete.js.map +0 -1
- package/dist/mcp/tools/collection/find.d.ts +0 -10
- package/dist/mcp/tools/collection/find.d.ts.map +0 -1
- package/dist/mcp/tools/collection/find.js +0 -165
- package/dist/mcp/tools/collection/find.js.map +0 -1
- package/dist/mcp/tools/collection/update.d.ts +0 -10
- package/dist/mcp/tools/collection/update.d.ts.map +0 -1
- package/dist/mcp/tools/collection/update.js +0 -209
- package/dist/mcp/tools/collection/update.js.map +0 -1
- package/dist/mcp/tools/config/find.d.ts +0 -10
- package/dist/mcp/tools/config/find.d.ts.map +0 -1
- package/dist/mcp/tools/config/find.js +0 -97
- package/dist/mcp/tools/config/find.js.map +0 -1
- package/dist/mcp/tools/config/update.d.ts +0 -10
- package/dist/mcp/tools/config/update.d.ts.map +0 -1
- package/dist/mcp/tools/config/update.js +0 -215
- package/dist/mcp/tools/config/update.js.map +0 -1
- package/dist/mcp/tools/global/find.d.ts +0 -5
- package/dist/mcp/tools/global/find.d.ts.map +0 -1
- package/dist/mcp/tools/global/find.js +0 -82
- package/dist/mcp/tools/global/find.js.map +0 -1
- package/dist/mcp/tools/global/update.d.ts +0 -6
- package/dist/mcp/tools/global/update.d.ts.map +0 -1
- package/dist/mcp/tools/global/update.js +0 -124
- package/dist/mcp/tools/global/update.js.map +0 -1
- package/dist/mcp/tools/job/create.d.ts +0 -10
- package/dist/mcp/tools/job/create.d.ts.map +0 -1
- package/dist/mcp/tools/job/create.js +0 -293
- package/dist/mcp/tools/job/create.js.map +0 -1
- package/dist/mcp/tools/job/run.d.ts +0 -10
- package/dist/mcp/tools/job/run.d.ts.map +0 -1
- package/dist/mcp/tools/job/run.js +0 -129
- package/dist/mcp/tools/job/run.js.map +0 -1
- package/dist/mcp/tools/job/update.d.ts +0 -11
- package/dist/mcp/tools/job/update.d.ts.map +0 -1
- package/dist/mcp/tools/job/update.js +0 -186
- package/dist/mcp/tools/job/update.js.map +0 -1
- package/dist/mcp/tools/resource/create.d.ts +0 -6
- package/dist/mcp/tools/resource/create.d.ts.map +0 -1
- package/dist/mcp/tools/resource/create.js +0 -124
- package/dist/mcp/tools/resource/create.js.map +0 -1
- package/dist/mcp/tools/resource/delete.d.ts +0 -5
- package/dist/mcp/tools/resource/delete.d.ts.map +0 -1
- package/dist/mcp/tools/resource/delete.js +0 -151
- package/dist/mcp/tools/resource/delete.js.map +0 -1
- package/dist/mcp/tools/resource/find.d.ts +0 -5
- package/dist/mcp/tools/resource/find.d.ts.map +0 -1
- package/dist/mcp/tools/resource/find.js +0 -170
- package/dist/mcp/tools/resource/find.js.map +0 -1
- package/dist/mcp/tools/resource/update.d.ts +0 -6
- package/dist/mcp/tools/resource/update.d.ts.map +0 -1
- package/dist/mcp/tools/resource/update.js +0 -256
- package/dist/mcp/tools/resource/update.js.map +0 -1
- package/dist/mcp/tools/schemas.d.ts +0 -457
- package/dist/mcp/tools/schemas.d.ts.map +0 -1
- package/dist/mcp/tools/schemas.js +0 -243
- package/dist/mcp/tools/schemas.js.map +0 -1
- package/dist/utils/adminEntitySettings.d.ts +0 -17
- package/dist/utils/adminEntitySettings.d.ts.map +0 -1
- package/dist/utils/adminEntitySettings.js +0 -41
- package/dist/utils/adminEntitySettings.js.map +0 -1
- package/dist/utils/createApiKeyFields.d.ts +0 -15
- package/dist/utils/createApiKeyFields.d.ts.map +0 -1
- package/dist/utils/createApiKeyFields.js +0 -57
- package/dist/utils/createApiKeyFields.js.map +0 -1
- package/dist/utils/getEnabledSlugs.d.ts +0 -13
- package/dist/utils/getEnabledSlugs.d.ts.map +0 -1
- package/dist/utils/getEnabledSlugs.js +0 -32
- package/dist/utils/getEnabledSlugs.js.map +0 -1
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.d.ts +0 -3
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.d.ts.map +0 -1
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.js +0 -43
- package/dist/utils/schemaConversion/convertCollectionSchemaToZod.js.map +0 -1
- package/src/collections/createApiKeysCollection.ts +0 -373
- package/src/defaults.ts +0 -3
- package/src/endpoints/mcp.ts +0 -91
- package/src/mcp/createRequest.ts +0 -13
- package/src/mcp/getMcpHandler.ts +0 -545
- package/src/mcp/helpers/config.ts +0 -213
- package/src/mcp/helpers/fields.ts +0 -154
- package/src/mcp/helpers/fileValidation.ts +0 -362
- package/src/mcp/registerTool.ts +0 -22
- package/src/mcp/tools/auth/auth.ts +0 -71
- package/src/mcp/tools/auth/forgotPassword.ts +0 -70
- package/src/mcp/tools/auth/login.ts +0 -72
- package/src/mcp/tools/auth/resetPassword.ts +0 -61
- package/src/mcp/tools/auth/unlock.ts +0 -64
- package/src/mcp/tools/auth/verify.ts +0 -57
- package/src/mcp/tools/collection/create.ts +0 -210
- package/src/mcp/tools/collection/delete.ts +0 -211
- package/src/mcp/tools/collection/find.ts +0 -224
- package/src/mcp/tools/collection/update.ts +0 -290
- package/src/mcp/tools/config/find.ts +0 -128
- package/src/mcp/tools/config/update.ts +0 -280
- package/src/mcp/tools/global/find.ts +0 -128
- package/src/mcp/tools/global/update.ts +0 -207
- package/src/mcp/tools/job/create.ts +0 -416
- package/src/mcp/tools/job/run.ts +0 -167
- package/src/mcp/tools/job/update.ts +0 -274
- package/src/mcp/tools/resource/create.ts +0 -211
- package/src/mcp/tools/resource/delete.ts +0 -218
- package/src/mcp/tools/resource/find.ts +0 -246
- package/src/mcp/tools/resource/update.ts +0 -383
- package/src/mcp/tools/schemas.ts +0 -520
- package/src/utils/adminEntitySettings.ts +0 -40
- package/src/utils/createApiKeyFields.ts +0 -72
- package/src/utils/getEnabledSlugs.ts +0 -42
- package/src/utils/schemaConversion/convertCollectionSchemaToZod.ts +0 -52
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const toolSchemas = {
|
|
3
|
-
findGlobal: {
|
|
4
|
-
description: 'Find a Payload global singleton configuration.',
|
|
5
|
-
parameters: z.object({
|
|
6
|
-
depth: z.number().int().min(0).max(10).optional().default(0).describe('Depth of population for relationships'),
|
|
7
|
-
fallbackLocale: z.string().optional().describe('Optional: fallback locale code to use when requested locale is not available'),
|
|
8
|
-
locale: z.string().optional().describe('Optional: locale code to retrieve data in (e.g., "en", "es"). Use "all" to retrieve all locales for localized fields'),
|
|
9
|
-
select: z.string().optional().describe("Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\"title\": true}'")
|
|
10
|
-
})
|
|
11
|
-
},
|
|
12
|
-
findResources: {
|
|
13
|
-
description: 'Find documents in a collection by ID or where clause using Find or FindByID.',
|
|
14
|
-
parameters: z.object({
|
|
15
|
-
id: z.union([
|
|
16
|
-
z.string(),
|
|
17
|
-
z.number()
|
|
18
|
-
]).optional().describe('Optional: specific document ID to retrieve. If not provided, returns all documents'),
|
|
19
|
-
depth: z.number().int().min(0).max(10).optional().default(0).describe('How many levels deep to populate relationships (default: 0)'),
|
|
20
|
-
draft: z.boolean().optional().describe('Optional: Whether the document should be queried from the versions table/collection or not.'),
|
|
21
|
-
fallbackLocale: z.string().optional().describe('Optional: fallback locale code to use when requested locale is not available'),
|
|
22
|
-
limit: z.number().int().min(1, 'Limit must be at least 1').max(100, 'Limit cannot exceed 100').optional().default(10).describe('Maximum number of documents to return (default: 10, max: 100)'),
|
|
23
|
-
locale: z.string().optional().describe('Optional: locale code to retrieve data in (e.g., "en", "es"). Use "all" to retrieve all locales for localized fields'),
|
|
24
|
-
page: z.number().int().min(1, 'Page must be at least 1').optional().default(1).describe('Page number for pagination (default: 1)'),
|
|
25
|
-
select: z.string().optional().describe("Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\"title\": true}'"),
|
|
26
|
-
sort: z.string().optional().describe('Field to sort by (e.g., "createdAt", "-updatedAt" for descending)'),
|
|
27
|
-
where: z.string().optional().describe('Optional JSON string for where clause filtering (e.g., \'{"title": {"contains": "test"}}\')')
|
|
28
|
-
})
|
|
29
|
-
},
|
|
30
|
-
createResource: {
|
|
31
|
-
description: 'Create a document in a collection.',
|
|
32
|
-
parameters: z.object({
|
|
33
|
-
data: z.string().describe('JSON string containing the data for the new document'),
|
|
34
|
-
depth: z.number().int().min(0).max(10).optional().default(0).describe('How many levels deep to populate relationships in response (default: 0)'),
|
|
35
|
-
draft: z.boolean().optional().default(false).describe('Whether to create the document as a draft'),
|
|
36
|
-
fallbackLocale: z.string().optional().describe('Optional: fallback locale code to use when requested locale is not available'),
|
|
37
|
-
locale: z.string().optional().describe('Optional: locale code to create the document in (e.g., "en", "es"). Defaults to the default locale'),
|
|
38
|
-
select: z.string().optional().describe("Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\"title\": true}'")
|
|
39
|
-
})
|
|
40
|
-
},
|
|
41
|
-
updateResource: {
|
|
42
|
-
description: 'Update documents in a collection by ID or where clause.',
|
|
43
|
-
parameters: z.object({
|
|
44
|
-
id: z.union([
|
|
45
|
-
z.string(),
|
|
46
|
-
z.number()
|
|
47
|
-
]).optional().describe('Optional: specific document ID to update'),
|
|
48
|
-
data: z.string().describe('JSON string containing the data to update'),
|
|
49
|
-
depth: z.number().int().min(0).max(10).optional().default(0).describe('Depth of population for relationships'),
|
|
50
|
-
draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),
|
|
51
|
-
fallbackLocale: z.string().optional().describe('Optional: fallback locale code to use when requested locale is not available'),
|
|
52
|
-
filePath: z.string().optional().describe('Optional: absolute file path for file uploads'),
|
|
53
|
-
locale: z.string().optional().describe('Optional: locale code to update the document in (e.g., "en", "es"). Defaults to the default locale'),
|
|
54
|
-
overrideLock: z.boolean().optional().default(true).describe('Whether to override document locks'),
|
|
55
|
-
overwriteExistingFiles: z.boolean().optional().default(false).describe('Whether to overwrite existing files'),
|
|
56
|
-
select: z.string().optional().describe("Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\"title\": true}'"),
|
|
57
|
-
where: z.string().optional().describe('Optional: JSON string for where clause to update multiple documents')
|
|
58
|
-
})
|
|
59
|
-
},
|
|
60
|
-
deleteResource: {
|
|
61
|
-
description: 'Delete documents in a collection by ID or where clause.',
|
|
62
|
-
parameters: z.object({
|
|
63
|
-
id: z.union([
|
|
64
|
-
z.string(),
|
|
65
|
-
z.number()
|
|
66
|
-
]).optional().describe('Optional: specific document ID to delete'),
|
|
67
|
-
depth: z.number().int().min(0).max(10).optional().default(0).describe('Depth of population for relationships in response'),
|
|
68
|
-
fallbackLocale: z.string().optional().describe('Optional: fallback locale code to use when requested locale is not available'),
|
|
69
|
-
locale: z.string().optional().describe('Optional: locale code for the operation (e.g., "en", "es"). Defaults to the default locale'),
|
|
70
|
-
where: z.string().optional().describe('Optional: JSON string for where clause to delete multiple documents')
|
|
71
|
-
})
|
|
72
|
-
},
|
|
73
|
-
updateGlobal: {
|
|
74
|
-
description: 'Update a Payload global singleton configuration.',
|
|
75
|
-
parameters: z.object({
|
|
76
|
-
data: z.string().describe('JSON string containing the data to update'),
|
|
77
|
-
depth: z.number().int().min(0).max(10).optional().default(0).describe('Depth of population for relationships'),
|
|
78
|
-
draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),
|
|
79
|
-
fallbackLocale: z.string().optional().describe('Optional: fallback locale code to use when requested locale is not available'),
|
|
80
|
-
locale: z.string().optional().describe('Optional: locale code to update data in (e.g., "en", "es"). Use "all" to update all locales for localized fields'),
|
|
81
|
-
select: z.string().optional().describe("Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\"siteName\": true}'")
|
|
82
|
-
})
|
|
83
|
-
},
|
|
84
|
-
// Experimental Below This Line
|
|
85
|
-
createCollection: {
|
|
86
|
-
description: 'Creates a new collection with specified fields and configuration.',
|
|
87
|
-
parameters: z.object({
|
|
88
|
-
collectionDescription: z.string().optional().describe('Optional description for the collection'),
|
|
89
|
-
collectionName: z.string().describe('The name of the collection to create'),
|
|
90
|
-
fields: z.array(z.any()).describe('Array of field definitions for the collection'),
|
|
91
|
-
hasUpload: z.boolean().optional().describe('Whether the collection should have upload capabilities')
|
|
92
|
-
})
|
|
93
|
-
},
|
|
94
|
-
findCollections: {
|
|
95
|
-
description: 'Finds and lists collections with optional content and document counts.',
|
|
96
|
-
parameters: z.object({
|
|
97
|
-
collectionName: z.string().optional().describe('Optional: specific collection name to retrieve'),
|
|
98
|
-
includeContent: z.boolean().optional().default(false).describe('Whether to include collection file content'),
|
|
99
|
-
includeCount: z.boolean().optional().default(false).describe('Whether to include document counts for each collection')
|
|
100
|
-
})
|
|
101
|
-
},
|
|
102
|
-
updateCollection: {
|
|
103
|
-
description: 'Updates an existing collection with new fields, modifications, or configuration changes.',
|
|
104
|
-
parameters: z.object({
|
|
105
|
-
collectionName: z.string().describe('The name of the collection to update'),
|
|
106
|
-
configUpdates: z.any().optional().describe('Configuration updates (for update_config type)'),
|
|
107
|
-
fieldModifications: z.array(z.any()).optional().describe('Field modifications (for modify_field type)'),
|
|
108
|
-
fieldNamesToRemove: z.array(z.string()).optional().describe('Field names to remove (for remove_field type)'),
|
|
109
|
-
newContent: z.string().optional().describe('New content to replace entire collection (for replace_content type)'),
|
|
110
|
-
newFields: z.array(z.any()).optional().describe('New fields to add (for add_field type)'),
|
|
111
|
-
updateType: z.enum([
|
|
112
|
-
'add_field',
|
|
113
|
-
'remove_field',
|
|
114
|
-
'modify_field',
|
|
115
|
-
'update_config',
|
|
116
|
-
'replace_content'
|
|
117
|
-
]).describe('Type of update to perform')
|
|
118
|
-
})
|
|
119
|
-
},
|
|
120
|
-
deleteCollection: {
|
|
121
|
-
description: 'Deletes a collection and optionally updates the configuration.',
|
|
122
|
-
parameters: z.object({
|
|
123
|
-
collectionName: z.string().describe('The name of the collection to delete'),
|
|
124
|
-
confirmDeletion: z.boolean().describe('Confirmation flag to prevent accidental deletion'),
|
|
125
|
-
updateConfig: z.boolean().optional().default(false).describe('Whether to update payload.config.ts to remove collection reference')
|
|
126
|
-
})
|
|
127
|
-
},
|
|
128
|
-
findConfig: {
|
|
129
|
-
description: 'Reads and displays the current configuration file.',
|
|
130
|
-
parameters: z.object({
|
|
131
|
-
includeMetadata: z.boolean().optional().default(false).describe('Whether to include file metadata (size, modified date, etc.)')
|
|
132
|
-
})
|
|
133
|
-
},
|
|
134
|
-
updateConfig: {
|
|
135
|
-
description: 'Updates the configuration file with various modifications.',
|
|
136
|
-
parameters: z.object({
|
|
137
|
-
adminConfig: z.any().optional().describe('Admin configuration updates (for update_admin type)'),
|
|
138
|
-
collectionName: z.string().optional().describe('Collection name (required for add_collection and remove_collection)'),
|
|
139
|
-
databaseConfig: z.any().optional().describe('Database configuration updates (for update_database type)'),
|
|
140
|
-
newContent: z.string().optional().describe('New configuration content (for replace_content type)'),
|
|
141
|
-
pluginUpdates: z.any().optional().describe('Plugin configuration updates (for update_plugins type)'),
|
|
142
|
-
updateType: z.enum([
|
|
143
|
-
'add_collection',
|
|
144
|
-
'remove_collection',
|
|
145
|
-
'update_admin',
|
|
146
|
-
'update_database',
|
|
147
|
-
'update_plugins',
|
|
148
|
-
'replace_content'
|
|
149
|
-
]).describe('Type of configuration update to perform')
|
|
150
|
-
})
|
|
151
|
-
},
|
|
152
|
-
auth: {
|
|
153
|
-
description: 'Checks authentication status for the current user.',
|
|
154
|
-
parameters: z.object({
|
|
155
|
-
headers: z.string().optional().describe('Optional JSON string containing custom headers to send with the authentication request')
|
|
156
|
-
})
|
|
157
|
-
},
|
|
158
|
-
login: {
|
|
159
|
-
description: 'Authenticates a user with email and password.',
|
|
160
|
-
parameters: z.object({
|
|
161
|
-
collection: z.string().describe('The collection containing the user (e.g., "users")'),
|
|
162
|
-
depth: z.number().int().min(0).max(10).optional().default(0).describe('Depth of population for relationships'),
|
|
163
|
-
email: z.string().email().describe('The user email address'),
|
|
164
|
-
overrideAccess: z.boolean().optional().default(false).describe('Whether to override access controls'),
|
|
165
|
-
password: z.string().describe('The user password'),
|
|
166
|
-
showHiddenFields: z.boolean().optional().default(false).describe('Whether to show hidden fields in the response')
|
|
167
|
-
})
|
|
168
|
-
},
|
|
169
|
-
verify: {
|
|
170
|
-
description: 'Verifies a user email with a verification token.',
|
|
171
|
-
parameters: z.object({
|
|
172
|
-
collection: z.string().describe('The collection containing the user (e.g., "users")'),
|
|
173
|
-
token: z.string().describe('The verification token sent to the user email')
|
|
174
|
-
})
|
|
175
|
-
},
|
|
176
|
-
resetPassword: {
|
|
177
|
-
description: 'Resets a user password with a reset token.',
|
|
178
|
-
parameters: z.object({
|
|
179
|
-
collection: z.string().describe('The collection containing the user (e.g., "users")'),
|
|
180
|
-
password: z.string().describe('The new password for the user'),
|
|
181
|
-
token: z.string().describe('The password reset token sent to the user email')
|
|
182
|
-
})
|
|
183
|
-
},
|
|
184
|
-
forgotPassword: {
|
|
185
|
-
description: 'Sends a password reset email to a user.',
|
|
186
|
-
parameters: z.object({
|
|
187
|
-
collection: z.string().describe('The collection containing the user (e.g., "users")'),
|
|
188
|
-
disableEmail: z.boolean().optional().default(false).describe('Whether to disable sending the email (for testing)'),
|
|
189
|
-
email: z.string().email().describe('The user email address')
|
|
190
|
-
})
|
|
191
|
-
},
|
|
192
|
-
unlock: {
|
|
193
|
-
description: 'Unlocks a user account that has been locked due to failed login attempts.',
|
|
194
|
-
parameters: z.object({
|
|
195
|
-
collection: z.string().describe('The collection containing the user (e.g., "users")'),
|
|
196
|
-
email: z.string().email().describe('The user email address')
|
|
197
|
-
})
|
|
198
|
-
},
|
|
199
|
-
createJob: {
|
|
200
|
-
description: 'Creates a new job (task or workflow) with specified configuration.',
|
|
201
|
-
parameters: z.object({
|
|
202
|
-
description: z.string().describe('Description of what the job does'),
|
|
203
|
-
inputSchema: z.record(z.any()).optional().default({}).describe('Input schema for the job'),
|
|
204
|
-
jobData: z.record(z.any()).optional().default({}).describe('Additional job configuration data'),
|
|
205
|
-
jobName: z.string().min(1, 'Job name cannot be empty').regex(/^[a-z][\w-]*$/i, 'Job name must be alphanumeric and can contain underscores/dashes').describe('The name of the job to create'),
|
|
206
|
-
jobSlug: z.string().min(1, 'Job slug cannot be empty').regex(/^[a-z][a-z0-9-]*$/, 'Job slug must be kebab-case').describe('The slug for the job (kebab-case format)'),
|
|
207
|
-
jobType: z.enum([
|
|
208
|
-
'task',
|
|
209
|
-
'workflow'
|
|
210
|
-
]).describe('Whether to create a task (individual unit) or workflow (orchestrates tasks)'),
|
|
211
|
-
outputSchema: z.record(z.any()).optional().default({}).describe('Output schema for the job')
|
|
212
|
-
})
|
|
213
|
-
},
|
|
214
|
-
updateJob: {
|
|
215
|
-
description: 'Updates an existing job with new configuration, schema, or handler code.',
|
|
216
|
-
parameters: z.object({
|
|
217
|
-
configUpdate: z.record(z.any()).optional().describe('New configuration for the job'),
|
|
218
|
-
handlerCode: z.string().optional().describe('New handler code to replace the existing handler'),
|
|
219
|
-
inputSchema: z.record(z.any()).optional().describe('New input schema for the job'),
|
|
220
|
-
jobSlug: z.string().describe('The slug of the job to update'),
|
|
221
|
-
outputSchema: z.record(z.any()).optional().describe('New output schema for the job'),
|
|
222
|
-
taskSequence: z.array(z.any()).optional().describe('New task sequence for workflows'),
|
|
223
|
-
updateType: z.enum([
|
|
224
|
-
'modify_schema',
|
|
225
|
-
'update_tasks',
|
|
226
|
-
'change_config',
|
|
227
|
-
'replace_handler'
|
|
228
|
-
]).describe('Type of update to perform on the job')
|
|
229
|
-
})
|
|
230
|
-
},
|
|
231
|
-
runJob: {
|
|
232
|
-
description: 'Runs a job with specified input data and queue options.',
|
|
233
|
-
parameters: z.object({
|
|
234
|
-
delay: z.number().int().min(0).optional().describe('Delay in milliseconds before job execution'),
|
|
235
|
-
input: z.record(z.any()).describe('Input data for the job execution'),
|
|
236
|
-
jobSlug: z.string().describe('The slug of the job to run'),
|
|
237
|
-
priority: z.number().int().min(1).max(10).optional().describe('Job priority (1-10, higher is more important)'),
|
|
238
|
-
queue: z.string().optional().describe('Queue name to use for job execution (default: "default")')
|
|
239
|
-
})
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/mcp/tools/schemas.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport const toolSchemas = {\n findGlobal: {\n description: 'Find a Payload global singleton configuration.',\n parameters: z.object({\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n }),\n },\n\n findResources: {\n description: 'Find documents in a collection by ID or where clause using Find or FindByID.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe(\n 'Optional: specific document ID to retrieve. If not provided, returns all documents',\n ),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('How many levels deep to populate relationships (default: 0)'),\n draft: z\n .boolean()\n .optional()\n .describe(\n 'Optional: Whether the document should be queried from the versions table/collection or not.',\n ),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n limit: z\n .number()\n .int()\n .min(1, 'Limit must be at least 1')\n .max(100, 'Limit cannot exceed 100')\n .optional()\n .default(10)\n .describe('Maximum number of documents to return (default: 10, max: 100)'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to retrieve data in (e.g., \"en\", \"es\"). Use \"all\" to retrieve all locales for localized fields',\n ),\n page: z\n .number()\n .int()\n .min(1, 'Page must be at least 1')\n .optional()\n .default(1)\n .describe('Page number for pagination (default: 1)'),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n sort: z\n .string()\n .optional()\n .describe('Field to sort by (e.g., \"createdAt\", \"-updatedAt\" for descending)'),\n where: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string for where clause filtering (e.g., \\'{\"title\": {\"contains\": \"test\"}}\\')',\n ),\n }),\n },\n\n createResource: {\n description: 'Create a document in a collection.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data for the new document'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('How many levels deep to populate relationships in response (default: 0)'),\n draft: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to create the document as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to create the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n }),\n },\n\n updateResource: {\n description: 'Update documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to update'),\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n filePath: z.string().optional().describe('Optional: absolute file path for file uploads'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update the document in (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n overrideLock: z\n .boolean()\n .optional()\n .default(true)\n .describe('Whether to override document locks'),\n overwriteExistingFiles: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to overwrite existing files'),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"title\\\": true}'\",\n ),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to update multiple documents'),\n }),\n },\n\n deleteResource: {\n description: 'Delete documents in a collection by ID or where clause.',\n parameters: z.object({\n id: z\n .union([z.string(), z.number()])\n .optional()\n .describe('Optional: specific document ID to delete'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships in response'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code for the operation (e.g., \"en\", \"es\"). Defaults to the default locale',\n ),\n where: z\n .string()\n .optional()\n .describe('Optional: JSON string for where clause to delete multiple documents'),\n }),\n },\n\n updateGlobal: {\n description: 'Update a Payload global singleton configuration.',\n parameters: z.object({\n data: z.string().describe('JSON string containing the data to update'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n draft: z.boolean().optional().default(false).describe('Whether to update as a draft'),\n fallbackLocale: z\n .string()\n .optional()\n .describe('Optional: fallback locale code to use when requested locale is not available'),\n locale: z\n .string()\n .optional()\n .describe(\n 'Optional: locale code to update data in (e.g., \"en\", \"es\"). Use \"all\" to update all locales for localized fields',\n ),\n select: z\n .string()\n .optional()\n .describe(\n \"Optional: define exactly which fields you'd like to return in the response (JSON), e.g., '{\\\"siteName\\\": true}'\",\n ),\n }),\n },\n\n // Experimental Below This Line\n createCollection: {\n description: 'Creates a new collection with specified fields and configuration.',\n parameters: z.object({\n collectionDescription: z\n .string()\n .optional()\n .describe('Optional description for the collection'),\n collectionName: z.string().describe('The name of the collection to create'),\n fields: z.array(z.any()).describe('Array of field definitions for the collection'),\n hasUpload: z\n .boolean()\n .optional()\n .describe('Whether the collection should have upload capabilities'),\n }),\n },\n\n findCollections: {\n description: 'Finds and lists collections with optional content and document counts.',\n parameters: z.object({\n collectionName: z\n .string()\n .optional()\n .describe('Optional: specific collection name to retrieve'),\n includeContent: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include collection file content'),\n includeCount: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include document counts for each collection'),\n }),\n },\n\n updateCollection: {\n description:\n 'Updates an existing collection with new fields, modifications, or configuration changes.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to update'),\n configUpdates: z.any().optional().describe('Configuration updates (for update_config type)'),\n fieldModifications: z\n .array(z.any())\n .optional()\n .describe('Field modifications (for modify_field type)'),\n fieldNamesToRemove: z\n .array(z.string())\n .optional()\n .describe('Field names to remove (for remove_field type)'),\n newContent: z\n .string()\n .optional()\n .describe('New content to replace entire collection (for replace_content type)'),\n newFields: z.array(z.any()).optional().describe('New fields to add (for add_field type)'),\n updateType: z\n .enum(['add_field', 'remove_field', 'modify_field', 'update_config', 'replace_content'])\n .describe('Type of update to perform'),\n }),\n },\n\n deleteCollection: {\n description: 'Deletes a collection and optionally updates the configuration.',\n parameters: z.object({\n collectionName: z.string().describe('The name of the collection to delete'),\n confirmDeletion: z.boolean().describe('Confirmation flag to prevent accidental deletion'),\n updateConfig: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to update payload.config.ts to remove collection reference'),\n }),\n },\n\n findConfig: {\n description: 'Reads and displays the current configuration file.',\n parameters: z.object({\n includeMetadata: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to include file metadata (size, modified date, etc.)'),\n }),\n },\n\n updateConfig: {\n description: 'Updates the configuration file with various modifications.',\n parameters: z.object({\n adminConfig: z\n .any()\n .optional()\n .describe('Admin configuration updates (for update_admin type)'),\n collectionName: z\n .string()\n .optional()\n .describe('Collection name (required for add_collection and remove_collection)'),\n databaseConfig: z\n .any()\n .optional()\n .describe('Database configuration updates (for update_database type)'),\n newContent: z\n .string()\n .optional()\n .describe('New configuration content (for replace_content type)'),\n pluginUpdates: z\n .any()\n .optional()\n .describe('Plugin configuration updates (for update_plugins type)'),\n updateType: z\n .enum([\n 'add_collection',\n 'remove_collection',\n 'update_admin',\n 'update_database',\n 'update_plugins',\n 'replace_content',\n ])\n .describe('Type of configuration update to perform'),\n }),\n },\n\n auth: {\n description: 'Checks authentication status for the current user.',\n parameters: z.object({\n headers: z\n .string()\n .optional()\n .describe(\n 'Optional JSON string containing custom headers to send with the authentication request',\n ),\n }),\n },\n\n login: {\n description: 'Authenticates a user with email and password.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .optional()\n .default(0)\n .describe('Depth of population for relationships'),\n email: z.string().email().describe('The user email address'),\n overrideAccess: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to override access controls'),\n password: z.string().describe('The user password'),\n showHiddenFields: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to show hidden fields in the response'),\n }),\n },\n\n verify: {\n description: 'Verifies a user email with a verification token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n token: z.string().describe('The verification token sent to the user email'),\n }),\n },\n\n resetPassword: {\n description: 'Resets a user password with a reset token.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n password: z.string().describe('The new password for the user'),\n token: z.string().describe('The password reset token sent to the user email'),\n }),\n },\n\n forgotPassword: {\n description: 'Sends a password reset email to a user.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n disableEmail: z\n .boolean()\n .optional()\n .default(false)\n .describe('Whether to disable sending the email (for testing)'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n unlock: {\n description: 'Unlocks a user account that has been locked due to failed login attempts.',\n parameters: z.object({\n collection: z.string().describe('The collection containing the user (e.g., \"users\")'),\n email: z.string().email().describe('The user email address'),\n }),\n },\n\n createJob: {\n description: 'Creates a new job (task or workflow) with specified configuration.',\n parameters: z.object({\n description: z.string().describe('Description of what the job does'),\n inputSchema: z.record(z.any()).optional().default({}).describe('Input schema for the job'),\n jobData: z\n .record(z.any())\n .optional()\n .default({})\n .describe('Additional job configuration data'),\n jobName: z\n .string()\n .min(1, 'Job name cannot be empty')\n .regex(/^[a-z][\\w-]*$/i, 'Job name must be alphanumeric and can contain underscores/dashes')\n .describe('The name of the job to create'),\n jobSlug: z\n .string()\n .min(1, 'Job slug cannot be empty')\n .regex(/^[a-z][a-z0-9-]*$/, 'Job slug must be kebab-case')\n .describe('The slug for the job (kebab-case format)'),\n jobType: z\n .enum(['task', 'workflow'])\n .describe('Whether to create a task (individual unit) or workflow (orchestrates tasks)'),\n outputSchema: z.record(z.any()).optional().default({}).describe('Output schema for the job'),\n }),\n },\n\n updateJob: {\n description: 'Updates an existing job with new configuration, schema, or handler code.',\n parameters: z.object({\n configUpdate: z.record(z.any()).optional().describe('New configuration for the job'),\n handlerCode: z\n .string()\n .optional()\n .describe('New handler code to replace the existing handler'),\n inputSchema: z.record(z.any()).optional().describe('New input schema for the job'),\n jobSlug: z.string().describe('The slug of the job to update'),\n outputSchema: z.record(z.any()).optional().describe('New output schema for the job'),\n taskSequence: z.array(z.any()).optional().describe('New task sequence for workflows'),\n updateType: z\n .enum(['modify_schema', 'update_tasks', 'change_config', 'replace_handler'])\n .describe('Type of update to perform on the job'),\n }),\n },\n\n runJob: {\n description: 'Runs a job with specified input data and queue options.',\n parameters: z.object({\n delay: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe('Delay in milliseconds before job execution'),\n input: z.record(z.any()).describe('Input data for the job execution'),\n jobSlug: z.string().describe('The slug of the job to run'),\n priority: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe('Job priority (1-10, higher is more important)'),\n queue: z\n .string()\n .optional()\n .describe('Queue name to use for job execution (default: \"default\")'),\n }),\n },\n}\n"],"names":["z","toolSchemas","findGlobal","description","parameters","object","depth","number","int","min","max","optional","default","describe","fallbackLocale","string","locale","select","findResources","id","union","draft","boolean","limit","page","sort","where","createResource","data","updateResource","filePath","overrideLock","overwriteExistingFiles","deleteResource","updateGlobal","createCollection","collectionDescription","collectionName","fields","array","any","hasUpload","findCollections","includeContent","includeCount","updateCollection","configUpdates","fieldModifications","fieldNamesToRemove","newContent","newFields","updateType","enum","deleteCollection","confirmDeletion","updateConfig","findConfig","includeMetadata","adminConfig","databaseConfig","pluginUpdates","auth","headers","login","collection","email","overrideAccess","password","showHiddenFields","verify","token","resetPassword","forgotPassword","disableEmail","unlock","createJob","inputSchema","record","jobData","jobName","regex","jobSlug","jobType","outputSchema","updateJob","configUpdate","handlerCode","taskSequence","runJob","delay","input","priority","queue"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAK;AAEvB,OAAO,MAAMC,cAAc;IACzBC,YAAY;QACVC,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBC,OAAON,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRC,OAAO,CAAC,GACRC,QAAQ,CAAC;YACZC,gBAAgBd,EACbe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;YACZG,QAAQhB,EACLe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CACP;YAEJI,QAAQjB,EACLe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CACP;QAEN;IACF;IAEAK,eAAe;QACbf,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBc,IAAInB,EACDoB,KAAK,CAAC;gBAACpB,EAAEe,MAAM;gBAAIf,EAAEO,MAAM;aAAG,EAC9BI,QAAQ,GACRE,QAAQ,CACP;YAEJP,OAAON,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRC,OAAO,CAAC,GACRC,QAAQ,CAAC;YACZQ,OAAOrB,EACJsB,OAAO,GACPX,QAAQ,GACRE,QAAQ,CACP;YAEJC,gBAAgBd,EACbe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;YACZU,OAAOvB,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GAAG,4BACPC,GAAG,CAAC,KAAK,2BACTC,QAAQ,GACRC,OAAO,CAAC,IACRC,QAAQ,CAAC;YACZG,QAAQhB,EACLe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAC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AQ,CAAC;YACZ+D,aAAa5E,EAAE6E,MAAM,CAAC7E,EAAEwC,GAAG,IAAI7B,QAAQ,GAAGE,QAAQ,CAAC;YACnDoE,SAASjF,EAAEe,MAAM,GAAGF,QAAQ,CAAC;YAC7BsE,cAAcnF,EAAE6E,MAAM,CAAC7E,EAAEwC,GAAG,IAAI7B,QAAQ,GAAGE,QAAQ,CAAC;YACpD0E,cAAcvF,EAAEuC,KAAK,CAACvC,EAAEwC,GAAG,IAAI7B,QAAQ,GAAGE,QAAQ,CAAC;YACnDsC,YAAYnD,EACToD,IAAI,CAAC;gBAAC;gBAAiB;gBAAgB;gBAAiB;aAAkB,EAC1EvC,QAAQ,CAAC;QACd;IACF;IAEA2E,QAAQ;QACNrF,aAAa;QACbC,YAAYJ,EAAEK,MAAM,CAAC;YACnBoF,OAAOzF,EACJO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJE,QAAQ,GACRE,QAAQ,CAAC;YACZ6E,OAAO1F,EAAE6E,MAAM,CAAC7E,EAAEwC,GAAG,IAAI3B,QAAQ,CAAC;YAClCoE,SAASjF,EAAEe,MAAM,GAAGF,QAAQ,CAAC;YAC7B8E,UAAU3F,EACPO,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJC,QAAQ,GACRE,QAAQ,CAAC;YACZ+E,OAAO5F,EACJe,MAAM,GACNJ,QAAQ,GACRE,QAAQ,CAAC;QACd;IACF;AACF,EAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines the default admin entity settings for Collections and Globals.
|
|
3
|
-
* This is used to create the MCP API key permission fields for the API Keys collection.
|
|
4
|
-
*/
|
|
5
|
-
export declare const adminEntitySettings: {
|
|
6
|
-
collection: {
|
|
7
|
-
name: string;
|
|
8
|
-
description: (slug: string) => string;
|
|
9
|
-
label: string;
|
|
10
|
-
}[];
|
|
11
|
-
global: {
|
|
12
|
-
name: string;
|
|
13
|
-
description: (slug: string) => string;
|
|
14
|
-
label: string;
|
|
15
|
-
}[];
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=adminEntitySettings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adminEntitySettings.d.ts","sourceRoot":"","sources":["../../src/utils/adminEntitySettings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;4BAIN,MAAM;;;;;4BAsBN,MAAM;;;CAS/B,CAAA"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines the default admin entity settings for Collections and Globals.
|
|
3
|
-
* This is used to create the MCP API key permission fields for the API Keys collection.
|
|
4
|
-
*/ export const adminEntitySettings = {
|
|
5
|
-
collection: [
|
|
6
|
-
{
|
|
7
|
-
name: 'find',
|
|
8
|
-
description: (slug)=>`Allow clients to find ${slug}.`,
|
|
9
|
-
label: 'Find'
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: 'create',
|
|
13
|
-
description: (slug)=>`Allow clients to create ${slug}.`,
|
|
14
|
-
label: 'Create'
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: 'update',
|
|
18
|
-
description: (slug)=>`Allow clients to update ${slug}.`,
|
|
19
|
-
label: 'Update'
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: 'delete',
|
|
23
|
-
description: (slug)=>`Allow clients to delete ${slug}.`,
|
|
24
|
-
label: 'Delete'
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
global: [
|
|
28
|
-
{
|
|
29
|
-
name: 'find',
|
|
30
|
-
description: (slug)=>`Allow clients to find ${slug} global.`,
|
|
31
|
-
label: 'Find'
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'update',
|
|
35
|
-
description: (slug)=>`Allow clients to update ${slug} global.`,
|
|
36
|
-
label: 'Update'
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=adminEntitySettings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/adminEntitySettings.ts"],"sourcesContent":["/**\n * Defines the default admin entity settings for Collections and Globals.\n * This is used to create the MCP API key permission fields for the API Keys collection.\n */\nexport const adminEntitySettings = {\n collection: [\n {\n name: 'find',\n description: (slug: string) => `Allow clients to find ${slug}.`,\n label: 'Find',\n },\n {\n name: 'create',\n description: (slug: string) => `Allow clients to create ${slug}.`,\n label: 'Create',\n },\n {\n name: 'update',\n description: (slug: string) => `Allow clients to update ${slug}.`,\n label: 'Update',\n },\n {\n name: 'delete',\n description: (slug: string) => `Allow clients to delete ${slug}.`,\n label: 'Delete',\n },\n ],\n global: [\n {\n name: 'find',\n description: (slug: string) => `Allow clients to find ${slug} global.`,\n label: 'Find',\n },\n {\n name: 'update',\n description: (slug: string) => `Allow clients to update ${slug} global.`,\n label: 'Update',\n },\n ],\n}\n"],"names":["adminEntitySettings","collection","name","description","slug","label","global"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,sBAAsB;IACjCC,YAAY;QACV;YACEC,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,sBAAsB,EAAEA,KAAK,CAAC,CAAC;YAC/DC,OAAO;QACT;QACA;YACEH,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,wBAAwB,EAAEA,KAAK,CAAC,CAAC;YACjEC,OAAO;QACT;QACA;YACEH,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,wBAAwB,EAAEA,KAAK,CAAC,CAAC;YACjEC,OAAO;QACT;QACA;YACEH,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,wBAAwB,EAAEA,KAAK,CAAC,CAAC;YACjEC,OAAO;QACT;KACD;IACDC,QAAQ;QACN;YACEJ,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,sBAAsB,EAAEA,KAAK,QAAQ,CAAC;YACtEC,OAAO;QACT;QACA;YACEH,MAAM;YACNC,aAAa,CAACC,OAAiB,CAAC,wBAAwB,EAAEA,KAAK,QAAQ,CAAC;YACxEC,OAAO;QACT;KACD;AACH,EAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Field } from 'payload';
|
|
2
|
-
import type { EntityConfig } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates MCP API key permission fields using collections or globals.
|
|
5
|
-
* Generates collapsible field groups with checkboxes for each enabled operation.
|
|
6
|
-
*
|
|
7
|
-
* @param config - The collections or globals configuration object
|
|
8
|
-
* @param configType - The type of configuration ('collection' or 'global')
|
|
9
|
-
* @returns Array of fields for the MCP API Keys collection
|
|
10
|
-
*/
|
|
11
|
-
export declare const createApiKeyFields: ({ config, configType, }: {
|
|
12
|
-
config: EntityConfig | undefined;
|
|
13
|
-
configType: "collection" | "global";
|
|
14
|
-
}) => Field[];
|
|
15
|
-
//# sourceMappingURL=createApiKeyFields.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createApiKeyFields.d.ts","sourceRoot":"","sources":["../../src/utils/createApiKeyFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAK/C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,4BAG5B;IACD,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IAChC,UAAU,EAAE,YAAY,GAAG,QAAQ,CAAA;CACpC,KAAG,KAAK,EAkDR,CAAA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { adminEntitySettings } from './adminEntitySettings.js';
|
|
2
|
-
import { toCamelCase } from './camelCase.js';
|
|
3
|
-
import { getEnabledSlugs } from './getEnabledSlugs.js';
|
|
4
|
-
/**
|
|
5
|
-
* Creates MCP API key permission fields using collections or globals.
|
|
6
|
-
* Generates collapsible field groups with checkboxes for each enabled operation.
|
|
7
|
-
*
|
|
8
|
-
* @param config - The collections or globals configuration object
|
|
9
|
-
* @param configType - The type of configuration ('collection' or 'global')
|
|
10
|
-
* @returns Array of fields for the MCP API Keys collection
|
|
11
|
-
*/ export const createApiKeyFields = ({ config, configType })=>{
|
|
12
|
-
const operations = adminEntitySettings[configType];
|
|
13
|
-
const enabledSlugs = getEnabledSlugs(config, configType);
|
|
14
|
-
return enabledSlugs.map((slug)=>{
|
|
15
|
-
const entityConfig = config?.[slug];
|
|
16
|
-
const enabledOperations = operations.filter((operation)=>{
|
|
17
|
-
// If fully enabled, all operations are available
|
|
18
|
-
if (entityConfig?.enabled === true) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
// If partially enabled, check if this specific operation is enabled
|
|
22
|
-
const enabled = entityConfig?.enabled;
|
|
23
|
-
if (typeof enabled !== 'boolean' && enabled) {
|
|
24
|
-
const operationEnabled = enabled[operation.name];
|
|
25
|
-
return typeof operationEnabled === 'boolean' && operationEnabled === true;
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
});
|
|
29
|
-
// Generate checkbox fields for each enabled operation
|
|
30
|
-
const operationFields = enabledOperations.map((operation)=>({
|
|
31
|
-
name: operation.name,
|
|
32
|
-
type: 'checkbox',
|
|
33
|
-
admin: {
|
|
34
|
-
description: operation.description(slug)
|
|
35
|
-
},
|
|
36
|
-
defaultValue: false,
|
|
37
|
-
label: operation.label
|
|
38
|
-
}));
|
|
39
|
-
return {
|
|
40
|
-
type: 'collapsible',
|
|
41
|
-
admin: {
|
|
42
|
-
position: 'sidebar'
|
|
43
|
-
},
|
|
44
|
-
fields: [
|
|
45
|
-
{
|
|
46
|
-
name: toCamelCase(slug),
|
|
47
|
-
type: 'group',
|
|
48
|
-
fields: operationFields,
|
|
49
|
-
label: configType
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
label: `${slug.charAt(0).toUpperCase() + toCamelCase(slug).slice(1)}`
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
//# sourceMappingURL=createApiKeyFields.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/createApiKeyFields.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport type { EntityConfig } from '../types.js'\n\nimport { adminEntitySettings } from './adminEntitySettings.js'\nimport { toCamelCase } from './camelCase.js'\nimport { getEnabledSlugs } from './getEnabledSlugs.js'\n/**\n * Creates MCP API key permission fields using collections or globals.\n * Generates collapsible field groups with checkboxes for each enabled operation.\n *\n * @param config - The collections or globals configuration object\n * @param configType - The type of configuration ('collection' or 'global')\n * @returns Array of fields for the MCP API Keys collection\n */\nexport const createApiKeyFields = ({\n config,\n configType,\n}: {\n config: EntityConfig | undefined\n configType: 'collection' | 'global'\n}): Field[] => {\n const operations = adminEntitySettings[configType]\n const enabledSlugs = getEnabledSlugs(config, configType)\n\n return enabledSlugs.map((slug) => {\n const entityConfig = config?.[slug]\n\n const enabledOperations = operations.filter((operation) => {\n // If fully enabled, all operations are available\n if (entityConfig?.enabled === true) {\n return true\n }\n\n // If partially enabled, check if this specific operation is enabled\n const enabled = entityConfig?.enabled\n if (typeof enabled !== 'boolean' && enabled) {\n const operationEnabled = enabled[operation.name as keyof typeof enabled]\n return typeof operationEnabled === 'boolean' && operationEnabled === true\n }\n\n return false\n })\n\n // Generate checkbox fields for each enabled operation\n const operationFields = enabledOperations.map((operation) => ({\n name: operation.name,\n type: 'checkbox' as const,\n admin: {\n description: operation.description(slug),\n },\n defaultValue: false,\n label: operation.label,\n }))\n\n return {\n type: 'collapsible' as const,\n admin: {\n position: 'sidebar' as const,\n },\n fields: [\n {\n name: toCamelCase(slug),\n type: 'group' as const,\n fields: operationFields,\n label: configType,\n },\n ],\n label: `${slug.charAt(0).toUpperCase() + toCamelCase(slug).slice(1)}`,\n }\n })\n}\n"],"names":["adminEntitySettings","toCamelCase","getEnabledSlugs","createApiKeyFields","config","configType","operations","enabledSlugs","map","slug","entityConfig","enabledOperations","filter","operation","enabled","operationEnabled","name","operationFields","type","admin","description","defaultValue","label","position","fields","charAt","toUpperCase","slice"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,WAAW,QAAQ,iBAAgB;AAC5C,SAASC,eAAe,QAAQ,uBAAsB;AACtD;;;;;;;CAOC,GACD,OAAO,MAAMC,qBAAqB,CAAC,EACjCC,MAAM,EACNC,UAAU,EAIX;IACC,MAAMC,aAAaN,mBAAmB,CAACK,WAAW;IAClD,MAAME,eAAeL,gBAAgBE,QAAQC;IAE7C,OAAOE,aAAaC,GAAG,CAAC,CAACC;QACvB,MAAMC,eAAeN,QAAQ,CAACK,KAAK;QAEnC,MAAME,oBAAoBL,WAAWM,MAAM,CAAC,CAACC;YAC3C,iDAAiD;YACjD,IAAIH,cAAcI,YAAY,MAAM;gBAClC,OAAO;YACT;YAEA,oEAAoE;YACpE,MAAMA,UAAUJ,cAAcI;YAC9B,IAAI,OAAOA,YAAY,aAAaA,SAAS;gBAC3C,MAAMC,mBAAmBD,OAAO,CAACD,UAAUG,IAAI,CAAyB;gBACxE,OAAO,OAAOD,qBAAqB,aAAaA,qBAAqB;YACvE;YAEA,OAAO;QACT;QAEA,sDAAsD;QACtD,MAAME,kBAAkBN,kBAAkBH,GAAG,CAAC,CAACK,YAAe,CAAA;gBAC5DG,MAAMH,UAAUG,IAAI;gBACpBE,MAAM;gBACNC,OAAO;oBACLC,aAAaP,UAAUO,WAAW,CAACX;gBACrC;gBACAY,cAAc;gBACdC,OAAOT,UAAUS,KAAK;YACxB,CAAA;QAEA,OAAO;YACLJ,MAAM;YACNC,OAAO;gBACLI,UAAU;YACZ;YACAC,QAAQ;gBACN;oBACER,MAAMf,YAAYQ;oBAClBS,MAAM;oBACNM,QAAQP;oBACRK,OAAOjB;gBACT;aACD;YACDiB,OAAO,GAAGb,KAAKgB,MAAM,CAAC,GAAGC,WAAW,KAAKzB,YAAYQ,MAAMkB,KAAK,CAAC,IAAI;QACvE;IACF;AACF,EAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { EntityConfig } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Extracts enabled slugs from collections or globals configuration.
|
|
4
|
-
* A slug is considered enabled if:
|
|
5
|
-
* 1. enabled is set to true (fully enabled)
|
|
6
|
-
* 2. enabled is an object with at least one operation set to true
|
|
7
|
-
*
|
|
8
|
-
* @param config - The collections or globals configuration object
|
|
9
|
-
* @param configType - The type of configuration ('collection' or 'global')
|
|
10
|
-
* @returns Array of enabled slugs
|
|
11
|
-
*/
|
|
12
|
-
export declare const getEnabledSlugs: (config: EntityConfig | undefined, configType: "collection" | "global") => string[];
|
|
13
|
-
//# sourceMappingURL=getEnabledSlugs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getEnabledSlugs.d.ts","sourceRoot":"","sources":["../../src/utils/getEnabledSlugs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,WAClB,YAAY,GAAG,SAAS,cACpB,YAAY,GAAG,QAAQ,KAClC,MAAM,EAwBR,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { adminEntitySettings } from './adminEntitySettings.js';
|
|
2
|
-
/**
|
|
3
|
-
* Extracts enabled slugs from collections or globals configuration.
|
|
4
|
-
* A slug is considered enabled if:
|
|
5
|
-
* 1. enabled is set to true (fully enabled)
|
|
6
|
-
* 2. enabled is an object with at least one operation set to true
|
|
7
|
-
*
|
|
8
|
-
* @param config - The collections or globals configuration object
|
|
9
|
-
* @param configType - The type of configuration ('collection' or 'global')
|
|
10
|
-
* @returns Array of enabled slugs
|
|
11
|
-
*/ export const getEnabledSlugs = (config, configType)=>{
|
|
12
|
-
return Object.keys(config || {}).filter((slug)=>{
|
|
13
|
-
const entityConfig = config?.[slug];
|
|
14
|
-
const operations = adminEntitySettings[configType];
|
|
15
|
-
// Check if fully enabled (boolean true)
|
|
16
|
-
const fullyEnabled = typeof entityConfig?.enabled === 'boolean' && entityConfig?.enabled === true;
|
|
17
|
-
if (fullyEnabled) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
// Check if partially enabled (at least one operation is enabled)
|
|
21
|
-
const enabled = entityConfig?.enabled;
|
|
22
|
-
if (typeof enabled !== 'boolean' && enabled) {
|
|
23
|
-
return operations.some((operation)=>{
|
|
24
|
-
const operationEnabled = enabled[operation.name];
|
|
25
|
-
return typeof operationEnabled === 'boolean' && operationEnabled === true;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=getEnabledSlugs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/getEnabledSlugs.ts"],"sourcesContent":["import type { EntityConfig } from '../types.js'\n\nimport { adminEntitySettings } from './adminEntitySettings.js'\n\n/**\n * Extracts enabled slugs from collections or globals configuration.\n * A slug is considered enabled if:\n * 1. enabled is set to true (fully enabled)\n * 2. enabled is an object with at least one operation set to true\n *\n * @param config - The collections or globals configuration object\n * @param configType - The type of configuration ('collection' or 'global')\n * @returns Array of enabled slugs\n */\nexport const getEnabledSlugs = (\n config: EntityConfig | undefined,\n configType: 'collection' | 'global',\n): string[] => {\n return Object.keys(config || {}).filter((slug) => {\n const entityConfig = config?.[slug]\n const operations = adminEntitySettings[configType]\n\n // Check if fully enabled (boolean true)\n const fullyEnabled =\n typeof entityConfig?.enabled === 'boolean' && entityConfig?.enabled === true\n\n if (fullyEnabled) {\n return true\n }\n\n // Check if partially enabled (at least one operation is enabled)\n const enabled = entityConfig?.enabled\n if (typeof enabled !== 'boolean' && enabled) {\n return operations.some((operation) => {\n const operationEnabled = enabled[operation.name as keyof typeof enabled]\n return typeof operationEnabled === 'boolean' && operationEnabled === true\n })\n }\n\n return false\n })\n}\n"],"names":["adminEntitySettings","getEnabledSlugs","config","configType","Object","keys","filter","slug","entityConfig","operations","fullyEnabled","enabled","some","operation","operationEnabled","name"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,2BAA0B;AAE9D;;;;;;;;;CASC,GACD,OAAO,MAAMC,kBAAkB,CAC7BC,QACAC;IAEA,OAAOC,OAAOC,IAAI,CAACH,UAAU,CAAC,GAAGI,MAAM,CAAC,CAACC;QACvC,MAAMC,eAAeN,QAAQ,CAACK,KAAK;QACnC,MAAME,aAAaT,mBAAmB,CAACG,WAAW;QAElD,wCAAwC;QACxC,MAAMO,eACJ,OAAOF,cAAcG,YAAY,aAAaH,cAAcG,YAAY;QAE1E,IAAID,cAAc;YAChB,OAAO;QACT;QAEA,iEAAiE;QACjE,MAAMC,UAAUH,cAAcG;QAC9B,IAAI,OAAOA,YAAY,aAAaA,SAAS;YAC3C,OAAOF,WAAWG,IAAI,CAAC,CAACC;gBACtB,MAAMC,mBAAmBH,OAAO,CAACE,UAAUE,IAAI,CAAyB;gBACxE,OAAO,OAAOD,qBAAqB,aAAaA,qBAAqB;YACvE;QACF;QAEA,OAAO;IACT;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertCollectionSchemaToZod.d.ts","sourceRoot":"","sources":["../../../src/utils/schemaConversion/convertCollectionSchemaToZod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAU9C,eAAO,MAAM,4BAA4B,WAAY,WAAW,QAyC/D,CAAA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsonSchemaToZod } from 'json-schema-to-zod';
|
|
2
|
-
import * as ts from 'typescript';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { sanitizeJsonSchema } from './sanitizeJsonSchema.js';
|
|
5
|
-
import { simplifyRelationshipFields } from './simplifyRelationshipFields.js';
|
|
6
|
-
import { transformPointFieldsForMCP } from './transformPointFields.js';
|
|
7
|
-
export const convertCollectionSchemaToZod = (schema)=>{
|
|
8
|
-
try {
|
|
9
|
-
// Clone to avoid mutating the original schema (used elsewhere for tool listing)
|
|
10
|
-
const schemaClone = JSON.parse(JSON.stringify(schema));
|
|
11
|
-
const sanitized = sanitizeJsonSchema(schemaClone);
|
|
12
|
-
const pointTransformed = transformPointFieldsForMCP(sanitized);
|
|
13
|
-
const zodSchemaAsString = jsonSchemaToZod(simplifyRelationshipFields(pointTransformed));
|
|
14
|
-
// Transpile TypeScript to JavaScript
|
|
15
|
-
const transpileResult = ts.transpileModule(zodSchemaAsString, {
|
|
16
|
-
compilerOptions: {
|
|
17
|
-
module: ts.ModuleKind.CommonJS,
|
|
18
|
-
removeComments: true,
|
|
19
|
-
strict: false,
|
|
20
|
-
target: ts.ScriptTarget.ES2018
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
/**
|
|
24
|
-
* This Function evaluation is safe because:
|
|
25
|
-
* 1. The input schema comes from Payload's collection configuration, which is controlled by the application developer
|
|
26
|
-
* 2. The jsonSchemaToZod library converts JSON Schema to Zod schema definitions, producing only type validation code
|
|
27
|
-
* 3. The transpiled output contains only Zod schema definitions (z.string(), z.number(), etc.) - no executable logic
|
|
28
|
-
* 4. The resulting Zod schema is used only for parameter validation in MCP tools, not for data processing
|
|
29
|
-
* 5. No user input or external data is involved in the schema generation process
|
|
30
|
-
*/ // eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
31
|
-
return new Function('z', `return ${transpileResult.outputText}`)(z);
|
|
32
|
-
} catch (error) {
|
|
33
|
-
// If schema conversion fails (e.g., due to Zod v4 toJSONSchema null-check bug
|
|
34
|
-
// with record schemas that have undefined valueType, or bundler transforms
|
|
35
|
-
// stripping Zod internals), return a permissive schema so tools/list doesn't
|
|
36
|
-
// crash entirely. The tool will still be listed but without strict validation.
|
|
37
|
-
// See: https://github.com/colinhacks/zod/issues/5821
|
|
38
|
-
console.warn(`[plugin-mcp] Schema conversion failed, using permissive fallback:`, error instanceof Error ? error.message : error);
|
|
39
|
-
return z.record(z.any());
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=convertCollectionSchemaToZod.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/schemaConversion/convertCollectionSchemaToZod.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { jsonSchemaToZod } from 'json-schema-to-zod'\nimport * as ts from 'typescript'\nimport { z } from 'zod'\n\nimport { sanitizeJsonSchema } from './sanitizeJsonSchema.js'\nimport { simplifyRelationshipFields } from './simplifyRelationshipFields.js'\nimport { transformPointFieldsForMCP } from './transformPointFields.js'\n\nexport const convertCollectionSchemaToZod = (schema: JSONSchema4) => {\n try {\n // Clone to avoid mutating the original schema (used elsewhere for tool listing)\n const schemaClone = JSON.parse(JSON.stringify(schema)) as JSONSchema4\n\n const sanitized = sanitizeJsonSchema(schemaClone)\n const pointTransformed = transformPointFieldsForMCP(sanitized)\n const zodSchemaAsString = jsonSchemaToZod(simplifyRelationshipFields(pointTransformed))\n\n // Transpile TypeScript to JavaScript\n const transpileResult = ts.transpileModule(zodSchemaAsString, {\n compilerOptions: {\n module: ts.ModuleKind.CommonJS,\n removeComments: true,\n strict: false,\n target: ts.ScriptTarget.ES2018,\n },\n })\n\n /**\n * This Function evaluation is safe because:\n * 1. The input schema comes from Payload's collection configuration, which is controlled by the application developer\n * 2. The jsonSchemaToZod library converts JSON Schema to Zod schema definitions, producing only type validation code\n * 3. The transpiled output contains only Zod schema definitions (z.string(), z.number(), etc.) - no executable logic\n * 4. The resulting Zod schema is used only for parameter validation in MCP tools, not for data processing\n * 5. No user input or external data is involved in the schema generation process\n */\n // eslint-disable-next-line @typescript-eslint/no-implied-eval\n return new Function('z', `return ${transpileResult.outputText}`)(z)\n } catch (error) {\n // If schema conversion fails (e.g., due to Zod v4 toJSONSchema null-check bug\n // with record schemas that have undefined valueType, or bundler transforms\n // stripping Zod internals), return a permissive schema so tools/list doesn't\n // crash entirely. The tool will still be listed but without strict validation.\n // See: https://github.com/colinhacks/zod/issues/5821\n console.warn(\n `[plugin-mcp] Schema conversion failed, using permissive fallback:`,\n error instanceof Error ? error.message : error,\n )\n return z.record(z.any())\n }\n}\n"],"names":["jsonSchemaToZod","ts","z","sanitizeJsonSchema","simplifyRelationshipFields","transformPointFieldsForMCP","convertCollectionSchemaToZod","schema","schemaClone","JSON","parse","stringify","sanitized","pointTransformed","zodSchemaAsString","transpileResult","transpileModule","compilerOptions","module","ModuleKind","CommonJS","removeComments","strict","target","ScriptTarget","ES2018","Function","outputText","error","console","warn","Error","message","record","any"],"mappings":"AAEA,SAASA,eAAe,QAAQ,qBAAoB;AACpD,YAAYC,QAAQ,aAAY;AAChC,SAASC,CAAC,QAAQ,MAAK;AAEvB,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,0BAA0B,QAAQ,kCAAiC;AAC5E,SAASC,0BAA0B,QAAQ,4BAA2B;AAEtE,OAAO,MAAMC,+BAA+B,CAACC;IAC3C,IAAI;QACF,gFAAgF;QAChF,MAAMC,cAAcC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACJ;QAE9C,MAAMK,YAAYT,mBAAmBK;QACrC,MAAMK,mBAAmBR,2BAA2BO;QACpD,MAAME,oBAAoBd,gBAAgBI,2BAA2BS;QAErE,qCAAqC;QACrC,MAAME,kBAAkBd,GAAGe,eAAe,CAACF,mBAAmB;YAC5DG,iBAAiB;gBACfC,QAAQjB,GAAGkB,UAAU,CAACC,QAAQ;gBAC9BC,gBAAgB;gBAChBC,QAAQ;gBACRC,QAAQtB,GAAGuB,YAAY,CAACC,MAAM;YAChC;QACF;QAEA;;;;;;;KAOC,GACD,8DAA8D;QAC9D,OAAO,IAAIC,SAAS,KAAK,CAAC,OAAO,EAAEX,gBAAgBY,UAAU,EAAE,EAAEzB;IACnE,EAAE,OAAO0B,OAAO;QACd,8EAA8E;QAC9E,2EAA2E;QAC3E,6EAA6E;QAC7E,+EAA+E;QAC/E,qDAAqD;QACrDC,QAAQC,IAAI,CACV,CAAC,iEAAiE,CAAC,EACnEF,iBAAiBG,QAAQH,MAAMI,OAAO,GAAGJ;QAE3C,OAAO1B,EAAE+B,MAAM,CAAC/B,EAAEgC,GAAG;IACvB;AACF,EAAC"}
|