@payloadcms/plugin-mcp 4.0.0-internal.011fd46 → 4.0.0-internal.0b9bec1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/bin.js +7 -0
- package/dist/defaultAccess.d.ts +3 -0
- package/dist/defaultAccess.d.ts.map +1 -0
- package/dist/defaultAccess.js +3 -0
- package/dist/defaultAccess.js.map +1 -0
- package/dist/defineTool.d.ts +8 -8
- package/dist/defineTool.d.ts.map +1 -1
- package/dist/endpoint/access.d.ts +12 -5
- package/dist/endpoint/access.d.ts.map +1 -1
- package/dist/endpoint/access.js +74 -103
- package/dist/endpoint/access.js.map +1 -1
- package/dist/endpoint/index.d.ts +1 -1
- package/dist/endpoint/index.d.ts.map +1 -1
- package/dist/endpoint/index.js +68 -17
- package/dist/endpoint/index.js.map +1 -1
- package/dist/exports/client.d.ts +1 -4
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -4
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/internal.d.ts +2 -0
- package/dist/exports/internal.d.ts.map +1 -0
- package/dist/exports/internal.js +3 -0
- package/dist/exports/internal.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -56
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts +4 -4
- package/dist/mcp/buildMcpServer.d.ts.map +1 -1
- package/dist/mcp/buildMcpServer.js +32 -10
- package/dist/mcp/buildMcpServer.js.map +1 -1
- package/dist/mcp/builtin/collections/countTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countTool.js +68 -0
- package/dist/mcp/builtin/collections/countTool.js.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js +64 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/createTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/createTool.js +93 -40
- package/dist/mcp/builtin/collections/createTool.js.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.js +3 -2
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -1
- package/dist/mcp/builtin/collections/duplicateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.js +96 -0
- package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts +28 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.js +124 -0
- package/dist/mcp/builtin/collections/fileInput.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js +86 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js +92 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findTool.js +5 -4
- package/dist/mcp/builtin/collections/findTool.js.map +1 -1
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js +83 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js +98 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts +1 -1
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/formatCollectionError.js.map +1 -1
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +49 -4
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -1
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js +81 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/updateTool.js +26 -12
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -1
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js +55 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -1
- package/dist/mcp/builtin/getConfigInfoTool.js +20 -8
- package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -1
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js +64 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/findTool.js +4 -2
- package/dist/mcp/builtin/globals/findTool.js.map +1 -1
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js +79 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js +94 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +25 -2
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -1
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js +77 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/updateTool.js +4 -2
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -1
- package/dist/mcp/builtin/validateEntityData.d.ts.map +1 -1
- package/dist/mcp/builtin/validateEntityData.js +1 -1
- package/dist/mcp/builtin/validateEntityData.js.map +1 -1
- package/dist/mcp/builtinTools.d.ts +73 -2
- package/dist/mcp/builtinTools.d.ts.map +1 -1
- package/dist/mcp/builtinTools.js +73 -3
- package/dist/mcp/builtinTools.js.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts +0 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.js +48 -17
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -1
- package/dist/stdio.d.ts +3 -3
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +84 -46
- package/dist/stdio.js.map +1 -1
- package/dist/types.d.ts +93 -87
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -4
- package/dist/types.js.map +1 -1
- package/dist/utils/camelCase.d.ts.map +1 -1
- package/dist/utils/getPluginConfig.d.ts +1 -1
- package/dist/utils/getPluginConfig.js +1 -1
- package/dist/utils/getPluginConfig.js.map +1 -1
- package/dist/utils/resolveProjectRoot.d.ts.map +1 -1
- package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts +28 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts.map +1 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.js +71 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.js.map +1 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts +5 -3
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/getEntityInputSchema.js +44 -12
- package/dist/utils/schemaConversion/getEntityInputSchema.js.map +1 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +5 -10
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js +15 -95
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +1 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +15 -40
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +1 -1
- package/dist/utils/toStandardSchema.d.ts.map +1 -1
- package/package.json +11 -17
- package/src/defaultAccess.ts +3 -0
- package/src/endpoint/access.ts +80 -112
- package/src/endpoint/index.ts +58 -16
- package/src/exports/client.ts +2 -4
- package/src/exports/internal.ts +1 -0
- package/src/index.ts +5 -62
- package/src/mcp/buildMcpServer.ts +46 -21
- package/src/mcp/builtin/collections/countTool.ts +73 -0
- package/src/mcp/builtin/collections/countVersionsTool.ts +69 -0
- package/src/mcp/builtin/collections/createTool.ts +93 -34
- package/src/mcp/builtin/collections/deleteTool.ts +4 -2
- package/src/mcp/builtin/collections/duplicateTool.ts +134 -0
- package/src/mcp/builtin/collections/fileInput.spec.ts +93 -0
- package/src/mcp/builtin/collections/fileInput.ts +164 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +119 -0
- package/src/mcp/builtin/collections/findTool.ts +6 -4
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +109 -0
- package/src/mcp/builtin/collections/findVersionsTool.ts +154 -0
- package/src/mcp/builtin/collections/formatCollectionError.ts +1 -1
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +48 -3
- package/src/mcp/builtin/collections/restoreVersionTool.ts +107 -0
- package/src/mcp/builtin/collections/updateTool.ts +29 -10
- package/src/mcp/builtin/collections/uploadInstructionsTool.ts +64 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +20 -4
- package/src/mcp/builtin/globals/countVersionsTool.ts +68 -0
- package/src/mcp/builtin/globals/findTool.ts +5 -2
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +103 -0
- package/src/mcp/builtin/globals/findVersionsTool.ts +147 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +30 -2
- package/src/mcp/builtin/globals/restoreVersionTool.ts +99 -0
- package/src/mcp/builtin/globals/updateTool.ts +5 -2
- package/src/mcp/builtin/validateEntityData.ts +1 -1
- package/src/mcp/builtinTools.ts +72 -6
- package/src/mcp/sanitizeMCPConfig.ts +36 -19
- package/src/stdio.ts +79 -46
- package/src/types.ts +101 -91
- package/src/utils/getPluginConfig.ts +1 -1
- package/src/utils/schemaConversion/filterFieldsByAccess.ts +123 -0
- package/src/utils/schemaConversion/getEntityInputSchema.ts +45 -27
- package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +12 -19
- package/src/utils/schemaConversion/sanitizeEntitySchema.ts +17 -114
- package/dist/collection/getAccessField.d.ts +0 -12
- package/dist/collection/getAccessField.d.ts.map +0 -1
- package/dist/collection/getAccessField.js +0 -72
- package/dist/collection/getAccessField.js.map +0 -1
- package/dist/collection/index.d.ts +0 -6
- package/dist/collection/index.d.ts.map +0 -1
- package/dist/collection/index.js +0 -105
- package/dist/collection/index.js.map +0 -1
- package/dist/components/APIKeyField/index.client.d.ts +0 -9
- package/dist/components/APIKeyField/index.client.d.ts.map +0 -1
- package/dist/components/APIKeyField/index.client.js +0 -85
- package/dist/components/APIKeyField/index.client.js.map +0 -1
- package/dist/components/APIKeyField/index.css +0 -105
- package/dist/components/APIKeysEmptyState/index.client.d.ts +0 -4
- package/dist/components/APIKeysEmptyState/index.client.d.ts.map +0 -1
- package/dist/components/APIKeysEmptyState/index.client.js +0 -21
- package/dist/components/APIKeysEmptyState/index.client.js.map +0 -1
- package/dist/components/AccessField/index.client.d.ts +0 -10
- package/dist/components/AccessField/index.client.d.ts.map +0 -1
- package/dist/components/AccessField/index.client.js +0 -247
- package/dist/components/AccessField/index.client.js.map +0 -1
- package/dist/components/AccessField/index.css +0 -99
- package/dist/components/SettingsMenu/index.client.d.ts +0 -8
- package/dist/components/SettingsMenu/index.client.d.ts.map +0 -1
- package/dist/components/SettingsMenu/index.client.js +0 -24
- package/dist/components/SettingsMenu/index.client.js.map +0 -1
- package/dist/translations/index.d.ts +0 -11
- package/dist/translations/index.d.ts.map +0 -1
- package/dist/translations/index.js +0 -92
- package/dist/translations/index.js.map +0 -1
- package/dist/translations/languages/ar.d.ts +0 -31
- package/dist/translations/languages/ar.d.ts.map +0 -1
- package/dist/translations/languages/ar.js +0 -34
- package/dist/translations/languages/ar.js.map +0 -1
- package/dist/translations/languages/az.d.ts +0 -31
- package/dist/translations/languages/az.d.ts.map +0 -1
- package/dist/translations/languages/az.js +0 -34
- package/dist/translations/languages/az.js.map +0 -1
- package/dist/translations/languages/bg.d.ts +0 -31
- package/dist/translations/languages/bg.d.ts.map +0 -1
- package/dist/translations/languages/bg.js +0 -34
- package/dist/translations/languages/bg.js.map +0 -1
- package/dist/translations/languages/bnBd.d.ts +0 -31
- package/dist/translations/languages/bnBd.d.ts.map +0 -1
- package/dist/translations/languages/bnBd.js +0 -34
- package/dist/translations/languages/bnBd.js.map +0 -1
- package/dist/translations/languages/bnIn.d.ts +0 -31
- package/dist/translations/languages/bnIn.d.ts.map +0 -1
- package/dist/translations/languages/bnIn.js +0 -34
- package/dist/translations/languages/bnIn.js.map +0 -1
- package/dist/translations/languages/ca.d.ts +0 -31
- package/dist/translations/languages/ca.d.ts.map +0 -1
- package/dist/translations/languages/ca.js +0 -34
- package/dist/translations/languages/ca.js.map +0 -1
- package/dist/translations/languages/cs.d.ts +0 -31
- package/dist/translations/languages/cs.d.ts.map +0 -1
- package/dist/translations/languages/cs.js +0 -34
- package/dist/translations/languages/cs.js.map +0 -1
- package/dist/translations/languages/da.d.ts +0 -31
- package/dist/translations/languages/da.d.ts.map +0 -1
- package/dist/translations/languages/da.js +0 -34
- package/dist/translations/languages/da.js.map +0 -1
- package/dist/translations/languages/de.d.ts +0 -31
- package/dist/translations/languages/de.d.ts.map +0 -1
- package/dist/translations/languages/de.js +0 -34
- package/dist/translations/languages/de.js.map +0 -1
- package/dist/translations/languages/en.d.ts +0 -31
- package/dist/translations/languages/en.d.ts.map +0 -1
- package/dist/translations/languages/en.js +0 -34
- package/dist/translations/languages/en.js.map +0 -1
- package/dist/translations/languages/es.d.ts +0 -31
- package/dist/translations/languages/es.d.ts.map +0 -1
- package/dist/translations/languages/es.js +0 -34
- package/dist/translations/languages/es.js.map +0 -1
- package/dist/translations/languages/et.d.ts +0 -31
- package/dist/translations/languages/et.d.ts.map +0 -1
- package/dist/translations/languages/et.js +0 -34
- package/dist/translations/languages/et.js.map +0 -1
- package/dist/translations/languages/fa.d.ts +0 -31
- package/dist/translations/languages/fa.d.ts.map +0 -1
- package/dist/translations/languages/fa.js +0 -34
- package/dist/translations/languages/fa.js.map +0 -1
- package/dist/translations/languages/fr.d.ts +0 -31
- package/dist/translations/languages/fr.d.ts.map +0 -1
- package/dist/translations/languages/fr.js +0 -34
- package/dist/translations/languages/fr.js.map +0 -1
- package/dist/translations/languages/he.d.ts +0 -31
- package/dist/translations/languages/he.d.ts.map +0 -1
- package/dist/translations/languages/he.js +0 -34
- package/dist/translations/languages/he.js.map +0 -1
- package/dist/translations/languages/hr.d.ts +0 -31
- package/dist/translations/languages/hr.d.ts.map +0 -1
- package/dist/translations/languages/hr.js +0 -34
- package/dist/translations/languages/hr.js.map +0 -1
- package/dist/translations/languages/hu.d.ts +0 -31
- package/dist/translations/languages/hu.d.ts.map +0 -1
- package/dist/translations/languages/hu.js +0 -34
- package/dist/translations/languages/hu.js.map +0 -1
- package/dist/translations/languages/hy.d.ts +0 -31
- package/dist/translations/languages/hy.d.ts.map +0 -1
- package/dist/translations/languages/hy.js +0 -34
- package/dist/translations/languages/hy.js.map +0 -1
- package/dist/translations/languages/id.d.ts +0 -31
- package/dist/translations/languages/id.d.ts.map +0 -1
- package/dist/translations/languages/id.js +0 -34
- package/dist/translations/languages/id.js.map +0 -1
- package/dist/translations/languages/is.d.ts +0 -31
- package/dist/translations/languages/is.d.ts.map +0 -1
- package/dist/translations/languages/is.js +0 -34
- package/dist/translations/languages/is.js.map +0 -1
- package/dist/translations/languages/it.d.ts +0 -31
- package/dist/translations/languages/it.d.ts.map +0 -1
- package/dist/translations/languages/it.js +0 -34
- package/dist/translations/languages/it.js.map +0 -1
- package/dist/translations/languages/ja.d.ts +0 -31
- package/dist/translations/languages/ja.d.ts.map +0 -1
- package/dist/translations/languages/ja.js +0 -34
- package/dist/translations/languages/ja.js.map +0 -1
- package/dist/translations/languages/ko.d.ts +0 -31
- package/dist/translations/languages/ko.d.ts.map +0 -1
- package/dist/translations/languages/ko.js +0 -34
- package/dist/translations/languages/ko.js.map +0 -1
- package/dist/translations/languages/lt.d.ts +0 -31
- package/dist/translations/languages/lt.d.ts.map +0 -1
- package/dist/translations/languages/lt.js +0 -34
- package/dist/translations/languages/lt.js.map +0 -1
- package/dist/translations/languages/lv.d.ts +0 -31
- package/dist/translations/languages/lv.d.ts.map +0 -1
- package/dist/translations/languages/lv.js +0 -34
- package/dist/translations/languages/lv.js.map +0 -1
- package/dist/translations/languages/my.d.ts +0 -31
- package/dist/translations/languages/my.d.ts.map +0 -1
- package/dist/translations/languages/my.js +0 -34
- package/dist/translations/languages/my.js.map +0 -1
- package/dist/translations/languages/nb.d.ts +0 -31
- package/dist/translations/languages/nb.d.ts.map +0 -1
- package/dist/translations/languages/nb.js +0 -34
- package/dist/translations/languages/nb.js.map +0 -1
- package/dist/translations/languages/nl.d.ts +0 -31
- package/dist/translations/languages/nl.d.ts.map +0 -1
- package/dist/translations/languages/nl.js +0 -34
- package/dist/translations/languages/nl.js.map +0 -1
- package/dist/translations/languages/pl.d.ts +0 -31
- package/dist/translations/languages/pl.d.ts.map +0 -1
- package/dist/translations/languages/pl.js +0 -34
- package/dist/translations/languages/pl.js.map +0 -1
- package/dist/translations/languages/pt.d.ts +0 -31
- package/dist/translations/languages/pt.d.ts.map +0 -1
- package/dist/translations/languages/pt.js +0 -34
- package/dist/translations/languages/pt.js.map +0 -1
- package/dist/translations/languages/ro.d.ts +0 -31
- package/dist/translations/languages/ro.d.ts.map +0 -1
- package/dist/translations/languages/ro.js +0 -34
- package/dist/translations/languages/ro.js.map +0 -1
- package/dist/translations/languages/rs.d.ts +0 -31
- package/dist/translations/languages/rs.d.ts.map +0 -1
- package/dist/translations/languages/rs.js +0 -34
- package/dist/translations/languages/rs.js.map +0 -1
- package/dist/translations/languages/rsLatin.d.ts +0 -31
- package/dist/translations/languages/rsLatin.d.ts.map +0 -1
- package/dist/translations/languages/rsLatin.js +0 -34
- package/dist/translations/languages/rsLatin.js.map +0 -1
- package/dist/translations/languages/ru.d.ts +0 -31
- package/dist/translations/languages/ru.d.ts.map +0 -1
- package/dist/translations/languages/ru.js +0 -34
- package/dist/translations/languages/ru.js.map +0 -1
- package/dist/translations/languages/sk.d.ts +0 -31
- package/dist/translations/languages/sk.d.ts.map +0 -1
- package/dist/translations/languages/sk.js +0 -34
- package/dist/translations/languages/sk.js.map +0 -1
- package/dist/translations/languages/sl.d.ts +0 -31
- package/dist/translations/languages/sl.d.ts.map +0 -1
- package/dist/translations/languages/sl.js +0 -34
- package/dist/translations/languages/sl.js.map +0 -1
- package/dist/translations/languages/sv.d.ts +0 -31
- package/dist/translations/languages/sv.d.ts.map +0 -1
- package/dist/translations/languages/sv.js +0 -34
- package/dist/translations/languages/sv.js.map +0 -1
- package/dist/translations/languages/ta.d.ts +0 -31
- package/dist/translations/languages/ta.d.ts.map +0 -1
- package/dist/translations/languages/ta.js +0 -34
- package/dist/translations/languages/ta.js.map +0 -1
- package/dist/translations/languages/th.d.ts +0 -31
- package/dist/translations/languages/th.d.ts.map +0 -1
- package/dist/translations/languages/th.js +0 -34
- package/dist/translations/languages/th.js.map +0 -1
- package/dist/translations/languages/tr.d.ts +0 -31
- package/dist/translations/languages/tr.d.ts.map +0 -1
- package/dist/translations/languages/tr.js +0 -34
- package/dist/translations/languages/tr.js.map +0 -1
- package/dist/translations/languages/uk.d.ts +0 -31
- package/dist/translations/languages/uk.d.ts.map +0 -1
- package/dist/translations/languages/uk.js +0 -34
- package/dist/translations/languages/uk.js.map +0 -1
- package/dist/translations/languages/vi.d.ts +0 -31
- package/dist/translations/languages/vi.d.ts.map +0 -1
- package/dist/translations/languages/vi.js +0 -34
- package/dist/translations/languages/vi.js.map +0 -1
- package/dist/translations/languages/zh.d.ts +0 -31
- package/dist/translations/languages/zh.d.ts.map +0 -1
- package/dist/translations/languages/zh.js +0 -34
- package/dist/translations/languages/zh.js.map +0 -1
- package/dist/translations/languages/zhTw.d.ts +0 -31
- package/dist/translations/languages/zhTw.d.ts.map +0 -1
- package/dist/translations/languages/zhTw.js +0 -34
- package/dist/translations/languages/zhTw.js.map +0 -1
- package/dist/translations/types.d.ts +0 -32
- package/dist/translations/types.d.ts.map +0 -1
- package/dist/translations/types.js +0 -3
- package/dist/translations/types.js.map +0 -1
- package/dist/utils/localAPIDefaults.d.ts +0 -20
- package/dist/utils/localAPIDefaults.d.ts.map +0 -1
- package/dist/utils/localAPIDefaults.js +0 -19
- package/dist/utils/localAPIDefaults.js.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +0 -7
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js +0 -20
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +0 -1
- package/src/collection/getAccessField.ts +0 -84
- package/src/collection/index.ts +0 -105
- package/src/components/APIKeyField/index.client.tsx +0 -68
- package/src/components/APIKeyField/index.css +0 -105
- package/src/components/APIKeysEmptyState/index.client.tsx +0 -33
- package/src/components/AccessField/index.client.tsx +0 -296
- package/src/components/AccessField/index.css +0 -99
- package/src/components/SettingsMenu/index.client.tsx +0 -30
- package/src/translations/index.ts +0 -105
- package/src/translations/languages/ar.ts +0 -38
- package/src/translations/languages/az.ts +0 -38
- package/src/translations/languages/bg.ts +0 -39
- package/src/translations/languages/bnBd.ts +0 -39
- package/src/translations/languages/bnIn.ts +0 -39
- package/src/translations/languages/ca.ts +0 -39
- package/src/translations/languages/cs.ts +0 -39
- package/src/translations/languages/da.ts +0 -38
- package/src/translations/languages/de.ts +0 -39
- package/src/translations/languages/en.ts +0 -39
- package/src/translations/languages/es.ts +0 -39
- package/src/translations/languages/et.ts +0 -38
- package/src/translations/languages/fa.ts +0 -39
- package/src/translations/languages/fr.ts +0 -39
- package/src/translations/languages/he.ts +0 -37
- package/src/translations/languages/hr.ts +0 -39
- package/src/translations/languages/hu.ts +0 -39
- package/src/translations/languages/hy.ts +0 -39
- package/src/translations/languages/id.ts +0 -39
- package/src/translations/languages/is.ts +0 -39
- package/src/translations/languages/it.ts +0 -39
- package/src/translations/languages/ja.ts +0 -39
- package/src/translations/languages/ko.ts +0 -39
- package/src/translations/languages/lt.ts +0 -39
- package/src/translations/languages/lv.ts +0 -38
- package/src/translations/languages/my.ts +0 -39
- package/src/translations/languages/nb.ts +0 -39
- package/src/translations/languages/nl.ts +0 -39
- package/src/translations/languages/pl.ts +0 -38
- package/src/translations/languages/pt.ts +0 -39
- package/src/translations/languages/ro.ts +0 -39
- package/src/translations/languages/rs.ts +0 -38
- package/src/translations/languages/rsLatin.ts +0 -38
- package/src/translations/languages/ru.ts +0 -39
- package/src/translations/languages/sk.ts +0 -39
- package/src/translations/languages/sl.ts +0 -38
- package/src/translations/languages/sv.ts +0 -39
- package/src/translations/languages/ta.ts +0 -39
- package/src/translations/languages/th.ts +0 -38
- package/src/translations/languages/tr.ts +0 -38
- package/src/translations/languages/uk.ts +0 -39
- package/src/translations/languages/vi.ts +0 -39
- package/src/translations/languages/zh.ts +0 -36
- package/src/translations/languages/zhTw.ts +0 -36
- package/src/translations/types.ts +0 -34
- package/src/utils/localAPIDefaults.ts +0 -22
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +0 -27
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { PopulateType, SelectType } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
|
|
5
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
6
|
+
import { defineGlobalTool } from '../../../defineTool.js'
|
|
7
|
+
import { getLogger } from '../../../utils/getLogger.js'
|
|
8
|
+
|
|
9
|
+
const DEFAULT_DESCRIPTION =
|
|
10
|
+
'Find a specific global version in any version-enabled global by passing the global slug and version ID.'
|
|
11
|
+
|
|
12
|
+
export const findGlobalVersionByIDTool = defineGlobalTool({
|
|
13
|
+
access: (args) =>
|
|
14
|
+
defaultAccess(args) && Boolean(args.permissions?.globals?.[args.globalSlug]?.readVersions),
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
idempotentHint: true,
|
|
18
|
+
openWorldHint: false,
|
|
19
|
+
readOnlyHint: true,
|
|
20
|
+
title: 'Find Global Version By ID',
|
|
21
|
+
},
|
|
22
|
+
description: DEFAULT_DESCRIPTION,
|
|
23
|
+
input: z.object({
|
|
24
|
+
id: z.string().describe('The ID of the global version to retrieve'),
|
|
25
|
+
depth: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.min(0)
|
|
29
|
+
.max(10)
|
|
30
|
+
.describe('How many levels deep to populate relationships in the global version document')
|
|
31
|
+
.optional()
|
|
32
|
+
.default(0),
|
|
33
|
+
fallbackLocale: z
|
|
34
|
+
.string()
|
|
35
|
+
.describe('Optional: fallback locale code to use when requested locale is not available')
|
|
36
|
+
.optional(),
|
|
37
|
+
locale: z
|
|
38
|
+
.string()
|
|
39
|
+
.describe(
|
|
40
|
+
'Optional: locale code to retrieve data in (e.g., "en", "es"). Use "all" to retrieve all locales for localized fields',
|
|
41
|
+
)
|
|
42
|
+
.optional(),
|
|
43
|
+
populate: z
|
|
44
|
+
.record(z.string(), z.unknown())
|
|
45
|
+
.describe(
|
|
46
|
+
'Optional: control which fields to include from populated relationship or upload documents.',
|
|
47
|
+
)
|
|
48
|
+
.optional(),
|
|
49
|
+
select: z
|
|
50
|
+
.record(z.string(), z.unknown())
|
|
51
|
+
.describe(
|
|
52
|
+
'Optional: define exactly which fields you\'d like to return in the response, e.g., {"version.siteName": true}',
|
|
53
|
+
)
|
|
54
|
+
.optional(),
|
|
55
|
+
showHiddenFields: z
|
|
56
|
+
.boolean()
|
|
57
|
+
.describe('Optional: include hidden fields in the returned global version document')
|
|
58
|
+
.optional(),
|
|
59
|
+
}),
|
|
60
|
+
}).handler(async ({ authorizedMCP, globalSlug, input, req }) => {
|
|
61
|
+
const payload = req.payload
|
|
62
|
+
const logger = getLogger({ payload })
|
|
63
|
+
const { id, depth, fallbackLocale, locale, populate, select, showHiddenFields } = input
|
|
64
|
+
|
|
65
|
+
logger.info(`Finding version for global: ${globalSlug} with ID: ${id}`)
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const result = await payload.findGlobalVersionByID({
|
|
69
|
+
id,
|
|
70
|
+
slug: globalSlug,
|
|
71
|
+
depth,
|
|
72
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
73
|
+
req,
|
|
74
|
+
...(fallbackLocale ? { fallbackLocale } : {}),
|
|
75
|
+
...(locale ? { locale } : {}),
|
|
76
|
+
...(populate ? { populate: populate as PopulateType } : {}),
|
|
77
|
+
...(select ? { select: select as SelectType } : {}),
|
|
78
|
+
...(showHiddenFields !== undefined ? { showHiddenFields } : {}),
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: 'text',
|
|
85
|
+
text: `Version "${id}" from global "${globalSlug}":\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
doc: result as unknown as Record<string, unknown>,
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
92
|
+
logger.error(`Error finding version ${id} for global ${globalSlug}: ${errorMessage}`)
|
|
93
|
+
return {
|
|
94
|
+
content: [
|
|
95
|
+
{
|
|
96
|
+
type: 'text',
|
|
97
|
+
text: `❌ **Error finding version "${id}" for global "${globalSlug}":** ${errorMessage}`,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
isError: true,
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
})
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { PopulateType, SelectType } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
|
|
5
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
6
|
+
import { defineGlobalTool } from '../../../defineTool.js'
|
|
7
|
+
import { getLogger } from '../../../utils/getLogger.js'
|
|
8
|
+
import { whereSchema } from '../../../utils/whereSchema.js'
|
|
9
|
+
|
|
10
|
+
const DEFAULT_DESCRIPTION =
|
|
11
|
+
'Find global versions in any version-enabled global by passing the global slug and optional where clause.'
|
|
12
|
+
|
|
13
|
+
export const findGlobalVersionsTool = defineGlobalTool({
|
|
14
|
+
access: (args) =>
|
|
15
|
+
defaultAccess(args) && Boolean(args.permissions?.globals?.[args.globalSlug]?.readVersions),
|
|
16
|
+
annotations: {
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
idempotentHint: true,
|
|
19
|
+
openWorldHint: false,
|
|
20
|
+
readOnlyHint: true,
|
|
21
|
+
title: 'Find Global Versions',
|
|
22
|
+
},
|
|
23
|
+
description: DEFAULT_DESCRIPTION,
|
|
24
|
+
input: z.object({
|
|
25
|
+
depth: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.min(0)
|
|
29
|
+
.max(10)
|
|
30
|
+
.describe('How many levels deep to populate relationships in global version documents')
|
|
31
|
+
.optional()
|
|
32
|
+
.default(0),
|
|
33
|
+
fallbackLocale: z
|
|
34
|
+
.string()
|
|
35
|
+
.describe('Optional: fallback locale code to use when requested locale is not available')
|
|
36
|
+
.optional(),
|
|
37
|
+
limit: z
|
|
38
|
+
.number()
|
|
39
|
+
.int()
|
|
40
|
+
.min(1)
|
|
41
|
+
.max(100)
|
|
42
|
+
.describe('Maximum number of versions to return (default: 10, max: 100)')
|
|
43
|
+
.optional()
|
|
44
|
+
.default(10),
|
|
45
|
+
locale: z
|
|
46
|
+
.string()
|
|
47
|
+
.describe(
|
|
48
|
+
'Optional: locale code to retrieve data in (e.g., "en", "es"). Use "all" to retrieve all locales for localized fields',
|
|
49
|
+
)
|
|
50
|
+
.optional(),
|
|
51
|
+
page: z
|
|
52
|
+
.number()
|
|
53
|
+
.int()
|
|
54
|
+
.min(1)
|
|
55
|
+
.describe('Page number for pagination (default: 1)')
|
|
56
|
+
.optional()
|
|
57
|
+
.default(1),
|
|
58
|
+
pagination: z
|
|
59
|
+
.boolean()
|
|
60
|
+
.describe('Optional: set to false to skip the count query overhead')
|
|
61
|
+
.optional(),
|
|
62
|
+
populate: z
|
|
63
|
+
.record(z.string(), z.unknown())
|
|
64
|
+
.describe(
|
|
65
|
+
'Optional: control which fields to include from populated relationship or upload documents.',
|
|
66
|
+
)
|
|
67
|
+
.optional(),
|
|
68
|
+
select: z
|
|
69
|
+
.record(z.string(), z.unknown())
|
|
70
|
+
.describe(
|
|
71
|
+
'Optional: define exactly which fields you\'d like to return in the response, e.g., {"version.siteName": true}',
|
|
72
|
+
)
|
|
73
|
+
.optional(),
|
|
74
|
+
showHiddenFields: z
|
|
75
|
+
.boolean()
|
|
76
|
+
.describe('Optional: include hidden fields in returned global version documents')
|
|
77
|
+
.optional(),
|
|
78
|
+
sort: z
|
|
79
|
+
.string()
|
|
80
|
+
.describe('Field to sort by (e.g., "-updatedAt", "-version.updatedAt" for descending)')
|
|
81
|
+
.optional(),
|
|
82
|
+
where: whereSchema
|
|
83
|
+
.describe(
|
|
84
|
+
'Optional: where clause for filtering versions. Version document fields are usually under "version". Example: {"version.siteName":{"contains":"test"}}',
|
|
85
|
+
)
|
|
86
|
+
.optional(),
|
|
87
|
+
}),
|
|
88
|
+
}).handler(async ({ authorizedMCP, globalSlug, input, req }) => {
|
|
89
|
+
const payload = req.payload
|
|
90
|
+
const logger = getLogger({ payload })
|
|
91
|
+
const {
|
|
92
|
+
depth,
|
|
93
|
+
fallbackLocale,
|
|
94
|
+
limit,
|
|
95
|
+
locale,
|
|
96
|
+
page,
|
|
97
|
+
pagination,
|
|
98
|
+
populate,
|
|
99
|
+
select,
|
|
100
|
+
showHiddenFields,
|
|
101
|
+
sort,
|
|
102
|
+
where,
|
|
103
|
+
} = input
|
|
104
|
+
|
|
105
|
+
logger.info(`Finding versions for global: ${globalSlug}, limit: ${limit}, page: ${page}`)
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
const result = await payload.findGlobalVersions({
|
|
109
|
+
slug: globalSlug,
|
|
110
|
+
depth,
|
|
111
|
+
limit,
|
|
112
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
113
|
+
page,
|
|
114
|
+
req,
|
|
115
|
+
...(fallbackLocale ? { fallbackLocale } : {}),
|
|
116
|
+
...(locale ? { locale } : {}),
|
|
117
|
+
...(pagination !== undefined ? { pagination } : {}),
|
|
118
|
+
...(populate ? { populate: populate as PopulateType } : {}),
|
|
119
|
+
...(select ? { select: select as SelectType } : {}),
|
|
120
|
+
...(showHiddenFields !== undefined ? { showHiddenFields } : {}),
|
|
121
|
+
...(sort ? { sort } : {}),
|
|
122
|
+
...(where ? { where } : {}),
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
content: [
|
|
127
|
+
{
|
|
128
|
+
type: 'text',
|
|
129
|
+
text: `Versions for global "${globalSlug}":\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
doc: result as unknown as Record<string, unknown>,
|
|
133
|
+
}
|
|
134
|
+
} catch (error) {
|
|
135
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
136
|
+
logger.error(`Error finding versions for global ${globalSlug}: ${errorMessage}`)
|
|
137
|
+
return {
|
|
138
|
+
content: [
|
|
139
|
+
{
|
|
140
|
+
type: 'text',
|
|
141
|
+
text: `❌ **Error finding versions for global "${globalSlug}":** ${errorMessage}`,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
isError: true,
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
})
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { getAccessResults } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
1
4
|
import { defineGlobalTool } from '../../../defineTool.js'
|
|
2
5
|
import { getGlobalInputSchema } from '../../../utils/schemaConversion/getEntityInputSchema.js'
|
|
3
6
|
|
|
4
7
|
export const getGlobalSchemaTool = defineGlobalTool({
|
|
8
|
+
access: (args) => {
|
|
9
|
+
const permissions = args.permissions?.globals?.[args.globalSlug]
|
|
10
|
+
|
|
11
|
+
return defaultAccess(args) && Boolean(permissions?.update)
|
|
12
|
+
},
|
|
5
13
|
annotations: {
|
|
6
14
|
destructiveHint: false,
|
|
7
15
|
idempotentHint: true,
|
|
@@ -10,8 +18,28 @@ export const getGlobalSchemaTool = defineGlobalTool({
|
|
|
10
18
|
title: 'Get Global Schema',
|
|
11
19
|
},
|
|
12
20
|
description: 'Get the input schema for updating a global.',
|
|
13
|
-
}).handler(({ globalSlug, req }) => {
|
|
14
|
-
const
|
|
21
|
+
}).handler(async ({ authorizedMCP, globalSlug, req }) => {
|
|
22
|
+
const permissions = authorizedMCP.overrideAccess
|
|
23
|
+
? null
|
|
24
|
+
: (await getAccessResults({ req })).globals?.[globalSlug]
|
|
25
|
+
|
|
26
|
+
if (!authorizedMCP.overrideAccess && !permissions?.update) {
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: 'text',
|
|
31
|
+
text: `Error: MCP access to "getGlobalSchema" is not enabled for global "${globalSlug}"`,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
isError: true,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const inputSchema = getGlobalInputSchema({
|
|
39
|
+
globalSlug,
|
|
40
|
+
req,
|
|
41
|
+
...(permissions ? { permissions } : {}),
|
|
42
|
+
})
|
|
15
43
|
|
|
16
44
|
if (!inputSchema) {
|
|
17
45
|
return {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { PopulateType } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
|
|
5
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
6
|
+
import { defineGlobalTool } from '../../../defineTool.js'
|
|
7
|
+
import { getLogger } from '../../../utils/getLogger.js'
|
|
8
|
+
|
|
9
|
+
const DEFAULT_DESCRIPTION =
|
|
10
|
+
'Restore a global from a previous version in any version-enabled global.'
|
|
11
|
+
|
|
12
|
+
export const restoreGlobalVersionTool = defineGlobalTool({
|
|
13
|
+
access: (args) =>
|
|
14
|
+
defaultAccess(args) && Boolean(args.permissions?.globals?.[args.globalSlug]?.update),
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: true,
|
|
17
|
+
idempotentHint: false,
|
|
18
|
+
openWorldHint: false,
|
|
19
|
+
readOnlyHint: false,
|
|
20
|
+
title: 'Restore Global Version',
|
|
21
|
+
},
|
|
22
|
+
description: DEFAULT_DESCRIPTION,
|
|
23
|
+
input: z.object({
|
|
24
|
+
id: z.string().describe('The ID of the global version to restore'),
|
|
25
|
+
depth: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.min(0)
|
|
29
|
+
.max(10)
|
|
30
|
+
.describe('How many levels deep to populate relationships in response')
|
|
31
|
+
.optional()
|
|
32
|
+
.default(0),
|
|
33
|
+
fallbackLocale: z
|
|
34
|
+
.string()
|
|
35
|
+
.describe('Optional: fallback locale code to use when requested locale is not available')
|
|
36
|
+
.optional(),
|
|
37
|
+
locale: z
|
|
38
|
+
.string()
|
|
39
|
+
.describe('Optional: locale code to restore in (e.g., "en", "es")')
|
|
40
|
+
.optional(),
|
|
41
|
+
populate: z
|
|
42
|
+
.record(z.string(), z.unknown())
|
|
43
|
+
.describe(
|
|
44
|
+
'Optional: control which fields to include from populated relationship or upload documents.',
|
|
45
|
+
)
|
|
46
|
+
.optional(),
|
|
47
|
+
showHiddenFields: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.describe('Optional: include hidden fields in the restored global response')
|
|
50
|
+
.optional(),
|
|
51
|
+
}),
|
|
52
|
+
}).handler(async ({ authorizedMCP, globalSlug, input, req }) => {
|
|
53
|
+
const payload = req.payload
|
|
54
|
+
const logger = getLogger({ payload })
|
|
55
|
+
const { id, depth, fallbackLocale, locale, populate, showHiddenFields } = input
|
|
56
|
+
|
|
57
|
+
logger.info(`Restoring version for global: ${globalSlug} with ID: ${id}`)
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
const result = await payload.restoreGlobalVersion({
|
|
61
|
+
id,
|
|
62
|
+
slug: globalSlug,
|
|
63
|
+
depth,
|
|
64
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
65
|
+
req,
|
|
66
|
+
...(fallbackLocale ? { fallbackLocale } : {}),
|
|
67
|
+
...(locale ? { locale } : {}),
|
|
68
|
+
...(populate ? { populate: populate as PopulateType } : {}),
|
|
69
|
+
...(showHiddenFields !== undefined ? { showHiddenFields } : {}),
|
|
70
|
+
})
|
|
71
|
+
const resultObject = result as Record<string, unknown>
|
|
72
|
+
const restoredGlobal =
|
|
73
|
+
resultObject.version && typeof resultObject.version === 'object'
|
|
74
|
+
? (resultObject.version as Record<string, unknown>)
|
|
75
|
+
: resultObject
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
content: [
|
|
79
|
+
{
|
|
80
|
+
type: 'text',
|
|
81
|
+
text: `Version "${id}" restored successfully for global "${globalSlug}"!\nRestored global:\n\`\`\`json\n${JSON.stringify(restoredGlobal)}\n\`\`\``,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
doc: restoredGlobal,
|
|
85
|
+
}
|
|
86
|
+
} catch (error) {
|
|
87
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
|
|
88
|
+
logger.error(`Error restoring version ${id} for global ${globalSlug}: ${errorMessage}`)
|
|
89
|
+
return {
|
|
90
|
+
content: [
|
|
91
|
+
{
|
|
92
|
+
type: 'text',
|
|
93
|
+
text: `❌ **Error restoring version "${id}" for global "${globalSlug}":** ${errorMessage}`,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
isError: true,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})
|
|
@@ -2,19 +2,21 @@ import type { SelectType } from 'payload'
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod'
|
|
4
4
|
|
|
5
|
+
import { defaultAccess } from '../../../defaultAccess.js'
|
|
5
6
|
import { defineGlobalTool } from '../../../defineTool.js'
|
|
6
7
|
import { getLogger } from '../../../utils/getLogger.js'
|
|
7
8
|
import {
|
|
8
9
|
getGlobalVirtualFieldNames,
|
|
9
10
|
stripVirtualFields,
|
|
10
11
|
} from '../../../utils/getVirtualFieldNames.js'
|
|
11
|
-
import { localAPIDefaults } from '../../../utils/localAPIDefaults.js'
|
|
12
12
|
import { transformPointDataToPayload } from '../../../utils/transformPointDataToPayload.js'
|
|
13
13
|
import { validateGlobalData } from '../validateEntityData.js'
|
|
14
14
|
|
|
15
15
|
const DEFAULT_DESCRIPTION = 'Update any Payload global by passing the global slug and data.'
|
|
16
16
|
|
|
17
17
|
export const updateGlobalTool = defineGlobalTool({
|
|
18
|
+
access: (args) =>
|
|
19
|
+
defaultAccess(args) && Boolean(args.permissions?.globals?.[args.globalSlug]?.update),
|
|
18
20
|
annotations: {
|
|
19
21
|
destructiveHint: true,
|
|
20
22
|
idempotentHint: false,
|
|
@@ -78,7 +80,8 @@ export const updateGlobalTool = defineGlobalTool({
|
|
|
78
80
|
data: parsedData,
|
|
79
81
|
depth,
|
|
80
82
|
draft,
|
|
81
|
-
|
|
83
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
84
|
+
req,
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
if (locale) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollectionSlug, GlobalSlug, PayloadRequest, SanitizedConfig } from 'payload'
|
|
2
2
|
|
|
3
|
-
import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/server'
|
|
3
|
+
import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/server/validators/cf-worker'
|
|
4
4
|
|
|
5
5
|
import type { JsonSchemaType, MCPToolResponse } from '../../types.js'
|
|
6
6
|
|
package/src/mcp/builtinTools.ts
CHANGED
|
@@ -8,16 +8,42 @@ import {
|
|
|
8
8
|
unlockCollectionTool,
|
|
9
9
|
verifyCollectionTool,
|
|
10
10
|
} from './builtin/collections/authTools.js'
|
|
11
|
-
import {
|
|
11
|
+
import { countDocumentsTool } from './builtin/collections/countTool.js'
|
|
12
|
+
import { countVersionsTool } from './builtin/collections/countVersionsTool.js'
|
|
13
|
+
import { createDocumentsTool } from './builtin/collections/createTool.js'
|
|
12
14
|
import { deleteDocumentsTool } from './builtin/collections/deleteTool.js'
|
|
15
|
+
import { duplicateDocumentTool } from './builtin/collections/duplicateTool.js'
|
|
16
|
+
import { findDistinctTool } from './builtin/collections/findDistinctTool.js'
|
|
13
17
|
import { findDocumentsTool } from './builtin/collections/findTool.js'
|
|
18
|
+
import { findVersionByIDTool } from './builtin/collections/findVersionByIDTool.js'
|
|
19
|
+
import { findVersionsTool } from './builtin/collections/findVersionsTool.js'
|
|
14
20
|
import { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js'
|
|
21
|
+
import { restoreVersionTool } from './builtin/collections/restoreVersionTool.js'
|
|
15
22
|
import { updateDocumentTool } from './builtin/collections/updateTool.js'
|
|
23
|
+
import { getUploadInstructionsTool } from './builtin/collections/uploadInstructionsTool.js'
|
|
16
24
|
import { getConfigInfoTool } from './builtin/getConfigInfoTool.js'
|
|
25
|
+
import { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js'
|
|
17
26
|
import { findGlobalTool } from './builtin/globals/findTool.js'
|
|
27
|
+
import { findGlobalVersionByIDTool } from './builtin/globals/findVersionByIDTool.js'
|
|
28
|
+
import { findGlobalVersionsTool } from './builtin/globals/findVersionsTool.js'
|
|
18
29
|
import { getGlobalSchemaTool } from './builtin/globals/getGlobalSchemaTool.js'
|
|
30
|
+
import { restoreGlobalVersionTool } from './builtin/globals/restoreVersionTool.js'
|
|
19
31
|
import { updateGlobalTool } from './builtin/globals/updateTool.js'
|
|
20
32
|
|
|
33
|
+
type CollectionBuiltin = {
|
|
34
|
+
mcpName: string
|
|
35
|
+
requiresDuplicateEnabled?: boolean
|
|
36
|
+
requiresUpload?: boolean
|
|
37
|
+
requiresVersions?: boolean
|
|
38
|
+
tool: CollectionTool
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type GlobalBuiltin = {
|
|
42
|
+
mcpName: string
|
|
43
|
+
requiresVersions?: boolean
|
|
44
|
+
tool: GlobalTool
|
|
45
|
+
}
|
|
46
|
+
|
|
21
47
|
export const TOOL_BUILTINS = {
|
|
22
48
|
getConfigInfo: { mcpName: 'getConfigInfo', tool: getConfigInfoTool },
|
|
23
49
|
} satisfies Record<string, { mcpName: string; tool: Tool }>
|
|
@@ -28,12 +54,32 @@ export const TOOL_BUILTINS = {
|
|
|
28
54
|
* automatically.
|
|
29
55
|
*/
|
|
30
56
|
export const COLLECTION_BUILTINS = {
|
|
31
|
-
|
|
57
|
+
count: { mcpName: 'countDocuments', tool: countDocumentsTool },
|
|
58
|
+
countVersions: { mcpName: 'countVersions', requiresVersions: true, tool: countVersionsTool },
|
|
59
|
+
create: { mcpName: 'createDocuments', tool: createDocumentsTool },
|
|
32
60
|
delete: { mcpName: 'deleteDocuments', tool: deleteDocumentsTool },
|
|
61
|
+
duplicate: {
|
|
62
|
+
mcpName: 'duplicateDocument',
|
|
63
|
+
requiresDuplicateEnabled: true,
|
|
64
|
+
tool: duplicateDocumentTool,
|
|
65
|
+
},
|
|
33
66
|
find: { mcpName: 'findDocuments', tool: findDocumentsTool },
|
|
67
|
+
findDistinct: { mcpName: 'findDistinct', tool: findDistinctTool },
|
|
68
|
+
findVersionByID: {
|
|
69
|
+
mcpName: 'findVersionByID',
|
|
70
|
+
requiresVersions: true,
|
|
71
|
+
tool: findVersionByIDTool,
|
|
72
|
+
},
|
|
73
|
+
findVersions: { mcpName: 'findVersions', requiresVersions: true, tool: findVersionsTool },
|
|
34
74
|
getCollectionSchema: { mcpName: 'getCollectionSchema', tool: getCollectionSchemaTool },
|
|
75
|
+
getUploadInstructions: {
|
|
76
|
+
mcpName: 'getUploadInstructions',
|
|
77
|
+
requiresUpload: true,
|
|
78
|
+
tool: getUploadInstructionsTool,
|
|
79
|
+
},
|
|
80
|
+
restoreVersion: { mcpName: 'restoreVersion', requiresVersions: true, tool: restoreVersionTool },
|
|
35
81
|
update: { mcpName: 'updateDocument', tool: updateDocumentTool },
|
|
36
|
-
} satisfies Record<string,
|
|
82
|
+
} satisfies Record<string, CollectionBuiltin>
|
|
37
83
|
|
|
38
84
|
/**
|
|
39
85
|
* The static auth tools surfaced under auth-enabled collections. Keys are the
|
|
@@ -59,10 +105,30 @@ export const COLLECTION_AUTH_BUILTINS = {
|
|
|
59
105
|
* `MCPGlobalBuiltinName`.
|
|
60
106
|
*/
|
|
61
107
|
export const GLOBAL_BUILTINS = {
|
|
108
|
+
countGlobalVersions: {
|
|
109
|
+
mcpName: 'countGlobalVersions',
|
|
110
|
+
requiresVersions: true,
|
|
111
|
+
tool: countGlobalVersionsTool,
|
|
112
|
+
},
|
|
62
113
|
find: { mcpName: 'findGlobal', tool: findGlobalTool },
|
|
114
|
+
findGlobalVersionByID: {
|
|
115
|
+
mcpName: 'findGlobalVersionByID',
|
|
116
|
+
requiresVersions: true,
|
|
117
|
+
tool: findGlobalVersionByIDTool,
|
|
118
|
+
},
|
|
119
|
+
findGlobalVersions: {
|
|
120
|
+
mcpName: 'findGlobalVersions',
|
|
121
|
+
requiresVersions: true,
|
|
122
|
+
tool: findGlobalVersionsTool,
|
|
123
|
+
},
|
|
63
124
|
getGlobalSchema: { mcpName: 'getGlobalSchema', tool: getGlobalSchemaTool },
|
|
125
|
+
restoreGlobalVersion: {
|
|
126
|
+
mcpName: 'restoreGlobalVersion',
|
|
127
|
+
requiresVersions: true,
|
|
128
|
+
tool: restoreGlobalVersionTool,
|
|
129
|
+
},
|
|
64
130
|
update: { mcpName: 'updateGlobal', tool: updateGlobalTool },
|
|
65
|
-
} satisfies Record<string,
|
|
131
|
+
} satisfies Record<string, GlobalBuiltin>
|
|
66
132
|
|
|
67
133
|
export type MCPCollectionBuiltinName = keyof typeof COLLECTION_BUILTINS
|
|
68
134
|
|
|
@@ -83,7 +149,7 @@ export const TOOL_BUILTIN_ENTRIES = Object.entries(TOOL_BUILTINS) as Array<
|
|
|
83
149
|
>
|
|
84
150
|
|
|
85
151
|
export const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS) as Array<
|
|
86
|
-
[MCPCollectionBuiltinName,
|
|
152
|
+
[MCPCollectionBuiltinName, CollectionBuiltin]
|
|
87
153
|
>
|
|
88
154
|
|
|
89
155
|
export const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS) as Array<
|
|
@@ -91,5 +157,5 @@ export const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BU
|
|
|
91
157
|
>
|
|
92
158
|
|
|
93
159
|
export const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS) as Array<
|
|
94
|
-
[MCPGlobalBuiltinName,
|
|
160
|
+
[MCPGlobalBuiltinName, GlobalBuiltin]
|
|
95
161
|
>
|