@payloadcms/plugin-mcp 3.86.0-internal.ac46214 → 4.0.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +60 -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 +199 -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 +94 -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 +102 -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 +144 -0
- package/dist/mcp/builtin/collections/findTool.js.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts +9 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.js +60 -0
- package/dist/mcp/builtin/collections/formatCollectionError.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 +35 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.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 +199 -0
- package/dist/mcp/builtin/collections/updateTool.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 +49 -0
- package/dist/mcp/builtin/getConfigInfoTool.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/getGlobalSchemaTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +35 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.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 +94 -0
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -0
- package/dist/mcp/builtin/validateEntityData.d.ts +14 -0
- package/dist/mcp/builtin/validateEntityData.d.ts.map +1 -0
- package/dist/mcp/builtin/validateEntityData.js +82 -0
- package/dist/mcp/builtin/validateEntityData.js.map +1 -0
- package/dist/mcp/builtinTools.d.ts +105 -0
- package/dist/mcp/builtinTools.d.ts.map +1 -0
- package/dist/mcp/builtinTools.js +107 -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 +188 -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 +251 -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/getEntityInputSchema.d.ts +11 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.js +34 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.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/sanitizeEntitySchema.d.ts +15 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js +464 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +1 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +158 -0
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +1 -0
- 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/dist/utils/whereSchema.d.ts +9 -0
- package/dist/utils/whereSchema.d.ts.map +1 -0
- package/dist/utils/whereSchema.js +13 -0
- package/dist/utils/whereSchema.js.map +1 -0
- package/package.json +35 -10
- package/src/collection/getAccessField.ts +64 -0
- package/src/collection/index.ts +64 -0
- package/src/components/AccessField/index.client.tsx +347 -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 +257 -0
- package/src/mcp/builtin/collections/authTools.ts +233 -0
- package/src/mcp/builtin/collections/createTool.ts +112 -0
- package/src/mcp/builtin/collections/deleteTool.ts +116 -0
- package/src/mcp/builtin/collections/findTool.ts +177 -0
- package/src/mcp/builtin/collections/formatCollectionError.ts +84 -0
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +28 -0
- package/src/mcp/builtin/collections/updateTool.ts +211 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +44 -0
- package/src/mcp/builtin/globals/findTool.ts +96 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +28 -0
- package/src/mcp/builtin/globals/updateTool.ts +115 -0
- package/src/mcp/builtin/validateEntityData.ts +132 -0
- package/src/mcp/builtinTools.ts +98 -0
- package/src/mcp/sanitizeMCPConfig.ts +260 -0
- package/src/stdio.ts +98 -0
- package/src/types.ts +290 -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/getEntityInputSchema.ts +78 -0
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +3 -3
- package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +103 -0
- package/src/utils/schemaConversion/sanitizeEntitySchema.ts +529 -0
- package/src/utils/toStandardSchema.ts +9 -0
- package/src/utils/whereSchema.ts +24 -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/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts +0 -13
- package/dist/utils/schemaConversion/sanitizeJsonSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js +0 -56
- package/dist/utils/schemaConversion/sanitizeJsonSchema.js.map +0 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts +0 -20
- package/dist/utils/schemaConversion/simplifyRelationshipFields.d.ts.map +0 -1
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js +0 -53
- package/dist/utils/schemaConversion/simplifyRelationshipFields.js.map +0 -1
- package/dist/utils/schemaConversion/transformPointFields.d.ts +0 -3
- package/dist/utils/schemaConversion/transformPointFields.d.ts.map +0 -1
- package/dist/utils/schemaConversion/transformPointFields.js +0 -51
- package/dist/utils/schemaConversion/transformPointFields.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
- package/src/utils/schemaConversion/sanitizeJsonSchema.ts +0 -62
- package/src/utils/schemaConversion/simplifyRelationshipFields.ts +0 -65
- package/src/utils/schemaConversion/transformPointFields.ts +0 -55
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
-
import type { PayloadRequest } from 'payload'
|
|
3
|
-
|
|
4
|
-
import { toolSchemas } from '../schemas.js'
|
|
5
|
-
|
|
6
|
-
export const unlockTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {
|
|
7
|
-
const tool = async (collection: string, email: string) => {
|
|
8
|
-
const payload = req.payload
|
|
9
|
-
|
|
10
|
-
if (verboseLogs) {
|
|
11
|
-
payload.logger.info(
|
|
12
|
-
`[payload-mcp] Unlocking user account for user: ${email} in collection: ${collection}`,
|
|
13
|
-
)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
const result = await payload.unlock({
|
|
18
|
-
collection,
|
|
19
|
-
data: {
|
|
20
|
-
email,
|
|
21
|
-
},
|
|
22
|
-
overrideAccess: true,
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
if (verboseLogs) {
|
|
26
|
-
payload.logger.info(`[payload-mcp] User account unlocked successfully for user: ${email}`)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
content: [
|
|
31
|
-
{
|
|
32
|
-
type: 'text' as const,
|
|
33
|
-
text: `# User Account Unlocked\n\n**User:** ${email}\n**Collection:** ${collection}\n\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
}
|
|
37
|
-
} catch (error) {
|
|
38
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
39
|
-
payload.logger.error(
|
|
40
|
-
`[payload-mcp] Error unlocking user account for user ${email}: ${errorMessage}`,
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
content: [
|
|
45
|
-
{
|
|
46
|
-
type: 'text' as const,
|
|
47
|
-
text: `❌ **Error unlocking user account for user "${email}"**: ${errorMessage}`,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
server.registerTool(
|
|
55
|
-
'unlock',
|
|
56
|
-
{
|
|
57
|
-
description: toolSchemas.unlock.description,
|
|
58
|
-
inputSchema: toolSchemas.unlock.parameters.shape,
|
|
59
|
-
},
|
|
60
|
-
async ({ collection, email }) => {
|
|
61
|
-
return await tool(collection, email)
|
|
62
|
-
},
|
|
63
|
-
)
|
|
64
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
-
import type { PayloadRequest } from 'payload'
|
|
3
|
-
|
|
4
|
-
import { toolSchemas } from '../schemas.js'
|
|
5
|
-
|
|
6
|
-
export const verifyTool = (server: McpServer, req: PayloadRequest, verboseLogs: boolean) => {
|
|
7
|
-
const tool = async (collection: string, token: string) => {
|
|
8
|
-
const payload = req.payload
|
|
9
|
-
|
|
10
|
-
if (verboseLogs) {
|
|
11
|
-
payload.logger.info(`[payload-mcp] Verifying user account for collection: ${collection}`)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
const result = await payload.verifyEmail({
|
|
16
|
-
collection,
|
|
17
|
-
token,
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
if (verboseLogs) {
|
|
21
|
-
payload.logger.info('[payload-mcp] Email verification completed successfully')
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
content: [
|
|
26
|
-
{
|
|
27
|
-
type: 'text' as const,
|
|
28
|
-
text: `# Email Verification Successful\n\n**Collection:** ${collection}\n**Token:** ${token}\n**Result:** ${result ? 'Success' : 'Failed'}`,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
}
|
|
32
|
-
} catch (error) {
|
|
33
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
34
|
-
payload.logger.error(`[payload-mcp] Error verifying email: ${errorMessage}`)
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
content: [
|
|
38
|
-
{
|
|
39
|
-
type: 'text' as const,
|
|
40
|
-
text: `❌ **Error verifying email**: ${errorMessage}`,
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
server.registerTool(
|
|
48
|
-
'verify',
|
|
49
|
-
{
|
|
50
|
-
description: toolSchemas.verify.description,
|
|
51
|
-
inputSchema: toolSchemas.verify.parameters.shape,
|
|
52
|
-
},
|
|
53
|
-
async ({ collection, token }) => {
|
|
54
|
-
return await tool(collection, token)
|
|
55
|
-
},
|
|
56
|
-
)
|
|
57
|
-
}
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
-
import type { PayloadRequest } from 'payload'
|
|
3
|
-
|
|
4
|
-
import { writeFileSync } from 'fs'
|
|
5
|
-
import { join } from 'path'
|
|
6
|
-
|
|
7
|
-
import { generateFieldDefinitionString } from '../../helpers/fields.js'
|
|
8
|
-
import { validateCollectionFile } from '../../helpers/fileValidation.js'
|
|
9
|
-
import { toolSchemas } from '../schemas.js'
|
|
10
|
-
|
|
11
|
-
export const createCollection = async (
|
|
12
|
-
req: PayloadRequest,
|
|
13
|
-
verboseLogs: boolean,
|
|
14
|
-
collectionsDirPath: string,
|
|
15
|
-
configFilePath: string,
|
|
16
|
-
collectionName: string,
|
|
17
|
-
collectionDescription: string | undefined,
|
|
18
|
-
fields: any[],
|
|
19
|
-
hasUpload: boolean | undefined,
|
|
20
|
-
) => {
|
|
21
|
-
const payload = req.payload
|
|
22
|
-
if (verboseLogs) {
|
|
23
|
-
payload.logger.info(
|
|
24
|
-
`[payload-mcp] Creating collection: ${collectionName} with ${fields.length} fields`,
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const capitalizedName = collectionName.charAt(0).toUpperCase() + collectionName.slice(1)
|
|
29
|
-
const slug = collectionName
|
|
30
|
-
.replace(/([A-Z])/g, '-$1')
|
|
31
|
-
.toLowerCase()
|
|
32
|
-
.replace(/^-/, '')
|
|
33
|
-
|
|
34
|
-
if (verboseLogs) {
|
|
35
|
-
payload.logger.info(`[payload-mcp] Generated slug: ${slug} for collection: ${collectionName}`)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const fieldDefinitions = fields.map(generateFieldDefinitionString).join('\n')
|
|
39
|
-
|
|
40
|
-
// Generate collection file content
|
|
41
|
-
const collectionContent = `import type { CollectionConfig } from 'payload'
|
|
42
|
-
|
|
43
|
-
export const ${capitalizedName}: CollectionConfig = {
|
|
44
|
-
slug: '${slug}',${
|
|
45
|
-
collectionDescription
|
|
46
|
-
? `
|
|
47
|
-
admin: {
|
|
48
|
-
description: '${collectionDescription}',
|
|
49
|
-
},`
|
|
50
|
-
: ''
|
|
51
|
-
}${
|
|
52
|
-
hasUpload
|
|
53
|
-
? `
|
|
54
|
-
upload: true,`
|
|
55
|
-
: ''
|
|
56
|
-
}
|
|
57
|
-
fields: [
|
|
58
|
-
${fieldDefinitions}
|
|
59
|
-
],
|
|
60
|
-
}
|
|
61
|
-
`
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
// Validate the collection name and path
|
|
65
|
-
const fileName = `${capitalizedName}.ts`
|
|
66
|
-
const filePath = join(collectionsDirPath, fileName)
|
|
67
|
-
|
|
68
|
-
// Security check: ensure we're working with the collections directory
|
|
69
|
-
if (!filePath.startsWith(collectionsDirPath)) {
|
|
70
|
-
payload.logger.error(`[payload-mcp] Invalid collection path attempted: ${filePath}`)
|
|
71
|
-
return {
|
|
72
|
-
content: [
|
|
73
|
-
{
|
|
74
|
-
type: 'text' as const,
|
|
75
|
-
text: '❌ **Error**: Invalid collection path',
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Check if file already exists
|
|
82
|
-
try {
|
|
83
|
-
const fs = await import('fs')
|
|
84
|
-
if (fs.existsSync(filePath)) {
|
|
85
|
-
return {
|
|
86
|
-
content: [
|
|
87
|
-
{
|
|
88
|
-
type: 'text' as const,
|
|
89
|
-
text: `❌ **Error**: Collection file already exists: ${fileName}`,
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
} catch (_ignore) {
|
|
95
|
-
// File doesn't exist, which is what we want
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Write the collection file
|
|
99
|
-
writeFileSync(filePath, collectionContent, 'utf8')
|
|
100
|
-
if (verboseLogs) {
|
|
101
|
-
payload.logger.info(`[payload-mcp] Successfully created collection file: ${filePath}`)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Validate the generated file
|
|
105
|
-
const validationResult = await validateCollectionFile(fileName)
|
|
106
|
-
if (validationResult.error) {
|
|
107
|
-
return {
|
|
108
|
-
content: [
|
|
109
|
-
{
|
|
110
|
-
type: 'text' as const,
|
|
111
|
-
text: `❌ **Error**: Generated collection has validation issues:\n\n${validationResult.error}`,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return {
|
|
118
|
-
content: [
|
|
119
|
-
{
|
|
120
|
-
type: 'text' as const,
|
|
121
|
-
text: `✅ **Collection created successfully!**
|
|
122
|
-
**File**: \`${fileName}\`
|
|
123
|
-
**Collection Config:**
|
|
124
|
-
\`\`\`typescript
|
|
125
|
-
${collectionContent}
|
|
126
|
-
\`\`\``,
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
}
|
|
130
|
-
} catch (error) {
|
|
131
|
-
const errorMessage = (error as Error).message
|
|
132
|
-
payload.logger.error(`[payload-mcp] Error creating collection: ${errorMessage}`)
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
content: [
|
|
136
|
-
{
|
|
137
|
-
type: 'text' as const,
|
|
138
|
-
text: `❌ **Error creating collection**: ${errorMessage}`,
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export const createCollectionTool = (
|
|
146
|
-
server: McpServer,
|
|
147
|
-
req: PayloadRequest,
|
|
148
|
-
verboseLogs: boolean,
|
|
149
|
-
collectionsDirPath: string,
|
|
150
|
-
configFilePath: string,
|
|
151
|
-
) => {
|
|
152
|
-
const tool = async (
|
|
153
|
-
collectionName: string,
|
|
154
|
-
collectionDescription?: string,
|
|
155
|
-
fields: any[] = [],
|
|
156
|
-
hasUpload?: boolean,
|
|
157
|
-
) => {
|
|
158
|
-
const payload = req.payload
|
|
159
|
-
|
|
160
|
-
if (verboseLogs) {
|
|
161
|
-
payload.logger.info(
|
|
162
|
-
`[payload-mcp] Creating collection: ${collectionName}, fields: ${fields.length}, upload: ${hasUpload}`,
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
try {
|
|
167
|
-
const result = await createCollection(
|
|
168
|
-
req,
|
|
169
|
-
verboseLogs,
|
|
170
|
-
collectionsDirPath,
|
|
171
|
-
configFilePath,
|
|
172
|
-
collectionName,
|
|
173
|
-
collectionDescription,
|
|
174
|
-
fields,
|
|
175
|
-
hasUpload,
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
if (verboseLogs) {
|
|
179
|
-
payload.logger.info(`[payload-mcp] Collection creation completed for: ${collectionName}`)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return result
|
|
183
|
-
} catch (error) {
|
|
184
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
185
|
-
payload.logger.error(
|
|
186
|
-
`[payload-mcp] Error creating collection ${collectionName}: ${errorMessage}`,
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
return {
|
|
190
|
-
content: [
|
|
191
|
-
{
|
|
192
|
-
type: 'text' as const,
|
|
193
|
-
text: `Error creating collection "${collectionName}": ${errorMessage}`,
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
server.registerTool(
|
|
201
|
-
'createCollection',
|
|
202
|
-
{
|
|
203
|
-
description: toolSchemas.createCollection.description,
|
|
204
|
-
inputSchema: toolSchemas.createCollection.parameters.shape,
|
|
205
|
-
},
|
|
206
|
-
async ({ collectionDescription, collectionName, fields, hasUpload }) => {
|
|
207
|
-
return await tool(collectionName, collectionDescription, fields, hasUpload)
|
|
208
|
-
},
|
|
209
|
-
)
|
|
210
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
-
import type { PayloadRequest } from 'payload'
|
|
3
|
-
|
|
4
|
-
import { readFileSync, unlinkSync, writeFileSync } from 'fs'
|
|
5
|
-
import { join } from 'path'
|
|
6
|
-
|
|
7
|
-
import { removeCollectionFromConfig } from '../../helpers/config.js'
|
|
8
|
-
import { toolSchemas } from '../schemas.js'
|
|
9
|
-
|
|
10
|
-
export const deleteCollection = (
|
|
11
|
-
req: PayloadRequest,
|
|
12
|
-
verboseLogs: boolean,
|
|
13
|
-
collectionsDirPath: string,
|
|
14
|
-
configFilePath: string,
|
|
15
|
-
collectionName: string,
|
|
16
|
-
confirmDeletion: boolean,
|
|
17
|
-
updateConfig: boolean,
|
|
18
|
-
) => {
|
|
19
|
-
const payload = req.payload
|
|
20
|
-
|
|
21
|
-
if (verboseLogs) {
|
|
22
|
-
payload.logger.info(`[payload-mcp] Attempting to delete collection: ${collectionName}`)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!confirmDeletion) {
|
|
26
|
-
payload.logger.warn(`[payload-mcp] Deletion cancelled for collection: ${collectionName}`)
|
|
27
|
-
return {
|
|
28
|
-
content: [
|
|
29
|
-
{
|
|
30
|
-
type: 'text' as const,
|
|
31
|
-
text: `❌ **Deletion cancelled**. Set confirmDeletion to true to proceed with deleting collection "${collectionName}".`,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const capitalizedName = collectionName.charAt(0).toUpperCase() + collectionName.slice(1)
|
|
38
|
-
const collectionFilePath = join(collectionsDirPath, `${capitalizedName}.ts`)
|
|
39
|
-
|
|
40
|
-
// Security check: ensure we're working with the collections directory
|
|
41
|
-
if (!collectionFilePath.startsWith(collectionsDirPath)) {
|
|
42
|
-
payload.logger.error(`[payload-mcp] Invalid collection path attempted: ${collectionFilePath}`)
|
|
43
|
-
return {
|
|
44
|
-
content: [
|
|
45
|
-
{
|
|
46
|
-
type: 'text' as const,
|
|
47
|
-
text: '❌ **Error**: Invalid collection path',
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
// Check if collection file exists
|
|
55
|
-
let fileExists = false
|
|
56
|
-
try {
|
|
57
|
-
readFileSync(collectionFilePath, 'utf8')
|
|
58
|
-
fileExists = true
|
|
59
|
-
} catch {
|
|
60
|
-
payload.logger.warn(`[payload-mcp] Collection file does not exist: ${collectionFilePath}`)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Read current config if we need to update it
|
|
64
|
-
let configContent = ''
|
|
65
|
-
let configExists = false
|
|
66
|
-
if (updateConfig) {
|
|
67
|
-
try {
|
|
68
|
-
configContent = readFileSync(configFilePath, 'utf8')
|
|
69
|
-
configExists = true
|
|
70
|
-
} catch {
|
|
71
|
-
payload.logger.warn(`[payload-mcp] Config file does not exist: ${configFilePath}`)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
let responseText = ''
|
|
76
|
-
let operationsPerformed = 0
|
|
77
|
-
|
|
78
|
-
// Delete the collection file
|
|
79
|
-
if (fileExists) {
|
|
80
|
-
try {
|
|
81
|
-
unlinkSync(collectionFilePath)
|
|
82
|
-
if (verboseLogs) {
|
|
83
|
-
payload.logger.info(
|
|
84
|
-
`[payload-mcp] Successfully deleted collection file: ${collectionFilePath}`,
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
responseText += `✅ Deleted collection file: \`${capitalizedName}.ts\`\n`
|
|
88
|
-
operationsPerformed++
|
|
89
|
-
} catch (error) {
|
|
90
|
-
const errorMessage = (error as Error).message
|
|
91
|
-
payload.logger.error(`[payload-mcp] Error deleting collection file: ${errorMessage}`)
|
|
92
|
-
responseText += `❌ Error deleting collection file: ${errorMessage}\n`
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
responseText += `⚠️ Collection file not found: \`${capitalizedName}.ts\`\n`
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Update the config file if requested and it exists
|
|
99
|
-
if (updateConfig && configExists) {
|
|
100
|
-
try {
|
|
101
|
-
const updatedConfigContent = removeCollectionFromConfig(configContent, capitalizedName)
|
|
102
|
-
writeFileSync(configFilePath, updatedConfigContent, 'utf8')
|
|
103
|
-
if (verboseLogs) {
|
|
104
|
-
payload.logger.info(`[payload-mcp] Successfully updated config file: ${configFilePath}`)
|
|
105
|
-
}
|
|
106
|
-
responseText += `✅ Updated payload.config.ts to remove collection reference\n`
|
|
107
|
-
operationsPerformed++
|
|
108
|
-
} catch (error) {
|
|
109
|
-
const errorMessage = (error as Error).message
|
|
110
|
-
payload.logger.error(`[payload-mcp] Error updating config file: ${errorMessage}`)
|
|
111
|
-
responseText += `❌ Error updating config file: ${errorMessage}\n`
|
|
112
|
-
}
|
|
113
|
-
} else if (updateConfig && !configExists) {
|
|
114
|
-
responseText += `⚠️ Config file not found: payload.config.ts\n`
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Summary
|
|
118
|
-
if (operationsPerformed > 0) {
|
|
119
|
-
responseText += `\n✅ **Collection deletion completed!**`
|
|
120
|
-
} else {
|
|
121
|
-
responseText += `\n⚠️ **No operations performed**
|
|
122
|
-
|
|
123
|
-
The collection file may not have existed or there were errors during deletion.`
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
content: [
|
|
128
|
-
{
|
|
129
|
-
type: 'text' as const,
|
|
130
|
-
text: responseText,
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
}
|
|
134
|
-
} catch (error) {
|
|
135
|
-
const errorMessage = (error as Error).message
|
|
136
|
-
payload.logger.error(`[payload-mcp] Error during collection deletion: ${errorMessage}`)
|
|
137
|
-
return {
|
|
138
|
-
content: [
|
|
139
|
-
{
|
|
140
|
-
type: 'text' as const,
|
|
141
|
-
text: `❌ **Error during collection deletion**: ${errorMessage}`,
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export const deleteCollectionTool = (
|
|
149
|
-
server: McpServer,
|
|
150
|
-
req: PayloadRequest,
|
|
151
|
-
verboseLogs: boolean,
|
|
152
|
-
collectionsDirPath: string,
|
|
153
|
-
configFilePath: string,
|
|
154
|
-
) => {
|
|
155
|
-
const tool = (
|
|
156
|
-
collectionName: string,
|
|
157
|
-
confirmDeletion: boolean,
|
|
158
|
-
updateConfig: boolean = false,
|
|
159
|
-
) => {
|
|
160
|
-
const payload = req.payload
|
|
161
|
-
|
|
162
|
-
if (verboseLogs) {
|
|
163
|
-
payload.logger.info(
|
|
164
|
-
`[payload-mcp] Deleting collection: ${collectionName}, confirmDeletion: ${confirmDeletion}, updateConfig: ${updateConfig}`,
|
|
165
|
-
)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
try {
|
|
169
|
-
const result = deleteCollection(
|
|
170
|
-
req,
|
|
171
|
-
verboseLogs,
|
|
172
|
-
collectionsDirPath,
|
|
173
|
-
configFilePath,
|
|
174
|
-
collectionName,
|
|
175
|
-
confirmDeletion,
|
|
176
|
-
updateConfig,
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
if (verboseLogs) {
|
|
180
|
-
payload.logger.info(`[payload-mcp] Collection deletion completed for: ${collectionName}`)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return result
|
|
184
|
-
} catch (error) {
|
|
185
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
186
|
-
payload.logger.error(
|
|
187
|
-
`[payload-mcp] Error deleting collection ${collectionName}: ${errorMessage}`,
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
return {
|
|
191
|
-
content: [
|
|
192
|
-
{
|
|
193
|
-
type: 'text' as const,
|
|
194
|
-
text: `Error deleting collection "${collectionName}": ${errorMessage}`,
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
server.registerTool(
|
|
202
|
-
'deleteCollection',
|
|
203
|
-
{
|
|
204
|
-
description: toolSchemas.deleteCollection.description,
|
|
205
|
-
inputSchema: toolSchemas.deleteCollection.parameters.shape,
|
|
206
|
-
},
|
|
207
|
-
({ collectionName, confirmDeletion, updateConfig }) => {
|
|
208
|
-
return tool(collectionName, confirmDeletion, updateConfig)
|
|
209
|
-
},
|
|
210
|
-
)
|
|
211
|
-
}
|