@payloadcms/plugin-mcp 4.0.0-internal.bc5cf8c → 4.0.0-internal.bf4bcce
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/dist/defaultAccess.d.ts.map +1 -1
- package/dist/defineTool.d.ts +8 -8
- package/dist/defineTool.d.ts.map +1 -1
- package/dist/endpoint/access.d.ts +2 -7
- package/dist/endpoint/access.d.ts.map +1 -1
- package/dist/endpoint/access.js +17 -14
- 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 +91 -16
- package/dist/endpoint/index.js.map +1 -1
- package/dist/endpoint/oauth.d.ts +27 -0
- package/dist/endpoint/oauth.d.ts.map +1 -0
- package/dist/endpoint/oauth.js +61 -0
- package/dist/endpoint/oauth.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts +6 -6
- package/dist/mcp/buildMcpServer.d.ts.map +1 -1
- package/dist/mcp/buildMcpServer.js +68 -34
- package/dist/mcp/buildMcpServer.js.map +1 -1
- package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/authTools.js +80 -56
- package/dist/mcp/builtin/collections/authTools.js.map +1 -1
- package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/countTool.js +10 -16
- package/dist/mcp/builtin/collections/countTool.js.map +1 -1
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/countVersionsTool.js +10 -15
- package/dist/mcp/builtin/collections/countVersionsTool.js.map +1 -1
- 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 +104 -54
- 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 +45 -45
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -1
- package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/duplicateTool.js +32 -39
- package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -1
- 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 +88 -0
- package/dist/mcp/builtin/collections/fileInput.js.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findDistinctTool.js +12 -28
- package/dist/mcp/builtin/collections/findDistinctTool.js.map +1 -1
- package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findTool.js +29 -48
- package/dist/mcp/builtin/collections/findTool.js.map +1 -1
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findVersionByIDTool.js +18 -28
- package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -1
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findVersionsTool.js +17 -32
- package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -1
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +68 -12
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -1
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/restoreVersionTool.js +15 -28
- package/dist/mcp/builtin/collections/restoreVersionTool.js.map +1 -1
- package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/updateTool.js +67 -87
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -1
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js +55 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js.map +1 -0
- package/dist/mcp/builtin/formatEntityError.d.ts +16 -0
- package/dist/mcp/builtin/formatEntityError.d.ts.map +1 -0
- package/dist/mcp/builtin/formatEntityError.js +55 -0
- package/dist/mcp/builtin/formatEntityError.js.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -1
- package/dist/mcp/builtin/getConfigInfoTool.js +5 -7
- package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -1
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/countVersionsTool.js +10 -15
- package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -1
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/findTool.js +12 -18
- package/dist/mcp/builtin/globals/findTool.js.map +1 -1
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/findVersionByIDTool.js +14 -26
- package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -1
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/findVersionsTool.js +14 -31
- package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -1
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +46 -12
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -1
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/restoreVersionTool.js +16 -24
- package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -1
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/updateTool.js +28 -37
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -1
- package/dist/mcp/builtinTools.d.ts +6 -0
- package/dist/mcp/builtinTools.d.ts.map +1 -1
- package/dist/mcp/builtinTools.js +9 -3
- package/dist/mcp/builtinTools.js.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.js +6 -1
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -1
- package/dist/stdio.d.ts +3 -4
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +65 -45
- package/dist/stdio.js.map +1 -1
- package/dist/types.d.ts +94 -16
- 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/resolveProjectRoot.d.ts.map +1 -1
- package/dist/utils/toStandardSchema.d.ts.map +1 -1
- package/package.json +9 -13
- package/src/endpoint/access.ts +14 -14
- package/src/endpoint/index.ts +79 -14
- package/src/endpoint/oauth.ts +72 -0
- package/src/index.ts +11 -4
- package/src/mcp/buildMcpServer.ts +80 -50
- package/src/mcp/builtin/collections/authTools.ts +80 -69
- package/src/mcp/builtin/collections/countTool.ts +10 -23
- package/src/mcp/builtin/collections/countVersionsTool.ts +10 -20
- package/src/mcp/builtin/collections/createTool.ts +110 -77
- package/src/mcp/builtin/collections/deleteTool.ts +36 -65
- package/src/mcp/builtin/collections/duplicateTool.ts +36 -87
- package/src/mcp/builtin/collections/fileInput.spec.ts +93 -0
- package/src/mcp/builtin/collections/fileInput.ts +127 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +12 -65
- package/src/mcp/builtin/collections/findTool.ts +25 -108
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +16 -60
- package/src/mcp/builtin/collections/findVersionsTool.ts +15 -87
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +60 -15
- package/src/mcp/builtin/collections/restoreVersionTool.ts +15 -58
- package/src/mcp/builtin/collections/updateTool.ts +63 -101
- package/src/mcp/builtin/collections/uploadInstructionsTool.ts +64 -0
- package/src/mcp/builtin/formatEntityError.ts +77 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +4 -5
- package/src/mcp/builtin/globals/countVersionsTool.ts +10 -19
- package/src/mcp/builtin/globals/findTool.ts +14 -53
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +14 -54
- package/src/mcp/builtin/globals/findVersionsTool.ts +15 -94
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +41 -9
- package/src/mcp/builtin/globals/restoreVersionTool.ts +15 -47
- package/src/mcp/builtin/globals/updateTool.ts +39 -62
- package/src/mcp/builtinTools.ts +9 -2
- package/src/mcp/sanitizeMCPConfig.ts +6 -1
- package/src/stdio.ts +63 -45
- package/src/types.ts +95 -16
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts +0 -9
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +0 -1
- package/dist/mcp/builtin/collections/formatCollectionError.js +0 -60
- package/dist/mcp/builtin/collections/formatCollectionError.js.map +0 -1
- package/dist/mcp/builtin/validateEntityData.d.ts +0 -14
- package/dist/mcp/builtin/validateEntityData.d.ts.map +0 -1
- package/dist/mcp/builtin/validateEntityData.js +0 -82
- package/dist/mcp/builtin/validateEntityData.js.map +0 -1
- package/dist/utils/getVirtualFieldNames.d.ts +0 -14
- package/dist/utils/getVirtualFieldNames.d.ts.map +0 -1
- package/dist/utils/getVirtualFieldNames.js +0 -35
- package/dist/utils/getVirtualFieldNames.js.map +0 -1
- package/dist/utils/localAPIDefaults.d.ts +0 -20
- package/dist/utils/localAPIDefaults.d.ts.map +0 -1
- package/dist/utils/localAPIDefaults.js +0 -19
- package/dist/utils/localAPIDefaults.js.map +0 -1
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts +0 -11
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/getEntityInputSchema.js +0 -34
- package/dist/utils/schemaConversion/getEntityInputSchema.js.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +0 -7
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js +0 -20
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +0 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +0 -15
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js +0 -464
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +0 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +0 -158
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +0 -1
- package/dist/utils/transformPointDataToPayload.d.ts +0 -7
- package/dist/utils/transformPointDataToPayload.d.ts.map +0 -1
- package/dist/utils/transformPointDataToPayload.js +0 -28
- package/dist/utils/transformPointDataToPayload.js.map +0 -1
- package/dist/utils/whereSchema.d.ts +0 -9
- package/dist/utils/whereSchema.d.ts.map +0 -1
- package/dist/utils/whereSchema.js +0 -13
- package/dist/utils/whereSchema.js.map +0 -1
- package/src/@types/assets.d.ts +0 -3
- package/src/mcp/builtin/collections/formatCollectionError.ts +0 -84
- package/src/mcp/builtin/validateEntityData.ts +0 -132
- package/src/utils/getVirtualFieldNames.ts +0 -53
- package/src/utils/localAPIDefaults.ts +0 -22
- package/src/utils/schemaConversion/getEntityInputSchema.ts +0 -78
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +0 -27
- package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +0 -103
- package/src/utils/schemaConversion/sanitizeEntitySchema.ts +0 -529
- package/src/utils/transformPointDataToPayload.ts +0 -40
- package/src/utils/whereSchema.ts +0 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/mcp/builtin/globals/findVersionsTool.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/mcp/builtin/globals/findVersionsTool.ts"],"sourcesContent":["import { findGlobalVersionsInputSchema } from 'payload'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineGlobalTool } from '../../../defineTool.js'\nimport { getLogger } from '../../../utils/getLogger.js'\n\nconst DEFAULT_DESCRIPTION =\n 'Find global versions in any version-enabled global by passing the global slug and optional where clause.'\n\nexport const findGlobalVersionsTool = defineGlobalTool({\n access: (args) =>\n defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.readVersions),\n annotations: {\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n readOnlyHint: true,\n title: 'Find Global Versions',\n },\n description: DEFAULT_DESCRIPTION,\n input: findGlobalVersionsInputSchema,\n}).handler(async ({ slug, authorizedMCP, input, req }) => {\n const payload = req.payload\n const logger = getLogger({ payload })\n const { depth, fallbackLocale, limit, locale, page, pagination, populate, select, sort, where } =\n input\n\n logger.info(`Finding versions for global: ${slug}, limit: ${limit}, page: ${page}`)\n\n try {\n const result = await payload.findGlobalVersions({\n slug,\n depth,\n limit,\n overrideAccess: authorizedMCP.overrideAccess,\n page,\n req,\n ...(fallbackLocale !== undefined ? { fallbackLocale } : {}),\n ...(locale ? { locale } : {}),\n ...(pagination !== undefined ? { pagination } : {}),\n ...(populate ? { populate } : {}),\n ...(select ? { select } : {}),\n ...(sort ? { sort } : {}),\n ...(where ? { where } : {}),\n })\n\n return {\n content: [\n {\n type: 'text',\n text: `Versions for global \"${slug}\":\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n doc: result as unknown as Record<string, unknown>,\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n logger.error(`Error finding versions for global ${slug}: ${errorMessage}`)\n return {\n content: [\n {\n type: 'text',\n text: `❌ **Error finding versions for global \"${slug}\":** ${errorMessage}`,\n },\n ],\n isError: true,\n }\n }\n})\n"],"names":["findGlobalVersionsInputSchema","defaultAccess","defineGlobalTool","getLogger","DEFAULT_DESCRIPTION","findGlobalVersionsTool","access","args","Boolean","permissions","globals","slug","readVersions","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","handler","authorizedMCP","req","payload","logger","depth","fallbackLocale","limit","locale","page","pagination","populate","select","sort","where","info","result","findGlobalVersions","overrideAccess","undefined","content","type","text","JSON","stringify","doc","error","errorMessage","Error","message","isError"],"mappings":"AAAA,SAASA,6BAA6B,QAAQ,UAAS;AAEvD,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,SAAS,QAAQ,8BAA6B;AAEvD,MAAMC,sBACJ;AAEF,OAAO,MAAMC,yBAAyBH,iBAAiB;IACrDI,QAAQ,CAACC,OACPN,cAAcM,SAASC,QAAQD,KAAKE,WAAW,EAAEC,SAAS,CAACH,KAAKI,IAAI,CAAC,EAAEC;IACzEC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAaf;IACbgB,OAAOpB;AACT,GAAGqB,OAAO,CAAC,OAAO,EAAEV,IAAI,EAAEW,aAAa,EAAEF,KAAK,EAAEG,GAAG,EAAE;IACnD,MAAMC,UAAUD,IAAIC,OAAO;IAC3B,MAAMC,SAAStB,UAAU;QAAEqB;IAAQ;IACnC,MAAM,EAAEE,KAAK,EAAEC,cAAc,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAC7Ff;IAEFK,OAAOW,IAAI,CAAC,CAAC,6BAA6B,EAAEzB,KAAK,SAAS,EAAEiB,MAAM,QAAQ,EAAEE,MAAM;IAElF,IAAI;QACF,MAAMO,SAAS,MAAMb,QAAQc,kBAAkB,CAAC;YAC9C3B;YACAe;YACAE;YACAW,gBAAgBjB,cAAciB,cAAc;YAC5CT;YACAP;YACA,GAAII,mBAAmBa,YAAY;gBAAEb;YAAe,IAAI,CAAC,CAAC;YAC1D,GAAIE,SAAS;gBAAEA;YAAO,IAAI,CAAC,CAAC;YAC5B,GAAIE,eAAeS,YAAY;gBAAET;YAAW,IAAI,CAAC,CAAC;YAClD,GAAIC,WAAW;gBAAEA;YAAS,IAAI,CAAC,CAAC;YAChC,GAAIC,SAAS;gBAAEA;YAAO,IAAI,CAAC,CAAC;YAC5B,GAAIC,OAAO;gBAAEA;YAAK,IAAI,CAAC,CAAC;YACxB,GAAIC,QAAQ;gBAAEA;YAAM,IAAI,CAAC,CAAC;QAC5B;QAEA,OAAO;YACLM,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,qBAAqB,EAAEhC,KAAK,gBAAgB,EAAEiC,KAAKC,SAAS,CAACR,QAAQ,QAAQ,CAAC;gBACvF;aACD;YACDS,KAAKT;QACP;IACF,EAAE,OAAOU,OAAO;QACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;QAC9DzB,OAAOsB,KAAK,CAAC,CAAC,kCAAkC,EAAEpC,KAAK,EAAE,EAAEqC,cAAc;QACzE,OAAO;YACLP,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,uCAAuC,EAAEhC,KAAK,KAAK,EAAEqC,cAAc;gBAC5E;aACD;YACDG,SAAS;QACX;IACF;AACF,GAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGlobalSchemaTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/getGlobalSchemaTool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getGlobalSchemaTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/getGlobalSchemaTool.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,wCAkE9B,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { getAccessResults, getGlobalInputSchema, getGlobalSchemaInputSchema } from 'payload';
|
|
2
|
+
import { getLLMInstructions } from 'payload/internal';
|
|
1
3
|
import { defaultAccess } from '../../../defaultAccess.js';
|
|
2
4
|
import { defineGlobalTool } from '../../../defineTool.js';
|
|
3
|
-
import { getGlobalInputSchema } from '../../../utils/schemaConversion/getEntityInputSchema.js';
|
|
4
5
|
export const getGlobalSchemaTool = defineGlobalTool({
|
|
5
6
|
access: (args)=>{
|
|
6
|
-
const permissions = args.permissions?.globals?.[args.
|
|
7
|
-
return defaultAccess(args) && Boolean(permissions?.
|
|
7
|
+
const permissions = args.permissions?.globals?.[args.slug];
|
|
8
|
+
return defaultAccess(args) && Boolean(permissions?.update);
|
|
8
9
|
},
|
|
9
10
|
annotations: {
|
|
10
11
|
destructiveHint: false,
|
|
@@ -13,33 +14,66 @@ export const getGlobalSchemaTool = defineGlobalTool({
|
|
|
13
14
|
readOnlyHint: true,
|
|
14
15
|
title: 'Get Global Schema'
|
|
15
16
|
},
|
|
16
|
-
description: 'Get the input schema
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
description: 'Get the input schema and LLM instructions before updating a global.',
|
|
18
|
+
input: getGlobalSchemaInputSchema
|
|
19
|
+
}).handler(async ({ slug, authorizedMCP, req })=>{
|
|
20
|
+
const permissions = authorizedMCP.overrideAccess ? null : (await getAccessResults({
|
|
20
21
|
req
|
|
22
|
+
})).globals?.[slug];
|
|
23
|
+
if (!authorizedMCP.overrideAccess && !permissions?.update) {
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: `Error: MCP access to "getGlobalSchema" is not enabled for global "${slug}"`
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
isError: true
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const inputSchema = getGlobalInputSchema({
|
|
35
|
+
globalSlug: slug,
|
|
36
|
+
req,
|
|
37
|
+
...permissions ? {
|
|
38
|
+
permissions
|
|
39
|
+
} : {}
|
|
21
40
|
});
|
|
22
41
|
if (!inputSchema) {
|
|
23
42
|
return {
|
|
24
43
|
content: [
|
|
25
44
|
{
|
|
26
45
|
type: 'text',
|
|
27
|
-
text: `Error: Global "${
|
|
46
|
+
text: `Error: Global "${slug}" not found`
|
|
28
47
|
}
|
|
29
48
|
],
|
|
30
49
|
isError: true
|
|
31
50
|
};
|
|
32
51
|
}
|
|
52
|
+
const instructions = await getLLMInstructions({
|
|
53
|
+
slug,
|
|
54
|
+
type: 'global',
|
|
55
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
56
|
+
req
|
|
57
|
+
});
|
|
33
58
|
return {
|
|
34
59
|
content: [
|
|
35
60
|
{
|
|
36
61
|
type: 'text',
|
|
37
|
-
text: `Schema for global "${
|
|
38
|
-
}
|
|
62
|
+
text: `Schema for global "${slug}":\n\`\`\`json\n${JSON.stringify(inputSchema)}\n\`\`\``
|
|
63
|
+
},
|
|
64
|
+
...instructions ? [
|
|
65
|
+
{
|
|
66
|
+
type: 'text',
|
|
67
|
+
text: instructions
|
|
68
|
+
}
|
|
69
|
+
] : []
|
|
39
70
|
],
|
|
40
71
|
structuredContent: {
|
|
41
|
-
|
|
42
|
-
schema: inputSchema
|
|
72
|
+
slug,
|
|
73
|
+
schema: inputSchema,
|
|
74
|
+
...instructions ? {
|
|
75
|
+
instructions
|
|
76
|
+
} : {}
|
|
43
77
|
}
|
|
44
78
|
};
|
|
45
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/mcp/builtin/globals/getGlobalSchemaTool.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/mcp/builtin/globals/getGlobalSchemaTool.ts"],"sourcesContent":["import { getAccessResults, getGlobalInputSchema, getGlobalSchemaInputSchema } from 'payload'\nimport { getLLMInstructions } from 'payload/internal'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineGlobalTool } from '../../../defineTool.js'\n\nexport const getGlobalSchemaTool = defineGlobalTool({\n access: (args) => {\n const permissions = args.permissions?.globals?.[args.slug]\n\n return defaultAccess(args) && Boolean(permissions?.update)\n },\n annotations: {\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n readOnlyHint: true,\n title: 'Get Global Schema',\n },\n description: 'Get the input schema and LLM instructions before updating a global.',\n input: getGlobalSchemaInputSchema,\n}).handler(async ({ slug, authorizedMCP, req }) => {\n const permissions = authorizedMCP.overrideAccess\n ? null\n : (await getAccessResults({ req })).globals?.[slug]\n\n if (!authorizedMCP.overrideAccess && !permissions?.update) {\n return {\n content: [\n {\n type: 'text',\n text: `Error: MCP access to \"getGlobalSchema\" is not enabled for global \"${slug}\"`,\n },\n ],\n isError: true,\n }\n }\n\n const inputSchema = getGlobalInputSchema({\n globalSlug: slug,\n req,\n ...(permissions ? { permissions } : {}),\n })\n\n if (!inputSchema) {\n return {\n content: [{ type: 'text', text: `Error: Global \"${slug}\" not found` }],\n isError: true,\n }\n }\n\n const instructions = await getLLMInstructions({\n slug,\n type: 'global',\n overrideAccess: authorizedMCP.overrideAccess,\n req,\n })\n\n return {\n content: [\n {\n type: 'text',\n text: `Schema for global \"${slug}\":\\n\\`\\`\\`json\\n${JSON.stringify(inputSchema)}\\n\\`\\`\\``,\n },\n ...(instructions ? [{ type: 'text' as const, text: instructions }] : []),\n ],\n structuredContent: {\n slug,\n schema: inputSchema,\n ...(instructions ? { instructions } : {}),\n },\n }\n})\n"],"names":["getAccessResults","getGlobalInputSchema","getGlobalSchemaInputSchema","getLLMInstructions","defaultAccess","defineGlobalTool","getGlobalSchemaTool","access","args","permissions","globals","slug","Boolean","update","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","handler","authorizedMCP","req","overrideAccess","content","type","text","isError","inputSchema","globalSlug","instructions","JSON","stringify","structuredContent","schema"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,oBAAoB,EAAEC,0BAA0B,QAAQ,UAAS;AAC5F,SAASC,kBAAkB,QAAQ,mBAAkB;AAErD,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,gBAAgB,QAAQ,yBAAwB;AAEzD,OAAO,MAAMC,sBAAsBD,iBAAiB;IAClDE,QAAQ,CAACC;QACP,MAAMC,cAAcD,KAAKC,WAAW,EAAEC,SAAS,CAACF,KAAKG,IAAI,CAAC;QAE1D,OAAOP,cAAcI,SAASI,QAAQH,aAAaI;IACrD;IACAC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAa;IACbC,OAAOnB;AACT,GAAGoB,OAAO,CAAC,OAAO,EAAEX,IAAI,EAAEY,aAAa,EAAEC,GAAG,EAAE;IAC5C,MAAMf,cAAcc,cAAcE,cAAc,GAC5C,OACA,AAAC,CAAA,MAAMzB,iBAAiB;QAAEwB;IAAI,EAAC,EAAGd,OAAO,EAAE,CAACC,KAAK;IAErD,IAAI,CAACY,cAAcE,cAAc,IAAI,CAAChB,aAAaI,QAAQ;QACzD,OAAO;YACLa,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,kEAAkE,EAAEjB,KAAK,CAAC,CAAC;gBACpF;aACD;YACDkB,SAAS;QACX;IACF;IAEA,MAAMC,cAAc7B,qBAAqB;QACvC8B,YAAYpB;QACZa;QACA,GAAIf,cAAc;YAAEA;QAAY,IAAI,CAAC,CAAC;IACxC;IAEA,IAAI,CAACqB,aAAa;QAChB,OAAO;YACLJ,SAAS;gBAAC;oBAAEC,MAAM;oBAAQC,MAAM,CAAC,eAAe,EAAEjB,KAAK,WAAW,CAAC;gBAAC;aAAE;YACtEkB,SAAS;QACX;IACF;IAEA,MAAMG,eAAe,MAAM7B,mBAAmB;QAC5CQ;QACAgB,MAAM;QACNF,gBAAgBF,cAAcE,cAAc;QAC5CD;IACF;IAEA,OAAO;QACLE,SAAS;YACP;gBACEC,MAAM;gBACNC,MAAM,CAAC,mBAAmB,EAAEjB,KAAK,gBAAgB,EAAEsB,KAAKC,SAAS,CAACJ,aAAa,QAAQ,CAAC;YAC1F;eACIE,eAAe;gBAAC;oBAAEL,MAAM;oBAAiBC,MAAMI;gBAAa;aAAE,GAAG,EAAE;SACxE;QACDG,mBAAmB;YACjBxB;YACAyB,QAAQN;YACR,GAAIE,eAAe;gBAAEA;YAAa,IAAI,CAAC,CAAC;QAC1C;IACF;AACF,GAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersionTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/restoreVersionTool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"restoreVersionTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/restoreVersionTool.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,wBAAwB,wCA0DnC,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { restoreGlobalVersionInputSchema } from 'payload';
|
|
2
2
|
import { defaultAccess } from '../../../defaultAccess.js';
|
|
3
3
|
import { defineGlobalTool } from '../../../defineTool.js';
|
|
4
4
|
import { getLogger } from '../../../utils/getLogger.js';
|
|
5
|
-
import { localAPIDefaults } from '../../../utils/localAPIDefaults.js';
|
|
6
5
|
const DEFAULT_DESCRIPTION = 'Restore a global from a previous version in any version-enabled global.';
|
|
7
6
|
export const restoreGlobalVersionTool = defineGlobalTool({
|
|
8
|
-
access: (args)=>defaultAccess(args) && Boolean(args.permissions?.globals?.[args.
|
|
7
|
+
access: (args)=>defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.update),
|
|
9
8
|
annotations: {
|
|
10
9
|
destructiveHint: true,
|
|
11
10
|
idempotentHint: false,
|
|
@@ -14,39 +13,32 @@ export const restoreGlobalVersionTool = defineGlobalTool({
|
|
|
14
13
|
title: 'Restore Global Version'
|
|
15
14
|
},
|
|
16
15
|
description: DEFAULT_DESCRIPTION,
|
|
17
|
-
input:
|
|
18
|
-
|
|
19
|
-
depth: z.number().int().min(0).max(10).describe('How many levels deep to populate relationships in response').optional().default(0),
|
|
20
|
-
fallbackLocale: z.string().describe('Optional: fallback locale code to use when requested locale is not available').optional(),
|
|
21
|
-
locale: z.string().describe('Optional: locale code to restore in (e.g., "en", "es")').optional(),
|
|
22
|
-
populate: z.record(z.string(), z.unknown()).describe('Optional: control which fields to include from populated relationship or upload documents.').optional(),
|
|
23
|
-
showHiddenFields: z.boolean().describe('Optional: include hidden fields in the restored global response').optional()
|
|
24
|
-
})
|
|
25
|
-
}).handler(async ({ authorizedMCP, globalSlug, input, req })=>{
|
|
16
|
+
input: restoreGlobalVersionInputSchema
|
|
17
|
+
}).handler(async ({ slug, authorizedMCP, input, req })=>{
|
|
26
18
|
const payload = req.payload;
|
|
27
19
|
const logger = getLogger({
|
|
28
20
|
payload
|
|
29
21
|
});
|
|
30
|
-
const { id, depth, fallbackLocale, locale, populate,
|
|
31
|
-
logger.info(`Restoring version for global: ${
|
|
22
|
+
const { id, depth, fallbackLocale, locale, populate, select } = input;
|
|
23
|
+
logger.info(`Restoring version for global: ${slug} with ID: ${id}`);
|
|
32
24
|
try {
|
|
33
25
|
const result = await payload.restoreGlobalVersion({
|
|
34
|
-
id,
|
|
35
|
-
slug
|
|
26
|
+
id: String(id),
|
|
27
|
+
slug,
|
|
36
28
|
depth,
|
|
29
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
37
30
|
req,
|
|
38
|
-
...
|
|
39
|
-
...fallbackLocale ? {
|
|
31
|
+
...fallbackLocale !== undefined ? {
|
|
40
32
|
fallbackLocale
|
|
41
33
|
} : {},
|
|
42
34
|
...locale ? {
|
|
43
35
|
locale
|
|
44
36
|
} : {},
|
|
45
37
|
...populate ? {
|
|
46
|
-
populate
|
|
38
|
+
populate
|
|
47
39
|
} : {},
|
|
48
|
-
...
|
|
49
|
-
|
|
40
|
+
...select ? {
|
|
41
|
+
select
|
|
50
42
|
} : {}
|
|
51
43
|
});
|
|
52
44
|
const resultObject = result;
|
|
@@ -55,19 +47,19 @@ export const restoreGlobalVersionTool = defineGlobalTool({
|
|
|
55
47
|
content: [
|
|
56
48
|
{
|
|
57
49
|
type: 'text',
|
|
58
|
-
text: `Version "${id}" restored successfully for global "${
|
|
50
|
+
text: `Version "${id}" restored successfully for global "${slug}"!\nRestored global:\n\`\`\`json\n${JSON.stringify(restoredGlobal)}\n\`\`\``
|
|
59
51
|
}
|
|
60
52
|
],
|
|
61
53
|
doc: restoredGlobal
|
|
62
54
|
};
|
|
63
55
|
} catch (error) {
|
|
64
56
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
65
|
-
logger.error(`Error restoring version ${id} for global ${
|
|
57
|
+
logger.error(`Error restoring version ${id} for global ${slug}: ${errorMessage}`);
|
|
66
58
|
return {
|
|
67
59
|
content: [
|
|
68
60
|
{
|
|
69
61
|
type: 'text',
|
|
70
|
-
text: `❌ **Error restoring version "${id}" for global "${
|
|
62
|
+
text: `❌ **Error restoring version "${id}" for global "${slug}":** ${errorMessage}`
|
|
71
63
|
}
|
|
72
64
|
],
|
|
73
65
|
isError: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/mcp/builtin/globals/restoreVersionTool.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/mcp/builtin/globals/restoreVersionTool.ts"],"sourcesContent":["import { restoreGlobalVersionInputSchema } from 'payload'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineGlobalTool } from '../../../defineTool.js'\nimport { getLogger } from '../../../utils/getLogger.js'\n\nconst DEFAULT_DESCRIPTION =\n 'Restore a global from a previous version in any version-enabled global.'\n\nexport const restoreGlobalVersionTool = defineGlobalTool({\n access: (args) => defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.update),\n annotations: {\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n readOnlyHint: false,\n title: 'Restore Global Version',\n },\n description: DEFAULT_DESCRIPTION,\n input: restoreGlobalVersionInputSchema,\n}).handler(async ({ slug, authorizedMCP, input, req }) => {\n const payload = req.payload\n const logger = getLogger({ payload })\n const { id, depth, fallbackLocale, locale, populate, select } = input\n\n logger.info(`Restoring version for global: ${slug} with ID: ${id}`)\n\n try {\n const result = await payload.restoreGlobalVersion({\n id: String(id),\n slug,\n depth,\n overrideAccess: authorizedMCP.overrideAccess,\n req,\n ...(fallbackLocale !== undefined ? { fallbackLocale } : {}),\n ...(locale ? { locale } : {}),\n ...(populate ? { populate } : {}),\n ...(select ? { select } : {}),\n })\n const resultObject = result as Record<string, unknown>\n const restoredGlobal =\n resultObject.version && typeof resultObject.version === 'object'\n ? (resultObject.version as Record<string, unknown>)\n : resultObject\n\n return {\n content: [\n {\n type: 'text',\n text: `Version \"${id}\" restored successfully for global \"${slug}\"!\\nRestored global:\\n\\`\\`\\`json\\n${JSON.stringify(restoredGlobal)}\\n\\`\\`\\``,\n },\n ],\n doc: restoredGlobal,\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n logger.error(`Error restoring version ${id} for global ${slug}: ${errorMessage}`)\n return {\n content: [\n {\n type: 'text',\n text: `❌ **Error restoring version \"${id}\" for global \"${slug}\":** ${errorMessage}`,\n },\n ],\n isError: true,\n }\n }\n})\n"],"names":["restoreGlobalVersionInputSchema","defaultAccess","defineGlobalTool","getLogger","DEFAULT_DESCRIPTION","restoreGlobalVersionTool","access","args","Boolean","permissions","globals","slug","update","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","handler","authorizedMCP","req","payload","logger","id","depth","fallbackLocale","locale","populate","select","info","result","restoreGlobalVersion","String","overrideAccess","undefined","resultObject","restoredGlobal","version","content","type","text","JSON","stringify","doc","error","errorMessage","Error","message","isError"],"mappings":"AAAA,SAASA,+BAA+B,QAAQ,UAAS;AAEzD,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,SAAS,QAAQ,8BAA6B;AAEvD,MAAMC,sBACJ;AAEF,OAAO,MAAMC,2BAA2BH,iBAAiB;IACvDI,QAAQ,CAACC,OAASN,cAAcM,SAASC,QAAQD,KAAKE,WAAW,EAAEC,SAAS,CAACH,KAAKI,IAAI,CAAC,EAAEC;IACzFC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAaf;IACbgB,OAAOpB;AACT,GAAGqB,OAAO,CAAC,OAAO,EAAEV,IAAI,EAAEW,aAAa,EAAEF,KAAK,EAAEG,GAAG,EAAE;IACnD,MAAMC,UAAUD,IAAIC,OAAO;IAC3B,MAAMC,SAAStB,UAAU;QAAEqB;IAAQ;IACnC,MAAM,EAAEE,EAAE,EAAEC,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGX;IAEhEK,OAAOO,IAAI,CAAC,CAAC,8BAA8B,EAAErB,KAAK,UAAU,EAAEe,IAAI;IAElE,IAAI;QACF,MAAMO,SAAS,MAAMT,QAAQU,oBAAoB,CAAC;YAChDR,IAAIS,OAAOT;YACXf;YACAgB;YACAS,gBAAgBd,cAAcc,cAAc;YAC5Cb;YACA,GAAIK,mBAAmBS,YAAY;gBAAET;YAAe,IAAI,CAAC,CAAC;YAC1D,GAAIC,SAAS;gBAAEA;YAAO,IAAI,CAAC,CAAC;YAC5B,GAAIC,WAAW;gBAAEA;YAAS,IAAI,CAAC,CAAC;YAChC,GAAIC,SAAS;gBAAEA;YAAO,IAAI,CAAC,CAAC;QAC9B;QACA,MAAMO,eAAeL;QACrB,MAAMM,iBACJD,aAAaE,OAAO,IAAI,OAAOF,aAAaE,OAAO,KAAK,WACnDF,aAAaE,OAAO,GACrBF;QAEN,OAAO;YACLG,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,SAAS,EAAEjB,GAAG,oCAAoC,EAAEf,KAAK,kCAAkC,EAAEiC,KAAKC,SAAS,CAACN,gBAAgB,QAAQ,CAAC;gBAC9I;aACD;YACDO,KAAKP;QACP;IACF,EAAE,OAAOQ,OAAO;QACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;QAC9DzB,OAAOsB,KAAK,CAAC,CAAC,wBAAwB,EAAErB,GAAG,YAAY,EAAEf,KAAK,EAAE,EAAEqC,cAAc;QAChF,OAAO;YACLP,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,6BAA6B,EAAEjB,GAAG,cAAc,EAAEf,KAAK,KAAK,EAAEqC,cAAc;gBACrF;aACD;YACDG,SAAS;QACX;IACF;AACF,GAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/updateTool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/updateTool.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB,wCA4E3B,CAAA"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getGlobalVirtualFieldNames, stripVirtualFields, transformPointDataToPayload, updateGlobalInputSchema, validateGlobalData } from 'payload';
|
|
2
2
|
import { defaultAccess } from '../../../defaultAccess.js';
|
|
3
3
|
import { defineGlobalTool } from '../../../defineTool.js';
|
|
4
4
|
import { getLogger } from '../../../utils/getLogger.js';
|
|
5
|
-
import {
|
|
6
|
-
import { localAPIDefaults } from '../../../utils/localAPIDefaults.js';
|
|
7
|
-
import { transformPointDataToPayload } from '../../../utils/transformPointDataToPayload.js';
|
|
8
|
-
import { validateGlobalData } from '../validateEntityData.js';
|
|
5
|
+
import { formatEntityError } from '../formatEntityError.js';
|
|
9
6
|
const DEFAULT_DESCRIPTION = 'Update any Payload global by passing the global slug and data.';
|
|
10
7
|
export const updateGlobalTool = defineGlobalTool({
|
|
11
|
-
access: (args)=>defaultAccess(args) && Boolean(args.permissions?.globals?.[args.
|
|
8
|
+
access: (args)=>defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.update),
|
|
12
9
|
annotations: {
|
|
13
10
|
destructiveHint: true,
|
|
14
11
|
idempotentHint: false,
|
|
@@ -17,44 +14,39 @@ export const updateGlobalTool = defineGlobalTool({
|
|
|
17
14
|
title: 'Update Global'
|
|
18
15
|
},
|
|
19
16
|
description: DEFAULT_DESCRIPTION,
|
|
20
|
-
input:
|
|
21
|
-
|
|
22
|
-
depth: z.number().describe('Optional: Depth of relationships to populate').optional().default(0),
|
|
23
|
-
draft: z.boolean().describe('Optional: Whether to save as draft (default: false)').optional().default(false),
|
|
24
|
-
fallbackLocale: z.string().describe('Optional: fallback locale code to use when requested locale is not available').optional(),
|
|
25
|
-
locale: z.string().describe('Optional: locale code to update data in (e.g., "en", "es"). Use "all" to update all locales for localized fields').optional(),
|
|
26
|
-
select: z.record(z.string(), z.unknown()).describe('Optional: define exactly which fields you\'d like to return in the response, e.g., {"siteName": true}').optional()
|
|
27
|
-
})
|
|
28
|
-
}).handler(async ({ authorizedMCP, globalSlug, input, req })=>{
|
|
17
|
+
input: updateGlobalInputSchema
|
|
18
|
+
}).handler(async ({ slug, authorizedMCP, input, req })=>{
|
|
29
19
|
const payload = req.payload;
|
|
30
20
|
const logger = getLogger({
|
|
31
21
|
payload
|
|
32
22
|
});
|
|
33
|
-
const { data, depth, draft, fallbackLocale, locale, select } = input;
|
|
34
|
-
logger.info(`Updating global: ${
|
|
23
|
+
const { data, depth, draft, fallbackLocale, locale, overrideLock, populate, publishAllLocales, select, unpublishAllLocales } = input;
|
|
24
|
+
logger.info(`Updating global: ${slug}, draft: ${draft}${locale ? `, locale: ${locale}` : ''}`);
|
|
35
25
|
try {
|
|
36
|
-
const virtualFieldNames = getGlobalVirtualFieldNames(payload.config,
|
|
26
|
+
const virtualFieldNames = getGlobalVirtualFieldNames(payload.config, slug);
|
|
37
27
|
const inputData = stripVirtualFields(data, virtualFieldNames);
|
|
38
|
-
|
|
28
|
+
validateGlobalData({
|
|
29
|
+
slug,
|
|
39
30
|
data: inputData,
|
|
40
|
-
globalSlug,
|
|
41
31
|
req
|
|
42
32
|
});
|
|
43
|
-
if (validationError) {
|
|
44
|
-
return validationError;
|
|
45
|
-
}
|
|
46
33
|
const parsedData = transformPointDataToPayload(inputData);
|
|
47
34
|
const updateOptions = {
|
|
48
|
-
slug
|
|
35
|
+
slug,
|
|
49
36
|
data: parsedData,
|
|
50
37
|
depth,
|
|
51
38
|
draft,
|
|
52
|
-
|
|
39
|
+
overrideAccess: authorizedMCP.overrideAccess,
|
|
40
|
+
overrideLock,
|
|
41
|
+
populate,
|
|
42
|
+
publishAllLocales,
|
|
43
|
+
req,
|
|
44
|
+
unpublishAllLocales
|
|
53
45
|
};
|
|
54
46
|
if (locale) {
|
|
55
47
|
updateOptions.locale = locale;
|
|
56
48
|
}
|
|
57
|
-
if (fallbackLocale) {
|
|
49
|
+
if (fallbackLocale !== undefined) {
|
|
58
50
|
updateOptions.fallbackLocale = fallbackLocale;
|
|
59
51
|
}
|
|
60
52
|
if (select) {
|
|
@@ -65,22 +57,21 @@ export const updateGlobalTool = defineGlobalTool({
|
|
|
65
57
|
content: [
|
|
66
58
|
{
|
|
67
59
|
type: 'text',
|
|
68
|
-
text: `Global "${
|
|
60
|
+
text: `Global "${slug}" updated successfully!\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``
|
|
69
61
|
}
|
|
70
62
|
],
|
|
71
63
|
doc: result
|
|
72
64
|
};
|
|
73
65
|
} catch (error) {
|
|
74
|
-
const
|
|
75
|
-
logger.error(`Error updating global ${
|
|
76
|
-
return {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
66
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
67
|
+
logger.error(`Error updating global ${slug}: ${message}`);
|
|
68
|
+
return formatEntityError({
|
|
69
|
+
slug,
|
|
70
|
+
action: 'updating',
|
|
71
|
+
entity: 'global',
|
|
72
|
+
error,
|
|
73
|
+
req
|
|
74
|
+
});
|
|
84
75
|
}
|
|
85
76
|
});
|
|
86
77
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/mcp/builtin/globals/updateTool.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/mcp/builtin/globals/updateTool.ts"],"sourcesContent":["import {\n getGlobalVirtualFieldNames,\n stripVirtualFields,\n transformPointDataToPayload,\n updateGlobalInputSchema,\n validateGlobalData,\n} from 'payload'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineGlobalTool } from '../../../defineTool.js'\nimport { getLogger } from '../../../utils/getLogger.js'\nimport { formatEntityError } from '../formatEntityError.js'\n\nconst DEFAULT_DESCRIPTION = 'Update any Payload global by passing the global slug and data.'\n\nexport const updateGlobalTool = defineGlobalTool({\n access: (args) => defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.update),\n annotations: {\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n readOnlyHint: false,\n title: 'Update Global',\n },\n description: DEFAULT_DESCRIPTION,\n input: updateGlobalInputSchema,\n}).handler(async ({ slug, authorizedMCP, input, req }) => {\n const payload = req.payload\n const logger = getLogger({ payload })\n\n const {\n data,\n depth,\n draft,\n fallbackLocale,\n locale,\n overrideLock,\n populate,\n publishAllLocales,\n select,\n unpublishAllLocales,\n } = input\n\n logger.info(`Updating global: ${slug}, draft: ${draft}${locale ? `, locale: ${locale}` : ''}`)\n\n try {\n const virtualFieldNames = getGlobalVirtualFieldNames(payload.config, slug)\n const inputData = stripVirtualFields(data, virtualFieldNames)\n validateGlobalData({ slug, data: inputData, req })\n\n const parsedData = transformPointDataToPayload(inputData)\n\n const updateOptions: Parameters<typeof payload.updateGlobal>[0] = {\n slug,\n data: parsedData,\n depth,\n draft,\n overrideAccess: authorizedMCP.overrideAccess,\n overrideLock,\n populate,\n publishAllLocales,\n req,\n unpublishAllLocales,\n }\n\n if (locale) {\n updateOptions.locale = locale\n }\n if (fallbackLocale !== undefined) {\n updateOptions.fallbackLocale = fallbackLocale\n }\n if (select) {\n updateOptions.select = select\n }\n\n const result = await payload.updateGlobal(updateOptions)\n\n return {\n content: [\n {\n type: 'text',\n text: `Global \"${slug}\" updated successfully!\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n doc: result as Record<string, unknown>,\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error'\n logger.error(`Error updating global ${slug}: ${message}`)\n return formatEntityError({ slug, action: 'updating', entity: 'global', error, req })\n }\n})\n"],"names":["getGlobalVirtualFieldNames","stripVirtualFields","transformPointDataToPayload","updateGlobalInputSchema","validateGlobalData","defaultAccess","defineGlobalTool","getLogger","formatEntityError","DEFAULT_DESCRIPTION","updateGlobalTool","access","args","Boolean","permissions","globals","slug","update","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","handler","authorizedMCP","req","payload","logger","data","depth","draft","fallbackLocale","locale","overrideLock","populate","publishAllLocales","select","unpublishAllLocales","info","virtualFieldNames","config","inputData","parsedData","updateOptions","overrideAccess","undefined","result","updateGlobal","content","type","text","JSON","stringify","doc","error","message","Error","action","entity"],"mappings":"AAAA,SACEA,0BAA0B,EAC1BC,kBAAkB,EAClBC,2BAA2B,EAC3BC,uBAAuB,EACvBC,kBAAkB,QACb,UAAS;AAEhB,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,gBAAgB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AAc,GAAGA;QACjC;QACA,IAAIK,QAAQ;YACVO,cAAcP,MAAM,GAAGA;QACzB;QAEA,MAAMU,SAAS,MAAMpB,QAAQqB,YAAY,CAACJ;QAE1C,OAAO;YACLK,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,QAAQ,EAAErC,KAAK,qCAAqC,EAAEsC,KAAKC,SAAS,CAACN,QAAQ,QAAQ,CAAC;gBAC/F;aACD;YACDO,KAAKP;QACP;IACF,EAAE,OAAOQ,OAAO;QACd,MAAMC,UAAUD,iBAAiBE,QAAQF,MAAMC,OAAO,GAAG;QACzD5B,OAAO2B,KAAK,CAAC,CAAC,sBAAsB,EAAEzC,KAAK,EAAE,EAAE0C,SAAS;QACxD,OAAOlD,kBAAkB;YAAEQ;YAAM4C,QAAQ;YAAYC,QAAQ;YAAUJ;YAAO7B;QAAI;IACpF;AACF,GAAE"}
|
|
@@ -2,6 +2,7 @@ import type { CollectionTool, GlobalTool, Tool } from '../types.js';
|
|
|
2
2
|
type CollectionBuiltin = {
|
|
3
3
|
mcpName: string;
|
|
4
4
|
requiresDuplicateEnabled?: boolean;
|
|
5
|
+
requiresUpload?: boolean;
|
|
5
6
|
requiresVersions?: boolean;
|
|
6
7
|
tool: CollectionTool;
|
|
7
8
|
};
|
|
@@ -66,6 +67,11 @@ export declare const COLLECTION_BUILTINS: {
|
|
|
66
67
|
mcpName: string;
|
|
67
68
|
tool: CollectionTool;
|
|
68
69
|
};
|
|
70
|
+
getUploadInstructions: {
|
|
71
|
+
mcpName: string;
|
|
72
|
+
requiresUpload: true;
|
|
73
|
+
tool: CollectionTool;
|
|
74
|
+
};
|
|
69
75
|
restoreVersion: {
|
|
70
76
|
mcpName: string;
|
|
71
77
|
requiresVersions: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtinTools.d.ts","sourceRoot":"","sources":["../../src/mcp/builtinTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,U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;;;;QAMzC,OAAO;QAAkB,IAAI;;CACA,CAAA;AAEzC,MAAM,MAAM,wBAAwB,GAAG,MAAM,OAAO,mBAAmB,CAAA;AAEvE,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,wBAAwB,CAAA;AAE7E,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,eAAe,CAAA;AAE/D,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,aAAa,CAAA;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAoC,KAAK,CACxE,CAAC,sBAAsB,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,sBAAsB,CAAC,CAAC,CACzE,CAAA;AAED,eAAO,MAAM,0BAA0B,EAA0C,KAAK,CACpF,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,CAC9C,CAAA;AAED,eAAO,MAAM,+BAA+B,EAA+C,KAAK,CAC9F,CAAC,yBAAyB,EAAE,CAAC,OAAO,wBAAwB,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAC1F,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAsC,KAAK,CAC5E,CAAC,oBAAoB,EAAE,aAAa,CAAC,CACtC,CAAA"}
|
package/dist/mcp/builtinTools.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { authCollectionTool, forgotPasswordCollectionTool, loginCollectionTool, resetPasswordCollectionTool, unlockCollectionTool, verifyCollectionTool } from './builtin/collections/authTools.js';
|
|
2
2
|
import { countDocumentsTool } from './builtin/collections/countTool.js';
|
|
3
3
|
import { countVersionsTool } from './builtin/collections/countVersionsTool.js';
|
|
4
|
-
import {
|
|
4
|
+
import { createDocumentsTool } from './builtin/collections/createTool.js';
|
|
5
5
|
import { deleteDocumentsTool } from './builtin/collections/deleteTool.js';
|
|
6
6
|
import { duplicateDocumentTool } from './builtin/collections/duplicateTool.js';
|
|
7
7
|
import { findDistinctTool } from './builtin/collections/findDistinctTool.js';
|
|
@@ -11,6 +11,7 @@ import { findVersionsTool } from './builtin/collections/findVersionsTool.js';
|
|
|
11
11
|
import { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js';
|
|
12
12
|
import { restoreVersionTool } from './builtin/collections/restoreVersionTool.js';
|
|
13
13
|
import { updateDocumentTool } from './builtin/collections/updateTool.js';
|
|
14
|
+
import { getUploadInstructionsTool } from './builtin/collections/uploadInstructionsTool.js';
|
|
14
15
|
import { getConfigInfoTool } from './builtin/getConfigInfoTool.js';
|
|
15
16
|
import { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js';
|
|
16
17
|
import { findGlobalTool } from './builtin/globals/findTool.js';
|
|
@@ -40,8 +41,8 @@ export const TOOL_BUILTINS = {
|
|
|
40
41
|
tool: countVersionsTool
|
|
41
42
|
},
|
|
42
43
|
create: {
|
|
43
|
-
mcpName: '
|
|
44
|
-
tool:
|
|
44
|
+
mcpName: 'createDocuments',
|
|
45
|
+
tool: createDocumentsTool
|
|
45
46
|
},
|
|
46
47
|
delete: {
|
|
47
48
|
mcpName: 'deleteDocuments',
|
|
@@ -74,6 +75,11 @@ export const TOOL_BUILTINS = {
|
|
|
74
75
|
mcpName: 'getCollectionSchema',
|
|
75
76
|
tool: getCollectionSchemaTool
|
|
76
77
|
},
|
|
78
|
+
getUploadInstructions: {
|
|
79
|
+
mcpName: 'getUploadInstructions',
|
|
80
|
+
requiresUpload: true,
|
|
81
|
+
tool: getUploadInstructionsTool
|
|
82
|
+
},
|
|
77
83
|
restoreVersion: {
|
|
78
84
|
mcpName: 'restoreVersion',
|
|
79
85
|
requiresVersions: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mcp/builtinTools.ts"],"sourcesContent":["import type { CollectionTool, GlobalTool, Tool } from '../types.js'\n\nimport {\n authCollectionTool,\n forgotPasswordCollectionTool,\n loginCollectionTool,\n resetPasswordCollectionTool,\n unlockCollectionTool,\n verifyCollectionTool,\n} from './builtin/collections/authTools.js'\nimport { countDocumentsTool } from './builtin/collections/countTool.js'\nimport { countVersionsTool } from './builtin/collections/countVersionsTool.js'\nimport { createDocumentTool } from './builtin/collections/createTool.js'\nimport { deleteDocumentsTool } from './builtin/collections/deleteTool.js'\nimport { duplicateDocumentTool } from './builtin/collections/duplicateTool.js'\nimport { findDistinctTool } from './builtin/collections/findDistinctTool.js'\nimport { findDocumentsTool } from './builtin/collections/findTool.js'\nimport { findVersionByIDTool } from './builtin/collections/findVersionByIDTool.js'\nimport { findVersionsTool } from './builtin/collections/findVersionsTool.js'\nimport { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js'\nimport { restoreVersionTool } from './builtin/collections/restoreVersionTool.js'\nimport { updateDocumentTool } from './builtin/collections/updateTool.js'\nimport { getConfigInfoTool } from './builtin/getConfigInfoTool.js'\nimport { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js'\nimport { findGlobalTool } from './builtin/globals/findTool.js'\nimport { findGlobalVersionByIDTool } from './builtin/globals/findVersionByIDTool.js'\nimport { findGlobalVersionsTool } from './builtin/globals/findVersionsTool.js'\nimport { getGlobalSchemaTool } from './builtin/globals/getGlobalSchemaTool.js'\nimport { restoreGlobalVersionTool } from './builtin/globals/restoreVersionTool.js'\nimport { updateGlobalTool } from './builtin/globals/updateTool.js'\n\ntype CollectionBuiltin = {\n mcpName: string\n requiresDuplicateEnabled?: boolean\n requiresVersions?: boolean\n tool: CollectionTool\n}\n\ntype GlobalBuiltin = {\n mcpName: string\n requiresVersions?: boolean\n tool: GlobalTool\n}\n\nexport const TOOL_BUILTINS = {\n getConfigInfo: { mcpName: 'getConfigInfo', tool: getConfigInfoTool },\n} satisfies Record<string, { mcpName: string; tool: Tool }>\n\n/**\n * The static built-in collection CRUD tools. Keys here are the source of truth\n * for `MCPCollectionBuiltinName` — adding/removing an entry updates the type\n * automatically.\n */\nexport const COLLECTION_BUILTINS = {\n count: { mcpName: 'countDocuments', tool: countDocumentsTool },\n countVersions: { mcpName: 'countVersions', requiresVersions: true, tool: countVersionsTool },\n create: { mcpName: 'createDocument', tool: createDocumentTool },\n delete: { mcpName: 'deleteDocuments', tool: deleteDocumentsTool },\n duplicate: {\n mcpName: 'duplicateDocument',\n requiresDuplicateEnabled: true,\n tool: duplicateDocumentTool,\n },\n find: { mcpName: 'findDocuments', tool: findDocumentsTool },\n findDistinct: { mcpName: 'findDistinct', tool: findDistinctTool },\n findVersionByID: {\n mcpName: 'findVersionByID',\n requiresVersions: true,\n tool: findVersionByIDTool,\n },\n findVersions: { mcpName: 'findVersions', requiresVersions: true, tool: findVersionsTool },\n getCollectionSchema: { mcpName: 'getCollectionSchema', tool: getCollectionSchemaTool },\n restoreVersion: { mcpName: 'restoreVersion', requiresVersions: true, tool: restoreVersionTool },\n update: { mcpName: 'updateDocument', tool: updateDocumentTool },\n} satisfies Record<string, CollectionBuiltin>\n\n/**\n * The static auth tools surfaced under auth-enabled collections. Keys are the\n * source of truth for `MCPCollectionAuthToolName`.\n */\nexport const COLLECTION_AUTH_BUILTINS = {\n auth: { mcpName: 'auth', tool: authCollectionTool },\n forgotPassword: {\n mcpName: 'forgotPassword',\n tool: forgotPasswordCollectionTool,\n },\n login: { mcpName: 'login', tool: loginCollectionTool },\n resetPassword: {\n mcpName: 'resetPassword',\n tool: resetPasswordCollectionTool,\n },\n unlock: { mcpName: 'unlock', tool: unlockCollectionTool },\n verify: { mcpName: 'verify', tool: verifyCollectionTool },\n} satisfies Record<string, { mcpName: string; tool: CollectionTool }>\n\n/**\n * The static built-in global tools. Keys are the source of truth for\n * `MCPGlobalBuiltinName`.\n */\nexport const GLOBAL_BUILTINS = {\n countGlobalVersions: {\n mcpName: 'countGlobalVersions',\n requiresVersions: true,\n tool: countGlobalVersionsTool,\n },\n find: { mcpName: 'findGlobal', tool: findGlobalTool },\n findGlobalVersionByID: {\n mcpName: 'findGlobalVersionByID',\n requiresVersions: true,\n tool: findGlobalVersionByIDTool,\n },\n findGlobalVersions: {\n mcpName: 'findGlobalVersions',\n requiresVersions: true,\n tool: findGlobalVersionsTool,\n },\n getGlobalSchema: { mcpName: 'getGlobalSchema', tool: getGlobalSchemaTool },\n restoreGlobalVersion: {\n mcpName: 'restoreGlobalVersion',\n requiresVersions: true,\n tool: restoreGlobalVersionTool,\n },\n update: { mcpName: 'updateGlobal', tool: updateGlobalTool },\n} satisfies Record<string, GlobalBuiltin>\n\nexport type MCPCollectionBuiltinName = keyof typeof COLLECTION_BUILTINS\n\nexport type MCPCollectionAuthToolName = keyof typeof COLLECTION_AUTH_BUILTINS\n\nexport type MCPGlobalBuiltinName = keyof typeof GLOBAL_BUILTINS\n\nexport type MCPTopLevelBuiltinName = keyof typeof TOOL_BUILTINS\n\n/**\n * Pre-typed `Object.entries` for each registry. The cast from `string` to the\n * literal key union lives here once so consumers can iterate without their own\n * cast — TypeScript's `Object.entries` always widens keys to `string`, which\n * defeats the narrow type lookups on `MCPCollectionToolsMap`.\n */\nexport const TOOL_BUILTIN_ENTRIES = Object.entries(TOOL_BUILTINS) as Array<\n [MCPTopLevelBuiltinName, (typeof TOOL_BUILTINS)[MCPTopLevelBuiltinName]]\n>\n\nexport const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS) as Array<\n [MCPCollectionBuiltinName, CollectionBuiltin]\n>\n\nexport const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS) as Array<\n [MCPCollectionAuthToolName, (typeof COLLECTION_AUTH_BUILTINS)[MCPCollectionAuthToolName]]\n>\n\nexport const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS) as Array<\n [MCPGlobalBuiltinName, GlobalBuiltin]\n>\n"],"names":["authCollectionTool","forgotPasswordCollectionTool","loginCollectionTool","resetPasswordCollectionTool","unlockCollectionTool","verifyCollectionTool","countDocumentsTool","countVersionsTool","createDocumentTool","deleteDocumentsTool","duplicateDocumentTool","findDistinctTool","findDocumentsTool","findVersionByIDTool","findVersionsTool","getCollectionSchemaTool","restoreVersionTool","updateDocumentTool","getConfigInfoTool","countGlobalVersionsTool","findGlobalTool","findGlobalVersionByIDTool","findGlobalVersionsTool","getGlobalSchemaTool","restoreGlobalVersionTool","updateGlobalTool","TOOL_BUILTINS","getConfigInfo","mcpName","tool","COLLECTION_BUILTINS","count","countVersions","requiresVersions","create","delete","duplicate","requiresDuplicateEnabled","find","findDistinct","findVersionByID","findVersions","getCollectionSchema","restoreVersion","update","COLLECTION_AUTH_BUILTINS","auth","forgotPassword","login","resetPassword","unlock","verify","GLOBAL_BUILTINS","countGlobalVersions","findGlobalVersionByID","findGlobalVersions","getGlobalSchema","restoreGlobalVersion","TOOL_BUILTIN_ENTRIES","Object","entries","COLLECTION_BUILTIN_ENTRIES","COLLECTION_AUTH_BUILTIN_ENTRIES","GLOBAL_BUILTIN_ENTRIES"],"mappings":"AAEA,SACEA,kBAAkB,EAClBC,4BAA4B,EAC5BC,mBAAmB,EACnBC,2BAA2B,EAC3BC,oBAAoB,EACpBC,oBAAoB,QACf,qCAAoC;AAC3C,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,iBAAiB,QAAQ,6CAA4C;AAC9E,SAASC,kBAAkB,QAAQ,sCAAqC;AACxE,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,qBAAqB,QAAQ,yCAAwC;AAC9E,SAASC,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,mBAAmB,QAAQ,+CAA8C;AAClF,SAASC,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,uBAAuB,QAAQ,mDAAkD;AAC1F,SAASC,kBAAkB,QAAQ,8CAA6C;AAChF,SAASC,kBAAkB,QAAQ,sCAAqC;AACxE,SAASC,iBAAiB,QAAQ,iCAAgC;AAClE,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,sBAAsB,QAAQ,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B,SAAS;QAAUC,MAAMzB;IAAqB;IACxD+C,QAAQ;QAAEvB,SAAS;QAAUC,MAAMxB;IAAqB;AAC1D,EAAqE;AAErE;;;CAGC,GACD,OAAO,MAAM+C,kBAAkB;IAC7BC,qBAAqB;QACnBzB,SAAS;QACTK,kBAAkB;QAClBJ,MAAMV;IACR;IACAmB,MAAM;QAAEV,SAAS;QAAcC,MAAMT;IAAe;IACpDkC,uBAAuB;QACrB1B,SAAS;QACTK,kBAAkB;QAClBJ,MAAMR;IACR;IACAkC,oBAAoB;QAClB3B,SAAS;QACTK,kBAAkB;QAClBJ,MAAMP;IACR;IACAkC,iBAAiB;QAAE5B,SAAS;QAAmBC,MAAMN;IAAoB;IACzEkC,sBAAsB;QACpB7B,SAAS;QACTK,kBAAkB;QAClBJ,MAAML;IACR;IACAoB,QAAQ;QAAEhB,SAAS;QAAgBC,MAAMJ;IAAiB;AAC5D,EAAyC;AAUzC;;;;;CAKC,GACD,OAAO,MAAMiC,uBAAuBC,OAAOC,OAAO,CAAClC,eAElD;AAED,OAAO,MAAMmC,6BAA6BF,OAAOC,OAAO,CAAC9B,qBAExD;AAED,OAAO,MAAMgC,kCAAkCH,OAAOC,OAAO,CAACf,0BAE7D;AAED,OAAO,MAAMkB,yBAAyBJ,OAAOC,OAAO,CAACR,iBAEpD"}
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/builtinTools.ts"],"sourcesContent":["import type { CollectionTool, GlobalTool, Tool } from '../types.js'\n\nimport {\n authCollectionTool,\n forgotPasswordCollectionTool,\n loginCollectionTool,\n resetPasswordCollectionTool,\n unlockCollectionTool,\n verifyCollectionTool,\n} from './builtin/collections/authTools.js'\nimport { countDocumentsTool } from './builtin/collections/countTool.js'\nimport { countVersionsTool } from './builtin/collections/countVersionsTool.js'\nimport { createDocumentsTool } from './builtin/collections/createTool.js'\nimport { deleteDocumentsTool } from './builtin/collections/deleteTool.js'\nimport { duplicateDocumentTool } from './builtin/collections/duplicateTool.js'\nimport { findDistinctTool } from './builtin/collections/findDistinctTool.js'\nimport { findDocumentsTool } from './builtin/collections/findTool.js'\nimport { findVersionByIDTool } from './builtin/collections/findVersionByIDTool.js'\nimport { findVersionsTool } from './builtin/collections/findVersionsTool.js'\nimport { getCollectionSchemaTool } from './builtin/collections/getCollectionSchemaTool.js'\nimport { restoreVersionTool } from './builtin/collections/restoreVersionTool.js'\nimport { updateDocumentTool } from './builtin/collections/updateTool.js'\nimport { getUploadInstructionsTool } from './builtin/collections/uploadInstructionsTool.js'\nimport { getConfigInfoTool } from './builtin/getConfigInfoTool.js'\nimport { countGlobalVersionsTool } from './builtin/globals/countVersionsTool.js'\nimport { findGlobalTool } from './builtin/globals/findTool.js'\nimport { findGlobalVersionByIDTool } from './builtin/globals/findVersionByIDTool.js'\nimport { findGlobalVersionsTool } from './builtin/globals/findVersionsTool.js'\nimport { getGlobalSchemaTool } from './builtin/globals/getGlobalSchemaTool.js'\nimport { restoreGlobalVersionTool } from './builtin/globals/restoreVersionTool.js'\nimport { updateGlobalTool } from './builtin/globals/updateTool.js'\n\ntype CollectionBuiltin = {\n mcpName: string\n requiresDuplicateEnabled?: boolean\n requiresUpload?: boolean\n requiresVersions?: boolean\n tool: CollectionTool\n}\n\ntype GlobalBuiltin = {\n mcpName: string\n requiresVersions?: boolean\n tool: GlobalTool\n}\n\nexport const TOOL_BUILTINS = {\n getConfigInfo: { mcpName: 'getConfigInfo', tool: getConfigInfoTool },\n} satisfies Record<string, { mcpName: string; tool: Tool }>\n\n/**\n * The static built-in collection CRUD tools. Keys here are the source of truth\n * for `MCPCollectionBuiltinName` — adding/removing an entry updates the type\n * automatically.\n */\nexport const COLLECTION_BUILTINS = {\n count: { mcpName: 'countDocuments', tool: countDocumentsTool },\n countVersions: { mcpName: 'countVersions', requiresVersions: true, tool: countVersionsTool },\n create: { mcpName: 'createDocuments', tool: createDocumentsTool },\n delete: { mcpName: 'deleteDocuments', tool: deleteDocumentsTool },\n duplicate: {\n mcpName: 'duplicateDocument',\n requiresDuplicateEnabled: true,\n tool: duplicateDocumentTool,\n },\n find: { mcpName: 'findDocuments', tool: findDocumentsTool },\n findDistinct: { mcpName: 'findDistinct', tool: findDistinctTool },\n findVersionByID: {\n mcpName: 'findVersionByID',\n requiresVersions: true,\n tool: findVersionByIDTool,\n },\n findVersions: { mcpName: 'findVersions', requiresVersions: true, tool: findVersionsTool },\n getCollectionSchema: { mcpName: 'getCollectionSchema', tool: getCollectionSchemaTool },\n getUploadInstructions: {\n mcpName: 'getUploadInstructions',\n requiresUpload: true,\n tool: getUploadInstructionsTool,\n },\n restoreVersion: { mcpName: 'restoreVersion', requiresVersions: true, tool: restoreVersionTool },\n update: { mcpName: 'updateDocument', tool: updateDocumentTool },\n} satisfies Record<string, CollectionBuiltin>\n\n/**\n * The static auth tools surfaced under auth-enabled collections. Keys are the\n * source of truth for `MCPCollectionAuthToolName`.\n */\nexport const COLLECTION_AUTH_BUILTINS = {\n auth: { mcpName: 'auth', tool: authCollectionTool },\n forgotPassword: {\n mcpName: 'forgotPassword',\n tool: forgotPasswordCollectionTool,\n },\n login: { mcpName: 'login', tool: loginCollectionTool },\n resetPassword: {\n mcpName: 'resetPassword',\n tool: resetPasswordCollectionTool,\n },\n unlock: { mcpName: 'unlock', tool: unlockCollectionTool },\n verify: { mcpName: 'verify', tool: verifyCollectionTool },\n} satisfies Record<string, { mcpName: string; tool: CollectionTool }>\n\n/**\n * The static built-in global tools. Keys are the source of truth for\n * `MCPGlobalBuiltinName`.\n */\nexport const GLOBAL_BUILTINS = {\n countGlobalVersions: {\n mcpName: 'countGlobalVersions',\n requiresVersions: true,\n tool: countGlobalVersionsTool,\n },\n find: { mcpName: 'findGlobal', tool: findGlobalTool },\n findGlobalVersionByID: {\n mcpName: 'findGlobalVersionByID',\n requiresVersions: true,\n tool: findGlobalVersionByIDTool,\n },\n findGlobalVersions: {\n mcpName: 'findGlobalVersions',\n requiresVersions: true,\n tool: findGlobalVersionsTool,\n },\n getGlobalSchema: { mcpName: 'getGlobalSchema', tool: getGlobalSchemaTool },\n restoreGlobalVersion: {\n mcpName: 'restoreGlobalVersion',\n requiresVersions: true,\n tool: restoreGlobalVersionTool,\n },\n update: { mcpName: 'updateGlobal', tool: updateGlobalTool },\n} satisfies Record<string, GlobalBuiltin>\n\nexport type MCPCollectionBuiltinName = keyof typeof COLLECTION_BUILTINS\n\nexport type MCPCollectionAuthToolName = keyof typeof COLLECTION_AUTH_BUILTINS\n\nexport type MCPGlobalBuiltinName = keyof typeof GLOBAL_BUILTINS\n\nexport type MCPTopLevelBuiltinName = keyof typeof TOOL_BUILTINS\n\n/**\n * Pre-typed `Object.entries` for each registry. The cast from `string` to the\n * literal key union lives here once so consumers can iterate without their own\n * cast — TypeScript's `Object.entries` always widens keys to `string`, which\n * defeats the narrow type lookups on `MCPCollectionToolsMap`.\n */\nexport const TOOL_BUILTIN_ENTRIES = Object.entries(TOOL_BUILTINS) as Array<\n [MCPTopLevelBuiltinName, (typeof TOOL_BUILTINS)[MCPTopLevelBuiltinName]]\n>\n\nexport const COLLECTION_BUILTIN_ENTRIES = Object.entries(COLLECTION_BUILTINS) as Array<\n [MCPCollectionBuiltinName, CollectionBuiltin]\n>\n\nexport const COLLECTION_AUTH_BUILTIN_ENTRIES = Object.entries(COLLECTION_AUTH_BUILTINS) as Array<\n [MCPCollectionAuthToolName, (typeof COLLECTION_AUTH_BUILTINS)[MCPCollectionAuthToolName]]\n>\n\nexport const GLOBAL_BUILTIN_ENTRIES = Object.entries(GLOBAL_BUILTINS) as Array<\n [MCPGlobalBuiltinName, GlobalBuiltin]\n>\n"],"names":["authCollectionTool","forgotPasswordCollectionTool","loginCollectionTool","resetPasswordCollectionTool","unlockCollectionTool","verifyCollectionTool","countDocumentsTool","countVersionsTool","createDocumentsTool","deleteDocumentsTool","duplicateDocumentTool","findDistinctTool","findDocumentsTool","findVersionByIDTool","findVersionsTool","getCollectionSchemaTool","restoreVersionTool","updateDocumentTool","getUploadInstructionsTool","getConfigInfoTool","countGlobalVersionsTool","findGlobalTool","findGlobalVersionByIDTool","findGlobalVersionsTool","getGlobalSchemaTool","restoreGlobalVersionTool","updateGlobalTool","TOOL_BUILTINS","getConfigInfo","mcpName","tool","COLLECTION_BUILTINS","count","countVersions","requiresVersions","create","delete","duplicate","requiresDuplicateEnabled","find","findDistinct","findVersionByID","findVersions","getCollectionSchema","getUploadInstructions","requiresUpload","restoreVersion","update","COLLECTION_AUTH_BUILTINS","auth","forgotPassword","login","resetPassword","unlock","verify","GLOBAL_BUILTINS","countGlobalVersions","findGlobalVersionByID","findGlobalVersions","getGlobalSchema","restoreGlobalVersion","TOOL_BUILTIN_ENTRIES","Object","entries","COLLECTION_BUILTIN_ENTRIES","COLLECTION_AUTH_BUILTIN_ENTRIES","GLOBAL_BUILTIN_ENTRIES"],"mappings":"AAEA,SACEA,kBAAkB,EAClBC,4BAA4B,EAC5BC,mBAAmB,EACnBC,2BAA2B,EAC3BC,oBAAoB,EACpBC,oBAAoB,QACf,qCAAoC;AAC3C,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,iBAAiB,QAAQ,6CAA4C;AAC9E,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,qBAAqB,QAAQ,yCAAwC;AAC9E,SAASC,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,mBAAmB,QAAQ,+CAA8C;AAClF,SAASC,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,uBAAuB,QAAQ,mDAAkD;AAC1F,SAASC,kBAAkB,QAAQ,8CAA6C;AAChF,SAASC,kBAAkB,QAAQ,sCAAqC;AACxE,SAASC,yBAAyB,QAAQ,kDAAiD;AAC3F,SAASC,iBAAiB,QAAQ,iCAAgC;AAClE,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAASC,yBAAyB,QAAQ,2CAA0C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"version":3,"file":"sanitizeMCPConfig.d.ts","sourceRoot":"","sources":["../../src/mcp/sanitizeMCPConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,MAAM,EAGN,eAAe,EAEhB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAMV,eAAe,EACf,wBAAwB,EACzB,MAAM,aAAa,CAAA;AAcpB;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,8BAG3B;IACD,MAAM,EAAE,MAAM,GAAG,eAAe,CAAA;IAChC,YAAY,EAAE,eAAe,CAAA;CAC9B,KAAG,wBA8DH,CAAA"}
|
|
@@ -75,8 +75,10 @@ import { COLLECTION_AUTH_BUILTIN_ENTRIES, COLLECTION_AUTH_BUILTINS, COLLECTION_B
|
|
|
75
75
|
}
|
|
76
76
|
return {
|
|
77
77
|
disabled: pluginConfig.disabled,
|
|
78
|
+
hooks: pluginConfig.hooks,
|
|
78
79
|
items,
|
|
79
80
|
mcp: pluginConfig.mcp,
|
|
81
|
+
oauth: pluginConfig.oauth,
|
|
80
82
|
overrideGetAuthorizedMCP: pluginConfig.overrideGetAuthorizedMCP
|
|
81
83
|
};
|
|
82
84
|
};
|
|
@@ -88,13 +90,16 @@ const sanitizeCollectionConfig = ({ collection, pluginConfig })=>{
|
|
|
88
90
|
* Payload disables duplicate for auth collections by default unless the
|
|
89
91
|
* collection explicitly opts back in with `disableDuplicate: false`.
|
|
90
92
|
*/ const isDuplicateDisabled = collection.disableDuplicate === true || Boolean(collection.auth) && collection.disableDuplicate !== false;
|
|
91
|
-
for (const [toolKey, { mcpName, requiresDuplicateEnabled, requiresVersions, tool }] of COLLECTION_BUILTIN_ENTRIES){
|
|
93
|
+
for (const [toolKey, { mcpName, requiresDuplicateEnabled, requiresUpload, requiresVersions, tool }] of COLLECTION_BUILTIN_ENTRIES){
|
|
92
94
|
if (requiresVersions && !collection.versions) {
|
|
93
95
|
continue;
|
|
94
96
|
}
|
|
95
97
|
if (requiresDuplicateEnabled && isDuplicateDisabled) {
|
|
96
98
|
continue;
|
|
97
99
|
}
|
|
100
|
+
if (requiresUpload && !collection.upload) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
98
103
|
const matchedConfigEntry = collectionPluginConfig?.tools?.[toolKey];
|
|
99
104
|
if (matchedConfigEntry === false) {
|
|
100
105
|
continue;
|