@payloadcms/plugin-mcp 4.0.0-internal.567a487 → 4.0.0-internal.5a4aa81

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.
Files changed (156) hide show
  1. package/dist/endpoint/access.js +2 -2
  2. package/dist/endpoint/access.js.map +1 -1
  3. package/dist/mcp/buildMcpServer.d.ts +1 -1
  4. package/dist/mcp/buildMcpServer.d.ts.map +1 -1
  5. package/dist/mcp/buildMcpServer.js +35 -23
  6. package/dist/mcp/buildMcpServer.js.map +1 -1
  7. package/dist/mcp/builtin/collections/authTools.d.ts.map +1 -1
  8. package/dist/mcp/builtin/collections/authTools.js +79 -56
  9. package/dist/mcp/builtin/collections/authTools.js.map +1 -1
  10. package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -1
  11. package/dist/mcp/builtin/collections/countTool.js +9 -14
  12. package/dist/mcp/builtin/collections/countTool.js.map +1 -1
  13. package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -1
  14. package/dist/mcp/builtin/collections/countVersionsTool.js +9 -13
  15. package/dist/mcp/builtin/collections/countVersionsTool.js.map +1 -1
  16. package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -1
  17. package/dist/mcp/builtin/collections/createTool.js +48 -49
  18. package/dist/mcp/builtin/collections/createTool.js.map +1 -1
  19. package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -1
  20. package/dist/mcp/builtin/collections/deleteTool.js +40 -43
  21. package/dist/mcp/builtin/collections/deleteTool.js.map +1 -1
  22. package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -1
  23. package/dist/mcp/builtin/collections/duplicateTool.js +26 -36
  24. package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -1
  25. package/dist/mcp/builtin/collections/fileInput.d.ts +21 -21
  26. package/dist/mcp/builtin/collections/fileInput.d.ts.map +1 -1
  27. package/dist/mcp/builtin/collections/fileInput.js +19 -20
  28. package/dist/mcp/builtin/collections/fileInput.js.map +1 -1
  29. package/dist/mcp/builtin/collections/fileInput.spec.js +2 -2
  30. package/dist/mcp/builtin/collections/fileInput.spec.js.map +1 -1
  31. package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -1
  32. package/dist/mcp/builtin/collections/findDistinctTool.js +11 -26
  33. package/dist/mcp/builtin/collections/findDistinctTool.js.map +1 -1
  34. package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -1
  35. package/dist/mcp/builtin/collections/findTool.js +21 -43
  36. package/dist/mcp/builtin/collections/findTool.js.map +1 -1
  37. package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -1
  38. package/dist/mcp/builtin/collections/findVersionByIDTool.js +17 -26
  39. package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -1
  40. package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -1
  41. package/dist/mcp/builtin/collections/findVersionsTool.js +16 -30
  42. package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -1
  43. package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -1
  44. package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +12 -12
  45. package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -1
  46. package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -1
  47. package/dist/mcp/builtin/collections/restoreVersionTool.js +14 -26
  48. package/dist/mcp/builtin/collections/restoreVersionTool.js.map +1 -1
  49. package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -1
  50. package/dist/mcp/builtin/collections/updateTool.js +50 -86
  51. package/dist/mcp/builtin/collections/updateTool.js.map +1 -1
  52. package/dist/mcp/builtin/collections/uploadInstructionsTool.js +11 -11
  53. package/dist/mcp/builtin/collections/uploadInstructionsTool.js.map +1 -1
  54. package/dist/mcp/builtin/formatEntityError.d.ts +16 -0
  55. package/dist/mcp/builtin/formatEntityError.d.ts.map +1 -0
  56. package/dist/mcp/builtin/formatEntityError.js +55 -0
  57. package/dist/mcp/builtin/formatEntityError.js.map +1 -0
  58. package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -1
  59. package/dist/mcp/builtin/getConfigInfoTool.js +3 -2
  60. package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -1
  61. package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -1
  62. package/dist/mcp/builtin/globals/countVersionsTool.js +9 -13
  63. package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -1
  64. package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -1
  65. package/dist/mcp/builtin/globals/findTool.js +10 -16
  66. package/dist/mcp/builtin/globals/findTool.js.map +1 -1
  67. package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -1
  68. package/dist/mcp/builtin/globals/findVersionByIDTool.js +13 -24
  69. package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -1
  70. package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -1
  71. package/dist/mcp/builtin/globals/findVersionsTool.js +13 -29
  72. package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -1
  73. package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -1
  74. package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +11 -11
  75. package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -1
  76. package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -1
  77. package/dist/mcp/builtin/globals/restoreVersionTool.js +15 -22
  78. package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -1
  79. package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -1
  80. package/dist/mcp/builtin/globals/updateTool.js +27 -36
  81. package/dist/mcp/builtin/globals/updateTool.js.map +1 -1
  82. package/dist/types.d.ts +4 -4
  83. package/dist/types.d.ts.map +1 -1
  84. package/dist/types.js.map +1 -1
  85. package/package.json +4 -6
  86. package/src/endpoint/access.ts +2 -3
  87. package/src/mcp/buildMcpServer.ts +39 -29
  88. package/src/mcp/builtin/collections/authTools.ts +77 -69
  89. package/src/mcp/builtin/collections/countTool.ts +9 -21
  90. package/src/mcp/builtin/collections/countVersionsTool.ts +9 -18
  91. package/src/mcp/builtin/collections/createTool.ts +73 -96
  92. package/src/mcp/builtin/collections/deleteTool.ts +36 -64
  93. package/src/mcp/builtin/collections/duplicateTool.ts +33 -84
  94. package/src/mcp/builtin/collections/fileInput.spec.ts +2 -2
  95. package/src/mcp/builtin/collections/fileInput.ts +30 -25
  96. package/src/mcp/builtin/collections/findDistinctTool.ts +11 -63
  97. package/src/mcp/builtin/collections/findTool.ts +21 -103
  98. package/src/mcp/builtin/collections/findVersionByIDTool.ts +15 -58
  99. package/src/mcp/builtin/collections/findVersionsTool.ts +14 -85
  100. package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +11 -11
  101. package/src/mcp/builtin/collections/restoreVersionTool.ts +14 -56
  102. package/src/mcp/builtin/collections/updateTool.ts +53 -108
  103. package/src/mcp/builtin/collections/uploadInstructionsTool.ts +12 -12
  104. package/src/mcp/builtin/formatEntityError.ts +77 -0
  105. package/src/mcp/builtin/getConfigInfoTool.ts +2 -1
  106. package/src/mcp/builtin/globals/countVersionsTool.ts +9 -17
  107. package/src/mcp/builtin/globals/findTool.ts +12 -51
  108. package/src/mcp/builtin/globals/findVersionByIDTool.ts +13 -52
  109. package/src/mcp/builtin/globals/findVersionsTool.ts +14 -92
  110. package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +10 -10
  111. package/src/mcp/builtin/globals/restoreVersionTool.ts +14 -45
  112. package/src/mcp/builtin/globals/updateTool.ts +37 -60
  113. package/src/types.ts +4 -4
  114. package/dist/mcp/builtin/collections/formatCollectionError.d.ts +0 -9
  115. package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +0 -1
  116. package/dist/mcp/builtin/collections/formatCollectionError.js +0 -60
  117. package/dist/mcp/builtin/collections/formatCollectionError.js.map +0 -1
  118. package/dist/mcp/builtin/validateEntityData.d.ts +0 -14
  119. package/dist/mcp/builtin/validateEntityData.d.ts.map +0 -1
  120. package/dist/mcp/builtin/validateEntityData.js +0 -82
  121. package/dist/mcp/builtin/validateEntityData.js.map +0 -1
  122. package/dist/utils/getVirtualFieldNames.d.ts +0 -14
  123. package/dist/utils/getVirtualFieldNames.d.ts.map +0 -1
  124. package/dist/utils/getVirtualFieldNames.js +0 -35
  125. package/dist/utils/getVirtualFieldNames.js.map +0 -1
  126. package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts +0 -28
  127. package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts.map +0 -1
  128. package/dist/utils/schemaConversion/filterFieldsByAccess.js +0 -71
  129. package/dist/utils/schemaConversion/filterFieldsByAccess.js.map +0 -1
  130. package/dist/utils/schemaConversion/getEntityInputSchema.d.ts +0 -13
  131. package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +0 -1
  132. package/dist/utils/schemaConversion/getEntityInputSchema.js +0 -66
  133. package/dist/utils/schemaConversion/getEntityInputSchema.js.map +0 -1
  134. package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +0 -10
  135. package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +0 -1
  136. package/dist/utils/schemaConversion/sanitizeEntitySchema.js +0 -384
  137. package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +0 -1
  138. package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +0 -133
  139. package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +0 -1
  140. package/dist/utils/transformPointDataToPayload.d.ts +0 -7
  141. package/dist/utils/transformPointDataToPayload.d.ts.map +0 -1
  142. package/dist/utils/transformPointDataToPayload.js +0 -28
  143. package/dist/utils/transformPointDataToPayload.js.map +0 -1
  144. package/dist/utils/whereSchema.d.ts +0 -9
  145. package/dist/utils/whereSchema.d.ts.map +0 -1
  146. package/dist/utils/whereSchema.js +0 -13
  147. package/dist/utils/whereSchema.js.map +0 -1
  148. package/src/mcp/builtin/collections/formatCollectionError.ts +0 -84
  149. package/src/mcp/builtin/validateEntityData.ts +0 -132
  150. package/src/utils/getVirtualFieldNames.ts +0 -53
  151. package/src/utils/schemaConversion/filterFieldsByAccess.ts +0 -123
  152. package/src/utils/schemaConversion/getEntityInputSchema.ts +0 -96
  153. package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +0 -96
  154. package/src/utils/schemaConversion/sanitizeEntitySchema.ts +0 -432
  155. package/src/utils/transformPointDataToPayload.ts +0 -40
  156. package/src/utils/whereSchema.ts +0 -24
@@ -1 +1 @@
1
- {"version":3,"file":"getGlobalSchemaTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/getGlobalSchemaTool.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,wCAwD9B,CAAA"}
1
+ {"version":3,"file":"getGlobalSchemaTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/getGlobalSchemaTool.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,wCAyD9B,CAAA"}
@@ -1,10 +1,9 @@
1
- import { getAccessResults } from 'payload';
1
+ import { getAccessResults, getGlobalInputSchema, getGlobalSchemaInputSchema } from 'payload';
2
2
  import { defaultAccess } from '../../../defaultAccess.js';
3
3
  import { defineGlobalTool } from '../../../defineTool.js';
4
- import { getGlobalInputSchema } from '../../../utils/schemaConversion/getEntityInputSchema.js';
5
4
  export const getGlobalSchemaTool = defineGlobalTool({
6
5
  access: (args)=>{
7
- const permissions = args.permissions?.globals?.[args.globalSlug];
6
+ const permissions = args.permissions?.globals?.[args.slug];
8
7
  return defaultAccess(args) && Boolean(permissions?.update);
9
8
  },
10
9
  annotations: {
@@ -14,24 +13,25 @@ export const getGlobalSchemaTool = defineGlobalTool({
14
13
  readOnlyHint: true,
15
14
  title: 'Get Global Schema'
16
15
  },
17
- description: 'Get the input schema for updating a global.'
18
- }).handler(async ({ authorizedMCP, globalSlug, req })=>{
16
+ description: 'Get the input schema for updating a global.',
17
+ input: getGlobalSchemaInputSchema
18
+ }).handler(async ({ slug, authorizedMCP, req })=>{
19
19
  const permissions = authorizedMCP.overrideAccess ? null : (await getAccessResults({
20
20
  req
21
- })).globals?.[globalSlug];
21
+ })).globals?.[slug];
22
22
  if (!authorizedMCP.overrideAccess && !permissions?.update) {
23
23
  return {
24
24
  content: [
25
25
  {
26
26
  type: 'text',
27
- text: `Error: MCP access to "getGlobalSchema" is not enabled for global "${globalSlug}"`
27
+ text: `Error: MCP access to "getGlobalSchema" is not enabled for global "${slug}"`
28
28
  }
29
29
  ],
30
30
  isError: true
31
31
  };
32
32
  }
33
33
  const inputSchema = getGlobalInputSchema({
34
- globalSlug,
34
+ globalSlug: slug,
35
35
  req,
36
36
  ...permissions ? {
37
37
  permissions
@@ -42,7 +42,7 @@ export const getGlobalSchemaTool = defineGlobalTool({
42
42
  content: [
43
43
  {
44
44
  type: 'text',
45
- text: `Error: Global "${globalSlug}" not found`
45
+ text: `Error: Global "${slug}" not found`
46
46
  }
47
47
  ],
48
48
  isError: true
@@ -52,11 +52,11 @@ export const getGlobalSchemaTool = defineGlobalTool({
52
52
  content: [
53
53
  {
54
54
  type: 'text',
55
- text: `Schema for global "${globalSlug}":\n\`\`\`json\n${JSON.stringify(inputSchema)}\n\`\`\``
55
+ text: `Schema for global "${slug}":\n\`\`\`json\n${JSON.stringify(inputSchema)}\n\`\`\``
56
56
  }
57
57
  ],
58
58
  structuredContent: {
59
- globalSlug,
59
+ slug,
60
60
  schema: inputSchema
61
61
  }
62
62
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/mcp/builtin/globals/getGlobalSchemaTool.ts"],"sourcesContent":["import { getAccessResults } from 'payload'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineGlobalTool } from '../../../defineTool.js'\nimport { getGlobalInputSchema } from '../../../utils/schemaConversion/getEntityInputSchema.js'\n\nexport const getGlobalSchemaTool = defineGlobalTool({\n access: (args) => {\n const permissions = args.permissions?.globals?.[args.globalSlug]\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 for updating a global.',\n}).handler(async ({ authorizedMCP, globalSlug, req }) => {\n const permissions = authorizedMCP.overrideAccess\n ? null\n : (await getAccessResults({ req })).globals?.[globalSlug]\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 \"${globalSlug}\"`,\n },\n ],\n isError: true,\n }\n }\n\n const inputSchema = getGlobalInputSchema({\n globalSlug,\n req,\n ...(permissions ? { permissions } : {}),\n })\n\n if (!inputSchema) {\n return {\n content: [{ type: 'text', text: `Error: Global \"${globalSlug}\" not found` }],\n isError: true,\n }\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `Schema for global \"${globalSlug}\":\\n\\`\\`\\`json\\n${JSON.stringify(inputSchema)}\\n\\`\\`\\``,\n },\n ],\n structuredContent: {\n globalSlug,\n schema: inputSchema,\n },\n }\n})\n"],"names":["getAccessResults","defaultAccess","defineGlobalTool","getGlobalInputSchema","getGlobalSchemaTool","access","args","permissions","globals","globalSlug","Boolean","update","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","handler","authorizedMCP","req","overrideAccess","content","type","text","isError","inputSchema","JSON","stringify","structuredContent","schema"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,UAAS;AAE1C,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,oBAAoB,QAAQ,0DAAyD;AAE9F,OAAO,MAAMC,sBAAsBF,iBAAiB;IAClDG,QAAQ,CAACC;QACP,MAAMC,cAAcD,KAAKC,WAAW,EAAEC,SAAS,CAACF,KAAKG,UAAU,CAAC;QAEhE,OAAOR,cAAcK,SAASI,QAAQH,aAAaI;IACrD;IACAC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAa;AACf,GAAGC,OAAO,CAAC,OAAO,EAAEC,aAAa,EAAEX,UAAU,EAAEY,GAAG,EAAE;IAClD,MAAMd,cAAca,cAAcE,cAAc,GAC5C,OACA,AAAC,CAAA,MAAMtB,iBAAiB;QAAEqB;IAAI,EAAC,EAAGb,OAAO,EAAE,CAACC,WAAW;IAE3D,IAAI,CAACW,cAAcE,cAAc,IAAI,CAACf,aAAaI,QAAQ;QACzD,OAAO;YACLY,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,kEAAkE,EAAEhB,WAAW,CAAC,CAAC;gBAC1F;aACD;YACDiB,SAAS;QACX;IACF;IAEA,MAAMC,cAAcxB,qBAAqB;QACvCM;QACAY;QACA,GAAId,cAAc;YAAEA;QAAY,IAAI,CAAC,CAAC;IACxC;IAEA,IAAI,CAACoB,aAAa;QAChB,OAAO;YACLJ,SAAS;gBAAC;oBAAEC,MAAM;oBAAQC,MAAM,CAAC,eAAe,EAAEhB,WAAW,WAAW,CAAC;gBAAC;aAAE;YAC5EiB,SAAS;QACX;IACF;IAEA,OAAO;QACLH,SAAS;YACP;gBACEC,MAAM;gBACNC,MAAM,CAAC,mBAAmB,EAAEhB,WAAW,gBAAgB,EAAEmB,KAAKC,SAAS,CAACF,aAAa,QAAQ,CAAC;YAChG;SACD;QACDG,mBAAmB;YACjBrB;YACAsB,QAAQJ;QACV;IACF;AACF,GAAE"}
1
+ {"version":3,"sources":["../../../../src/mcp/builtin/globals/getGlobalSchemaTool.ts"],"sourcesContent":["import { getAccessResults, getGlobalInputSchema, getGlobalSchemaInputSchema } from 'payload'\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 for 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 return {\n content: [\n {\n type: 'text',\n text: `Schema for global \"${slug}\":\\n\\`\\`\\`json\\n${JSON.stringify(inputSchema)}\\n\\`\\`\\``,\n },\n ],\n structuredContent: {\n slug,\n schema: inputSchema,\n },\n }\n})\n"],"names":["getAccessResults","getGlobalInputSchema","getGlobalSchemaInputSchema","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","JSON","stringify","structuredContent","schema"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,oBAAoB,EAAEC,0BAA0B,QAAQ,UAAS;AAE5F,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,OAAOlB;AACT,GAAGmB,OAAO,CAAC,OAAO,EAAEX,IAAI,EAAEY,aAAa,EAAEC,GAAG,EAAE;IAC5C,MAAMf,cAAcc,cAAcE,cAAc,GAC5C,OACA,AAAC,CAAA,MAAMxB,iBAAiB;QAAEuB;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,cAAc5B,qBAAqB;QACvC6B,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,OAAO;QACLH,SAAS;YACP;gBACEC,MAAM;gBACNC,MAAM,CAAC,mBAAmB,EAAEjB,KAAK,gBAAgB,EAAEqB,KAAKC,SAAS,CAACH,aAAa,QAAQ,CAAC;YAC1F;SACD;QACDI,mBAAmB;YACjBvB;YACAwB,QAAQL;QACV;IACF;AACF,GAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersionTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/restoreVersionTool.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,wBAAwB,wCAuFnC,CAAA"}
1
+ {"version":3,"file":"restoreVersionTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/restoreVersionTool.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,wBAAwB,wCA0DnC,CAAA"}
@@ -1,10 +1,10 @@
1
- import { z } from 'zod';
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
5
  const DEFAULT_DESCRIPTION = 'Restore a global from a previous version in any version-enabled global.';
6
6
  export const restoreGlobalVersionTool = defineGlobalTool({
7
- access: (args)=>defaultAccess(args) && Boolean(args.permissions?.globals?.[args.globalSlug]?.update),
7
+ access: (args)=>defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.update),
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  idempotentHint: false,
@@ -13,39 +13,32 @@ export const restoreGlobalVersionTool = defineGlobalTool({
13
13
  title: 'Restore Global Version'
14
14
  },
15
15
  description: DEFAULT_DESCRIPTION,
16
- input: z.object({
17
- id: z.string().describe('The ID of the global version to restore'),
18
- depth: z.number().int().min(0).max(10).describe('How many levels deep to populate relationships in response').optional().default(0),
19
- fallbackLocale: z.string().describe('Optional: fallback locale code to use when requested locale is not available').optional(),
20
- locale: z.string().describe('Optional: locale code to restore in (e.g., "en", "es")').optional(),
21
- populate: z.record(z.string(), z.unknown()).describe('Optional: control which fields to include from populated relationship or upload documents.').optional(),
22
- showHiddenFields: z.boolean().describe('Optional: include hidden fields in the restored global response').optional()
23
- })
24
- }).handler(async ({ authorizedMCP, globalSlug, input, req })=>{
16
+ input: restoreGlobalVersionInputSchema
17
+ }).handler(async ({ slug, authorizedMCP, input, req })=>{
25
18
  const payload = req.payload;
26
19
  const logger = getLogger({
27
20
  payload
28
21
  });
29
- const { id, depth, fallbackLocale, locale, populate, showHiddenFields } = input;
30
- logger.info(`Restoring version for global: ${globalSlug} with ID: ${id}`);
22
+ const { id, depth, fallbackLocale, locale, populate, select } = input;
23
+ logger.info(`Restoring version for global: ${slug} with ID: ${id}`);
31
24
  try {
32
25
  const result = await payload.restoreGlobalVersion({
33
- id,
34
- slug: globalSlug,
26
+ id: String(id),
27
+ slug,
35
28
  depth,
36
29
  overrideAccess: authorizedMCP.overrideAccess,
37
30
  req,
38
- ...fallbackLocale ? {
31
+ ...fallbackLocale !== undefined ? {
39
32
  fallbackLocale
40
33
  } : {},
41
34
  ...locale ? {
42
35
  locale
43
36
  } : {},
44
37
  ...populate ? {
45
- populate: populate
38
+ populate
46
39
  } : {},
47
- ...showHiddenFields !== undefined ? {
48
- showHiddenFields
40
+ ...select ? {
41
+ select
49
42
  } : {}
50
43
  });
51
44
  const resultObject = result;
@@ -54,19 +47,19 @@ export const restoreGlobalVersionTool = defineGlobalTool({
54
47
  content: [
55
48
  {
56
49
  type: 'text',
57
- text: `Version "${id}" restored successfully for global "${globalSlug}"!\nRestored global:\n\`\`\`json\n${JSON.stringify(restoredGlobal)}\n\`\`\``
50
+ text: `Version "${id}" restored successfully for global "${slug}"!\nRestored global:\n\`\`\`json\n${JSON.stringify(restoredGlobal)}\n\`\`\``
58
51
  }
59
52
  ],
60
53
  doc: restoredGlobal
61
54
  };
62
55
  } catch (error) {
63
56
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
64
- logger.error(`Error restoring version ${id} for global ${globalSlug}: ${errorMessage}`);
57
+ logger.error(`Error restoring version ${id} for global ${slug}: ${errorMessage}`);
65
58
  return {
66
59
  content: [
67
60
  {
68
61
  type: 'text',
69
- text: `❌ **Error restoring version "${id}" for global "${globalSlug}":** ${errorMessage}`
62
+ text: `❌ **Error restoring version "${id}" for global "${slug}":** ${errorMessage}`
70
63
  }
71
64
  ],
72
65
  isError: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/mcp/builtin/globals/restoreVersionTool.ts"],"sourcesContent":["import type { PopulateType } from 'payload'\n\nimport { z } from 'zod'\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) =>\n defaultAccess(args) && Boolean(args.permissions?.globals?.[args.globalSlug]?.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: z.object({\n id: z.string().describe('The ID of the global version to restore'),\n depth: z\n .number()\n .int()\n .min(0)\n .max(10)\n .describe('How many levels deep to populate relationships in response')\n .optional()\n .default(0),\n fallbackLocale: z\n .string()\n .describe('Optional: fallback locale code to use when requested locale is not available')\n .optional(),\n locale: z\n .string()\n .describe('Optional: locale code to restore in (e.g., \"en\", \"es\")')\n .optional(),\n populate: z\n .record(z.string(), z.unknown())\n .describe(\n 'Optional: control which fields to include from populated relationship or upload documents.',\n )\n .optional(),\n showHiddenFields: z\n .boolean()\n .describe('Optional: include hidden fields in the restored global response')\n .optional(),\n }),\n}).handler(async ({ authorizedMCP, globalSlug, input, req }) => {\n const payload = req.payload\n const logger = getLogger({ payload })\n const { id, depth, fallbackLocale, locale, populate, showHiddenFields } = input\n\n logger.info(`Restoring version for global: ${globalSlug} with ID: ${id}`)\n\n try {\n const result = await payload.restoreGlobalVersion({\n id,\n slug: globalSlug,\n depth,\n overrideAccess: authorizedMCP.overrideAccess,\n req,\n ...(fallbackLocale ? { fallbackLocale } : {}),\n ...(locale ? { locale } : {}),\n ...(populate ? { populate: populate as PopulateType } : {}),\n ...(showHiddenFields !== undefined ? { showHiddenFields } : {}),\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 \"${globalSlug}\"!\\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 ${globalSlug}: ${errorMessage}`)\n return {\n content: [\n {\n type: 'text',\n text: `❌ **Error restoring version \"${id}\" for global \"${globalSlug}\":** ${errorMessage}`,\n },\n ],\n isError: true,\n }\n }\n})\n"],"names":["z","defaultAccess","defineGlobalTool","getLogger","DEFAULT_DESCRIPTION","restoreGlobalVersionTool","access","args","Boolean","permissions","globals","globalSlug","update","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","object","id","string","describe","depth","number","int","min","max","optional","default","fallbackLocale","locale","populate","record","unknown","showHiddenFields","boolean","handler","authorizedMCP","req","payload","logger","info","result","restoreGlobalVersion","slug","overrideAccess","undefined","resultObject","restoredGlobal","version","content","type","text","JSON","stringify","doc","error","errorMessage","Error","message","isError"],"mappings":"AAEA,SAASA,CAAC,QAAQ,MAAK;AAEvB,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,OACPN,cAAcM,SAASC,QAAQD,KAAKE,WAAW,EAAEC,SAAS,CAACH,KAAKI,UAAU,CAAC,EAAEC;IAC/EC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAaf;IACbgB,OAAOpB,EAAEqB,MAAM,CAAC;QACdC,IAAItB,EAAEuB,MAAM,GAAGC,QAAQ,CAAC;QACxBC,OAAOzB,EACJ0B,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,IACJL,QAAQ,CAAC,8DACTM,QAAQ,GACRC,OAAO,CAAC;QACXC,gBAAgBhC,EACbuB,MAAM,GACNC,QAAQ,CAAC,gFACTM,QAAQ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,CAAC;gBACpJ;aACD;YACDO,KAAKP;QACP;IACF,EAAE,OAAOQ,OAAO;QACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;QAC9DnB,OAAOgB,KAAK,CAAC,CAAC,wBAAwB,EAAErC,GAAG,YAAY,EAAEX,WAAW,EAAE,EAAEiD,cAAc;QACtF,OAAO;YACLP,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC,6BAA6B,EAAEjC,GAAG,cAAc,EAAEX,WAAW,KAAK,EAAEiD,cAAc;gBAC3F;aACD;YACDG,SAAS;QACX;IACF;AACF,GAAE"}
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,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IACF;AACF,GAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"updateTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/updateTool.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,gBAAgB,wCAkG3B,CAAA"}
1
+ {"version":3,"file":"updateTool.d.ts","sourceRoot":"","sources":["../../../../src/mcp/builtin/globals/updateTool.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB,wCA4E3B,CAAA"}
@@ -1,13 +1,11 @@
1
- import { z } from 'zod';
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 { getGlobalVirtualFieldNames, stripVirtualFields } from '../../../utils/getVirtualFieldNames.js';
6
- import { transformPointDataToPayload } from '../../../utils/transformPointDataToPayload.js';
7
- import { validateGlobalData } from '../validateEntityData.js';
5
+ import { formatEntityError } from '../formatEntityError.js';
8
6
  const DEFAULT_DESCRIPTION = 'Update any Payload global by passing the global slug and data.';
9
7
  export const updateGlobalTool = defineGlobalTool({
10
- access: (args)=>defaultAccess(args) && Boolean(args.permissions?.globals?.[args.globalSlug]?.update),
8
+ access: (args)=>defaultAccess(args) && Boolean(args.permissions?.globals?.[args.slug]?.update),
11
9
  annotations: {
12
10
  destructiveHint: true,
13
11
  idempotentHint: false,
@@ -16,45 +14,39 @@ export const updateGlobalTool = defineGlobalTool({
16
14
  title: 'Update Global'
17
15
  },
18
16
  description: DEFAULT_DESCRIPTION,
19
- input: z.object({
20
- data: z.record(z.string(), z.unknown()).describe('The global fields to update'),
21
- depth: z.number().describe('Optional: Depth of relationships to populate').optional().default(0),
22
- draft: z.boolean().describe('Optional: Whether to save as draft (default: false)').optional().default(false),
23
- fallbackLocale: z.string().describe('Optional: fallback locale code to use when requested locale is not available').optional(),
24
- 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(),
25
- 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()
26
- })
27
- }).handler(async ({ authorizedMCP, globalSlug, input, req })=>{
17
+ input: updateGlobalInputSchema
18
+ }).handler(async ({ slug, authorizedMCP, input, req })=>{
28
19
  const payload = req.payload;
29
20
  const logger = getLogger({
30
21
  payload
31
22
  });
32
- const { data, depth, draft, fallbackLocale, locale, select } = input;
33
- logger.info(`Updating global: ${globalSlug}, draft: ${draft}${locale ? `, locale: ${locale}` : ''}`);
23
+ const { data, depth, draft, fallbackLocale, locale, overrideLock, populate, publishAllLocales, select, unpublishAllLocales } = input;
24
+ logger.info(`Updating global: ${slug}, draft: ${draft}${locale ? `, locale: ${locale}` : ''}`);
34
25
  try {
35
- const virtualFieldNames = getGlobalVirtualFieldNames(payload.config, globalSlug);
26
+ const virtualFieldNames = getGlobalVirtualFieldNames(payload.config, slug);
36
27
  const inputData = stripVirtualFields(data, virtualFieldNames);
37
- const validationError = validateGlobalData({
28
+ validateGlobalData({
29
+ slug,
38
30
  data: inputData,
39
- globalSlug,
40
31
  req
41
32
  });
42
- if (validationError) {
43
- return validationError;
44
- }
45
33
  const parsedData = transformPointDataToPayload(inputData);
46
34
  const updateOptions = {
47
- slug: globalSlug,
35
+ slug,
48
36
  data: parsedData,
49
37
  depth,
50
38
  draft,
51
39
  overrideAccess: authorizedMCP.overrideAccess,
52
- req
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 "${globalSlug}" updated successfully!\n\`\`\`json\n${JSON.stringify(result)}\n\`\`\``
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 errorMessage = error instanceof Error ? error.message : 'Unknown error';
75
- logger.error(`Error updating global ${globalSlug}: ${errorMessage}`);
76
- return {
77
- content: [
78
- {
79
- type: 'text',
80
- text: `Error updating global "${globalSlug}": ${errorMessage}`
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 type { SelectType } from 'payload'\n\nimport { z } from 'zod'\n\nimport { defaultAccess } from '../../../defaultAccess.js'\nimport { defineGlobalTool } from '../../../defineTool.js'\nimport { getLogger } from '../../../utils/getLogger.js'\nimport {\n getGlobalVirtualFieldNames,\n stripVirtualFields,\n} from '../../../utils/getVirtualFieldNames.js'\nimport { transformPointDataToPayload } from '../../../utils/transformPointDataToPayload.js'\nimport { validateGlobalData } from '../validateEntityData.js'\n\nconst DEFAULT_DESCRIPTION = 'Update any Payload global by passing the global slug and data.'\n\nexport const updateGlobalTool = defineGlobalTool({\n access: (args) =>\n defaultAccess(args) && Boolean(args.permissions?.globals?.[args.globalSlug]?.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: z.object({\n data: z.record(z.string(), z.unknown()).describe('The global fields to update'),\n depth: z\n .number()\n .describe('Optional: Depth of relationships to populate')\n .optional()\n .default(0),\n draft: z\n .boolean()\n .describe('Optional: Whether to save as draft (default: false)')\n .optional()\n .default(false),\n fallbackLocale: z\n .string()\n .describe('Optional: fallback locale code to use when requested locale is not available')\n .optional(),\n locale: z\n .string()\n .describe(\n 'Optional: locale code to update data in (e.g., \"en\", \"es\"). Use \"all\" to update all locales for localized fields',\n )\n .optional(),\n select: z\n .record(z.string(), z.unknown())\n .describe(\n 'Optional: define exactly which fields you\\'d like to return in the response, e.g., {\"siteName\": true}',\n )\n .optional(),\n }),\n}).handler(async ({ authorizedMCP, globalSlug, input, req }) => {\n const payload = req.payload\n const logger = getLogger({ payload })\n\n const { data, depth, draft, fallbackLocale, locale, select } = input\n\n logger.info(\n `Updating global: ${globalSlug}, draft: ${draft}${locale ? `, locale: ${locale}` : ''}`,\n )\n\n try {\n const virtualFieldNames = getGlobalVirtualFieldNames(payload.config, globalSlug)\n const inputData = stripVirtualFields(data, virtualFieldNames)\n const validationError = validateGlobalData({ data: inputData, globalSlug, req })\n\n if (validationError) {\n return validationError\n }\n\n const parsedData = transformPointDataToPayload(inputData)\n\n const updateOptions: Parameters<typeof payload.updateGlobal>[0] = {\n slug: globalSlug,\n data: parsedData,\n depth,\n draft,\n overrideAccess: authorizedMCP.overrideAccess,\n req,\n }\n\n if (locale) {\n updateOptions.locale = locale\n }\n if (fallbackLocale) {\n updateOptions.fallbackLocale = fallbackLocale\n }\n if (select) {\n updateOptions.select = select as SelectType\n }\n\n const result = await payload.updateGlobal(updateOptions)\n\n return {\n content: [\n {\n type: 'text',\n text: `Global \"${globalSlug}\" updated successfully!\\n\\`\\`\\`json\\n${JSON.stringify(result)}\\n\\`\\`\\``,\n },\n ],\n doc: result as Record<string, unknown>,\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error'\n logger.error(`Error updating global ${globalSlug}: ${errorMessage}`)\n return {\n content: [{ type: 'text', text: `Error updating global \"${globalSlug}\": ${errorMessage}` }],\n }\n }\n})\n"],"names":["z","defaultAccess","defineGlobalTool","getLogger","getGlobalVirtualFieldNames","stripVirtualFields","transformPointDataToPayload","validateGlobalData","DEFAULT_DESCRIPTION","updateGlobalTool","access","args","Boolean","permissions","globals","globalSlug","update","annotations","destructiveHint","idempotentHint","openWorldHint","readOnlyHint","title","description","input","object","data","record","string","unknown","describe","depth","number","optional","default","draft","boolean","fallbackLocale","locale","select","handler","authorizedMCP","req","payload","logger","info","virtualFieldNames","config","inputData","validationError","parsedData","updateOptions","slug","overrideAccess","result","updateGlobal","content","type","text","JSON","stringify","doc","error","errorMessage","Error","message"],"mappings":"AAEA,SAASA,CAAC,QAAQ,MAAK;AAEvB,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,SAAS,QAAQ,8BAA6B;AACvD,SACEC,0BAA0B,EAC1BC,kBAAkB,QACb,yCAAwC;AAC/C,SAASC,2BAA2B,QAAQ,gDAA+C;AAC3F,SAASC,kBAAkB,QAAQ,2BAA0B;AAE7D,MAAMC,sBAAsB;AAE5B,OAAO,MAAMC,mBAAmBP,iBAAiB;IAC/CQ,QAAQ,CAACC,OACPV,cAAcU,SAASC,QAAQD,KAAKE,WAAW,EAAEC,SAAS,CAACH,KAAKI,UAAU,CAAC,EAAEC;IAC/EC,aAAa;QACXC,iBAAiB;QACjBC,gBAAgB;QAChBC,eAAe;QACfC,cAAc;QACdC,OAAO;IACT;IACAC,aAAaf;IACbgB,OAAOxB,EAAEyB,MAAM,CAAC;QACdC,MAAM1B,EAAE2B,MAAM,CAAC3B,EAAE4B,MAAM,IAAI5B,EAAE6B,OAAO,IAAIC,QAAQ,CAAC;QACjDC,OAAO/B,EACJgC,MAAM,GACNF,QAAQ,CAAC,gDACTG,QAAQ,GACRC,OAAO,CAAC;QACXC,OAAOnC,EACJoC,OAAO,GACPN,QAAQ,CAAC,uDACTG,QAAQ,GACRC,OAAO,CAAC;QACXG,gBAAgBrC,EACb4B,MAAM,GACNE,QAAQ,CAAC,gFACTG,QAA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WAAW,qCAAqC,EAAE4C,KAAKC,SAAS,CAACN,QAAQ,QAAQ,CAAC;gBACrG;aACD;YACDO,KAAKP;QACP;IACF,EAAE,OAAOQ,OAAO;QACd,MAAMC,eAAeD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAG;QAC9DrB,OAAOkB,KAAK,CAAC,CAAC,sBAAsB,EAAE/C,WAAW,EAAE,EAAEgD,cAAc;QACnE,OAAO;YACLP,SAAS;gBAAC;oBAAEC,MAAM;oBAAQC,MAAM,CAAC,uBAAuB,EAAE3C,WAAW,GAAG,EAAEgD,cAAc;gBAAC;aAAE;QAC7F;IACF;AACF,GAAE"}
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,QAAQ,yBAAwB;AACzD,SAASC,SAAS,QAAQ,8BAA6B;AACvD,SAASC,iBAAiB,QAAQ,0BAAyB;AA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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"}
package/dist/types.d.ts CHANGED
@@ -37,10 +37,10 @@ export type MCPAccessArgs = {
37
37
  req: PayloadRequest;
38
38
  };
39
39
  export type CollectionMCPAccessArgs = {
40
- collectionSlug: CollectionSlug;
40
+ slug: CollectionSlug;
41
41
  } & MCPAccessArgs;
42
42
  export type GlobalMCPAccessArgs = {
43
- globalSlug: GlobalSlug;
43
+ slug: GlobalSlug;
44
44
  } & MCPAccessArgs;
45
45
  export type ToolHandlerArgs<TSchema = undefined> = {
46
46
  authorizedMCP: AuthorizedMCP;
@@ -49,10 +49,10 @@ export type ToolHandlerArgs<TSchema = undefined> = {
49
49
  serverContext: ServerContext;
50
50
  };
51
51
  export type CollectionToolHandlerArgs<TSchema = undefined> = {
52
- collectionSlug: CollectionSlug;
52
+ slug: CollectionSlug;
53
53
  } & ToolHandlerArgs<TSchema>;
54
54
  export type GlobalToolHandlerArgs<TSchema = undefined> = {
55
- globalSlug: GlobalSlug;
55
+ slug: GlobalSlug;
56
56
  } & ToolHandlerArgs<TSchema>;
57
57
  export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
58
58
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],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AO,GACf,CAAC;IACC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;CACf,GAAG,WAAW,CAAC,GAChB,CAAC;IACC,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,UAAU,CAAA;CACjB,GAAG,WAAW,CAAC,GAChB,CAAC;IACC,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,WAAW,CAAC,GAChB,iBAAiB,GACjB,aAAa,CAAA;AAEjB;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,cAAc,EAAE,OAAO,CAAA;CACxB,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n CallToolResult,\n ContentBlock,\n JsonSchemaType,\n McpServer,\n ResourceTemplate,\n ServerContext,\n StandardSchemaWithJSON,\n ToolAnnotations,\n} from '@modelcontextprotocol/server'\nimport type {\n AuthCollectionSlug,\n CollectionSlug,\n GlobalSlug,\n MaybePromise,\n PayloadRequest,\n SanitizedPermissions,\n} from 'payload'\n\nimport type { GetAuthorizedMCPArgs } from './endpoint/access.js'\nimport type {\n MCPCollectionAuthToolName,\n MCPCollectionBuiltinName,\n MCPGlobalBuiltinName,\n} from './mcp/builtinTools.js'\n\nexport type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName }\n\n/** Re-exported from `@modelcontextprotocol/server` — common MCP types used in plugin config. */\nexport type { JsonSchemaType, StandardSchemaWithJSON, ToolAnnotations }\n\n/**\n * What a tool's `input` (or a prompt's `argsSchema`) can be — either a raw\n * JSON Schema 2020-12 literal, or a Standard Schema instance (Zod, Valibot, …).\n * Raw schemas may omit `$schema`; when present it must declare the 2020-12 dialect.\n */\nexport type ToolInputSchema = JsonSchemaType | StandardSchemaWithJSON\n\nexport type MCPToolResponse = {\n content: ContentBlock[]\n /**\n * If available, return the document fetched within the\n * mcp tool. This is threaded as an additional argument to\n * overrideResponse functions and stripped before going on the wire.\n */\n doc?: Record<string, unknown>\n} & Pick<CallToolResult, '_meta' | 'isError' | 'structuredContent'>\n\nexport type MCPResponseOverride = (\n response: MCPToolResponse,\n doc: Record<string, unknown>,\n req: PayloadRequest,\n) => MCPToolResponse\n\nexport type MCPAfterToolCallHook = (args: {\n input: unknown\n req: PayloadRequest\n response: MCPToolResponse\n toolName: string\n}) => MaybePromise<MCPToolResponse>\n\n/**\n * The handler's `input` type. A specific Standard Schema (Zod, Valibot, …) gets\n * its inferred output; anything else falls back to `Record<string, unknown>`.\n */\nexport type TypedInput<TSchema> = TSchema extends StandardSchemaWithJSON\n ? StandardSchemaWithJSON extends TSchema\n ? Record<string, unknown>\n : StandardSchemaWithJSON.InferOutput<TSchema>\n : Record<string, unknown>\n\nexport type MCPAccessArgs = {\n permissions?: SanitizedPermissions\n req: PayloadRequest\n}\n\nexport type CollectionMCPAccessArgs = {\n collectionSlug: CollectionSlug\n} & MCPAccessArgs\n\nexport type GlobalMCPAccessArgs = {\n globalSlug: GlobalSlug\n} & MCPAccessArgs\n\nexport type ToolHandlerArgs<TSchema = undefined> = {\n authorizedMCP: AuthorizedMCP\n input: TypedInput<TSchema>\n req: PayloadRequest\n serverContext: ServerContext\n}\n\nexport type CollectionToolHandlerArgs<TSchema = undefined> = {\n collectionSlug: CollectionSlug\n} & ToolHandlerArgs<TSchema>\n\nexport type GlobalToolHandlerArgs<TSchema = undefined> = {\n globalSlug: GlobalSlug\n} & ToolHandlerArgs<TSchema>\n\nexport type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {\n /**\n * Runs while authorizing each MCP request, before the tool is advertised or called. Return\n * `false` to make the tool unavailable for that request. This is skipped when `overrideAccess`\n * is enabled.\n */\n access?: (args: MCPAccessArgs) => MaybePromise<boolean>\n annotations?: ToolAnnotations\n description: string\n handler: (args: ToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>\n input?: TSchema\n /**\n * Override the return value of the tool handler\n */\n overrideResponse?: MCPResponseOverride\n}\n\nexport type CollectionTool<\n TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined,\n> = {\n /**\n * Runs while authorizing each MCP request for this collection. Return `false` to reject calls\n * to this tool for the collection. The shared tool is not advertised when no collections allow\n * it, but can remain advertised when it is available for another collection. This is skipped\n * when `overrideAccess` is enabled.\n */\n access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>\n handler: (args: CollectionToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>\n input?: TSchema\n} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>\n\nexport type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> =\n {\n /**\n * Runs while authorizing each MCP request for this global. Return `false` to reject calls to\n * this tool for the global. The shared tool is not advertised when no globals allow it, but\n * can remain advertised when it is available for another global. This is skipped when\n * `overrideAccess` is enabled.\n */\n access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>\n handler: (args: GlobalToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>\n input?: TSchema\n } & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>\n\n/**\n * Configures (or disables) a built-in tool without replacing it.\n * `handler?: never` prevents a full `CollectionTool`/`GlobalTool` (which has a\n * required handler) from being silently accepted at a built-in key slot.\n */\nexport type MCPBuiltInCollectionToolOverride = {\n /**\n * Replaces the built-in tool's access check. Return `false` to make the tool unavailable for\n * this collection. This is skipped when `overrideAccess` is enabled.\n */\n access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>\n annotations?: ToolAnnotations\n description?: string\n handler?: never\n overrideResponse?: MCPResponseOverride\n}\n\nexport type MCPBuiltInGlobalToolOverride = {\n /**\n * Replaces the built-in tool's access check. Return `false` to make the tool unavailable for\n * this global. This is skipped when `overrideAccess` is enabled.\n */\n access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>\n annotations?: ToolAnnotations\n description?: string\n handler?: never\n overrideResponse?: MCPResponseOverride\n}\n\n/**\n * Value at a custom (non-built-in) tool key. Either the tool itself, or `false`\n * to disable it (useful when one plugin defines a custom tool and another\n * wants to opt out per-collection).\n */\nexport type MCPTopLevelToolEntry = Tool\n\nexport type MCPCollectionToolsMap = {\n [customToolName: string]: boolean | CollectionTool | MCPBuiltInCollectionToolOverride | undefined\n} & {\n [K in MCPCollectionBuiltinName]?: false | MCPBuiltInCollectionToolOverride\n}\n\nexport type MCPAuthCollectionToolsMap = {\n [K in MCPCollectionAuthToolName]?: MCPBuiltInCollectionToolOverride | true\n} & MCPCollectionToolsMap\n\n/** Auth-enabled collections get auth-tool name autocomplete; others get CRUD-only. */\nexport type MCPToolsMapForCollection<Slug extends CollectionSlug> = Slug extends AuthCollectionSlug\n ? MCPAuthCollectionToolsMap\n : MCPCollectionToolsMap\n\nexport type MCPGlobalToolsMap = {\n [customToolName: string]: boolean | GlobalTool | MCPBuiltInGlobalToolOverride | undefined\n} & {\n [K in MCPGlobalBuiltinName]?: false | MCPBuiltInGlobalToolOverride\n}\n\nexport type MCPTopLevelToolsMap = Record<string, Tool>\n\nexport type PromptHandlerArgs<TSchema = undefined> = {\n input: TypedInput<TSchema>\n req: PayloadRequest\n serverContext: ServerContext\n}\n\nexport type Prompt<TSchema extends ToolInputSchema = ToolInputSchema> = {\n /**\n * Runs while authorizing each MCP request, before the prompt is advertised or used. Return\n * `false` to make the prompt unavailable for that request. This is skipped when\n * `overrideAccess` is enabled.\n */\n access?: (args: MCPAccessArgs) => MaybePromise<boolean>\n argsSchema: TSchema\n description: string\n handler: (args: PromptHandlerArgs<TSchema>) => MaybePromise<{\n messages: Array<{ content: { text: string; type: 'text' }; role: 'assistant' | 'user' }>\n }>\n title: string\n}\n\nexport type ResourceHandlerArgs = {\n /** Variables extracted from a `ResourceTemplate` URI. Empty for static-URI resources. */\n params: Record<string, string>\n req: PayloadRequest\n serverContext: ServerContext\n uri: URL\n}\n\nexport type Resource = {\n /**\n * Runs while authorizing each MCP request, before the resource is advertised or read. Return\n * `false` to make the resource unavailable for that request. This is skipped when\n * `overrideAccess` is enabled.\n */\n access?: (args: MCPAccessArgs) => MaybePromise<boolean>\n description: string\n handler: (args: ResourceHandlerArgs) => MaybePromise<{\n contents: Array<{ text: string; uri: string }>\n }>\n mimeType: string\n title: string\n uri: ResourceTemplate | string\n}\n\nexport type MCPPluginCollectionConfig<TSlug extends CollectionSlug> = {\n description?: string\n /** Fallback for built-in tools that don't set their own `overrideResponse`. */\n overrideResponse?: MCPResponseOverride\n tools?: MCPToolsMapForCollection<TSlug>\n}\n\nexport type MCPPluginGlobalConfig = {\n description?: string\n overrideResponse?: MCPResponseOverride\n tools?: MCPGlobalToolsMap\n}\n\n/**\n * The user-facing config shape passed to `mcpPlugin({ ... })`. Tools, prompts,\n * resources, and per-collection/global tool maps live in their own nested\n * fields. `sanitizeMCPConfig` flattens those into `items` and applies defaults\n * to produce a `SanitizedMCPPluginConfig` — the form every internal consumer\n * actually works with.\n */\nexport type MCPPluginConfig = {\n collections?: {\n [Slug in CollectionSlug]?: MCPPluginCollectionConfig<Slug>\n }\n /** Skip MCP endpoint registration. */\n disabled?: boolean\n globals?: {\n [Slug in GlobalSlug]?: MCPPluginGlobalConfig\n }\n hooks?: {\n /** Transform a tool response after its handler returns */\n afterToolCall?: MCPAfterToolCallHook[]\n }\n mcp?: {\n serverOptions?: MCPServerOptions\n verboseLogs?: boolean\n }\n /**\n * Replace the default MCP authorization resolver.\n *\n * This hook replaces the default authentication flow. It must set `req.user` to the\n * authenticated Payload user, or to `null` for an anonymous caller, before returning.\n */\n overrideGetAuthorizedMCP?: (\n args: {\n pluginConfig: SanitizedMCPPluginConfig\n } & GetAuthorizedMCPArgs,\n ) => MaybePromise<AuthorizedMCP>\n prompts?: Record<string, Prompt>\n resources?: Record<string, Resource>\n /** Cross-cutting tools (not scoped to any collection or global). */\n tools?: MCPTopLevelToolsMap\n}\n\nexport type SanitizedMCPPluginConfig = {\n items: MCPItem[]\n} & Pick<MCPPluginConfig, 'disabled' | 'hooks' | 'mcp' | 'overrideGetAuthorizedMCP'>\n\nexport type MCPServerOptions = {\n options?: ConstructorParameters<typeof McpServer>[1]\n serverInfo?: Partial<ConstructorParameters<typeof McpServer>[0]>\n}\n\n/**\n * One MCP primitive plus the metadata needed for config-driven filtering and\n * registration.\n *\n * - `configKey`: the config identifier, e.g. `find` or `echo`.\n * - `mcpName`: the MCP wire name, e.g. `findDocuments` or `echo`.\n * - `label`: human-readable display text.\n */\nexport type MCPItemBase = {\n configKey: string\n label: string\n mcpName: string\n}\n\nexport type CollectionMCPItem = {\n collectionSlug: CollectionSlug\n tool: CollectionTool\n type: 'collectionTool'\n} & MCPItemBase\n\nexport type GlobalMCPItem = {\n globalSlug: GlobalSlug\n tool: GlobalTool\n type: 'globalTool'\n} & MCPItemBase\n\nexport type MCPItem =\n | ({\n prompt: Prompt\n type: 'prompt'\n } & MCPItemBase)\n | ({\n resource: Resource\n type: 'resource'\n } & MCPItemBase)\n | ({\n tool: Tool\n type: 'tool'\n } & MCPItemBase)\n | CollectionMCPItem\n | GlobalMCPItem\n\n/**\n * The MCP items and access mode authorized for this request. The authenticated user is available\n * as `req.user`.\n */\nexport type AuthorizedMCP = {\n items: MCPItem[]\n overrideAccess: boolean\n}\n"],"names":[],"mappings":"AAgWA;;;CAGC,GACD,WAGC"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n CallToolResult,\n ContentBlock,\n JsonSchemaType,\n McpServer,\n ResourceTemplate,\n ServerContext,\n StandardSchemaWithJSON,\n ToolAnnotations,\n} from '@modelcontextprotocol/server'\nimport type {\n AuthCollectionSlug,\n CollectionSlug,\n GlobalSlug,\n MaybePromise,\n PayloadRequest,\n SanitizedPermissions,\n} from 'payload'\n\nimport type { GetAuthorizedMCPArgs } from './endpoint/access.js'\nimport type {\n MCPCollectionAuthToolName,\n MCPCollectionBuiltinName,\n MCPGlobalBuiltinName,\n} from './mcp/builtinTools.js'\n\nexport type { MCPCollectionAuthToolName, MCPCollectionBuiltinName, MCPGlobalBuiltinName }\n\n/** Re-exported from `@modelcontextprotocol/server` — common MCP types used in plugin config. */\nexport type { JsonSchemaType, StandardSchemaWithJSON, ToolAnnotations }\n\n/**\n * What a tool's `input` (or a prompt's `argsSchema`) can be — either a raw\n * JSON Schema 2020-12 literal, or a Standard Schema instance (Zod, Valibot, …).\n * Raw schemas may omit `$schema`; when present it must declare the 2020-12 dialect.\n */\nexport type ToolInputSchema = JsonSchemaType | StandardSchemaWithJSON\n\nexport type MCPToolResponse = {\n content: ContentBlock[]\n /**\n * If available, return the document fetched within the\n * mcp tool. This is threaded as an additional argument to\n * overrideResponse functions and stripped before going on the wire.\n */\n doc?: Record<string, unknown>\n} & Pick<CallToolResult, '_meta' | 'isError' | 'structuredContent'>\n\nexport type MCPResponseOverride = (\n response: MCPToolResponse,\n doc: Record<string, unknown>,\n req: PayloadRequest,\n) => MCPToolResponse\n\nexport type MCPAfterToolCallHook = (args: {\n input: unknown\n req: PayloadRequest\n response: MCPToolResponse\n toolName: string\n}) => MaybePromise<MCPToolResponse>\n\n/**\n * The handler's `input` type. A specific Standard Schema (Zod, Valibot, …) gets\n * its inferred output; anything else falls back to `Record<string, unknown>`.\n */\nexport type TypedInput<TSchema> = TSchema extends StandardSchemaWithJSON\n ? StandardSchemaWithJSON extends TSchema\n ? Record<string, unknown>\n : StandardSchemaWithJSON.InferOutput<TSchema>\n : Record<string, unknown>\n\nexport type MCPAccessArgs = {\n permissions?: SanitizedPermissions\n req: PayloadRequest\n}\n\nexport type CollectionMCPAccessArgs = {\n slug: CollectionSlug\n} & MCPAccessArgs\n\nexport type GlobalMCPAccessArgs = {\n slug: GlobalSlug\n} & MCPAccessArgs\n\nexport type ToolHandlerArgs<TSchema = undefined> = {\n authorizedMCP: AuthorizedMCP\n input: TypedInput<TSchema>\n req: PayloadRequest\n serverContext: ServerContext\n}\n\nexport type CollectionToolHandlerArgs<TSchema = undefined> = {\n slug: CollectionSlug\n} & ToolHandlerArgs<TSchema>\n\nexport type GlobalToolHandlerArgs<TSchema = undefined> = {\n slug: GlobalSlug\n} & ToolHandlerArgs<TSchema>\n\nexport type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {\n /**\n * Runs while authorizing each MCP request, before the tool is advertised or called. Return\n * `false` to make the tool unavailable for that request. This is skipped when `overrideAccess`\n * is enabled.\n */\n access?: (args: MCPAccessArgs) => MaybePromise<boolean>\n annotations?: ToolAnnotations\n description: string\n handler: (args: ToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>\n input?: TSchema\n /**\n * Override the return value of the tool handler\n */\n overrideResponse?: MCPResponseOverride\n}\n\nexport type CollectionTool<\n TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined,\n> = {\n /**\n * Runs while authorizing each MCP request for this collection. Return `false` to reject calls\n * to this tool for the collection. The shared tool is not advertised when no collections allow\n * it, but can remain advertised when it is available for another collection. This is skipped\n * when `overrideAccess` is enabled.\n */\n access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>\n handler: (args: CollectionToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>\n input?: TSchema\n} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>\n\nexport type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> =\n {\n /**\n * Runs while authorizing each MCP request for this global. Return `false` to reject calls to\n * this tool for the global. The shared tool is not advertised when no globals allow it, but\n * can remain advertised when it is available for another global. This is skipped when\n * `overrideAccess` is enabled.\n */\n access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>\n handler: (args: GlobalToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>\n input?: TSchema\n } & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>\n\n/**\n * Configures (or disables) a built-in tool without replacing it.\n * `handler?: never` prevents a full `CollectionTool`/`GlobalTool` (which has a\n * required handler) from being silently accepted at a built-in key slot.\n */\nexport type MCPBuiltInCollectionToolOverride = {\n /**\n * Replaces the built-in tool's access check. Return `false` to make the tool unavailable for\n * this collection. This is skipped when `overrideAccess` is enabled.\n */\n access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>\n annotations?: ToolAnnotations\n description?: string\n handler?: never\n overrideResponse?: MCPResponseOverride\n}\n\nexport type MCPBuiltInGlobalToolOverride = {\n /**\n * Replaces the built-in tool's access check. Return `false` to make the tool unavailable for\n * this global. This is skipped when `overrideAccess` is enabled.\n */\n access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>\n annotations?: ToolAnnotations\n description?: string\n handler?: never\n overrideResponse?: MCPResponseOverride\n}\n\n/**\n * Value at a custom (non-built-in) tool key. Either the tool itself, or `false`\n * to disable it (useful when one plugin defines a custom tool and another\n * wants to opt out per-collection).\n */\nexport type MCPTopLevelToolEntry = Tool\n\nexport type MCPCollectionToolsMap = {\n [customToolName: string]: boolean | CollectionTool | MCPBuiltInCollectionToolOverride | undefined\n} & {\n [K in MCPCollectionBuiltinName]?: false | MCPBuiltInCollectionToolOverride\n}\n\nexport type MCPAuthCollectionToolsMap = {\n [K in MCPCollectionAuthToolName]?: MCPBuiltInCollectionToolOverride | true\n} & MCPCollectionToolsMap\n\n/** Auth-enabled collections get auth-tool name autocomplete; others get CRUD-only. */\nexport type MCPToolsMapForCollection<Slug extends CollectionSlug> = Slug extends AuthCollectionSlug\n ? MCPAuthCollectionToolsMap\n : MCPCollectionToolsMap\n\nexport type MCPGlobalToolsMap = {\n [customToolName: string]: boolean | GlobalTool | MCPBuiltInGlobalToolOverride | undefined\n} & {\n [K in MCPGlobalBuiltinName]?: false | MCPBuiltInGlobalToolOverride\n}\n\nexport type MCPTopLevelToolsMap = Record<string, Tool>\n\nexport type PromptHandlerArgs<TSchema = undefined> = {\n input: TypedInput<TSchema>\n req: PayloadRequest\n serverContext: ServerContext\n}\n\nexport type Prompt<TSchema extends ToolInputSchema = ToolInputSchema> = {\n /**\n * Runs while authorizing each MCP request, before the prompt is advertised or used. Return\n * `false` to make the prompt unavailable for that request. This is skipped when\n * `overrideAccess` is enabled.\n */\n access?: (args: MCPAccessArgs) => MaybePromise<boolean>\n argsSchema: TSchema\n description: string\n handler: (args: PromptHandlerArgs<TSchema>) => MaybePromise<{\n messages: Array<{ content: { text: string; type: 'text' }; role: 'assistant' | 'user' }>\n }>\n title: string\n}\n\nexport type ResourceHandlerArgs = {\n /** Variables extracted from a `ResourceTemplate` URI. Empty for static-URI resources. */\n params: Record<string, string>\n req: PayloadRequest\n serverContext: ServerContext\n uri: URL\n}\n\nexport type Resource = {\n /**\n * Runs while authorizing each MCP request, before the resource is advertised or read. Return\n * `false` to make the resource unavailable for that request. This is skipped when\n * `overrideAccess` is enabled.\n */\n access?: (args: MCPAccessArgs) => MaybePromise<boolean>\n description: string\n handler: (args: ResourceHandlerArgs) => MaybePromise<{\n contents: Array<{ text: string; uri: string }>\n }>\n mimeType: string\n title: string\n uri: ResourceTemplate | string\n}\n\nexport type MCPPluginCollectionConfig<TSlug extends CollectionSlug> = {\n description?: string\n /** Fallback for built-in tools that don't set their own `overrideResponse`. */\n overrideResponse?: MCPResponseOverride\n tools?: MCPToolsMapForCollection<TSlug>\n}\n\nexport type MCPPluginGlobalConfig = {\n description?: string\n overrideResponse?: MCPResponseOverride\n tools?: MCPGlobalToolsMap\n}\n\n/**\n * The user-facing config shape passed to `mcpPlugin({ ... })`. Tools, prompts,\n * resources, and per-collection/global tool maps live in their own nested\n * fields. `sanitizeMCPConfig` flattens those into `items` and applies defaults\n * to produce a `SanitizedMCPPluginConfig` — the form every internal consumer\n * actually works with.\n */\nexport type MCPPluginConfig = {\n collections?: {\n [Slug in CollectionSlug]?: MCPPluginCollectionConfig<Slug>\n }\n /** Skip MCP endpoint registration. */\n disabled?: boolean\n globals?: {\n [Slug in GlobalSlug]?: MCPPluginGlobalConfig\n }\n hooks?: {\n /** Transform a tool response after its handler returns */\n afterToolCall?: MCPAfterToolCallHook[]\n }\n mcp?: {\n serverOptions?: MCPServerOptions\n verboseLogs?: boolean\n }\n /**\n * Replace the default MCP authorization resolver.\n *\n * This hook replaces the default authentication flow. It must set `req.user` to the\n * authenticated Payload user, or to `null` for an anonymous caller, before returning.\n */\n overrideGetAuthorizedMCP?: (\n args: {\n pluginConfig: SanitizedMCPPluginConfig\n } & GetAuthorizedMCPArgs,\n ) => MaybePromise<AuthorizedMCP>\n prompts?: Record<string, Prompt>\n resources?: Record<string, Resource>\n /** Cross-cutting tools (not scoped to any collection or global). */\n tools?: MCPTopLevelToolsMap\n}\n\nexport type SanitizedMCPPluginConfig = {\n items: MCPItem[]\n} & Pick<MCPPluginConfig, 'disabled' | 'hooks' | 'mcp' | 'overrideGetAuthorizedMCP'>\n\nexport type MCPServerOptions = {\n options?: ConstructorParameters<typeof McpServer>[1]\n serverInfo?: Partial<ConstructorParameters<typeof McpServer>[0]>\n}\n\n/**\n * One MCP primitive plus the metadata needed for config-driven filtering and\n * registration.\n *\n * - `configKey`: the config identifier, e.g. `find` or `echo`.\n * - `mcpName`: the MCP wire name, e.g. `findDocuments` or `echo`.\n * - `label`: human-readable display text.\n */\nexport type MCPItemBase = {\n configKey: string\n label: string\n mcpName: string\n}\n\nexport type CollectionMCPItem = {\n collectionSlug: CollectionSlug\n tool: CollectionTool\n type: 'collectionTool'\n} & MCPItemBase\n\nexport type GlobalMCPItem = {\n globalSlug: GlobalSlug\n tool: GlobalTool\n type: 'globalTool'\n} & MCPItemBase\n\nexport type MCPItem =\n | ({\n prompt: Prompt\n type: 'prompt'\n } & MCPItemBase)\n | ({\n resource: Resource\n type: 'resource'\n } & MCPItemBase)\n | ({\n tool: Tool\n type: 'tool'\n } & MCPItemBase)\n | CollectionMCPItem\n | GlobalMCPItem\n\n/**\n * The MCP items and access mode authorized for this request. The authenticated user is available\n * as `req.user`.\n */\nexport type AuthorizedMCP = {\n items: MCPItem[]\n overrideAccess: boolean\n}\n"],"names":[],"mappings":"AAgWA;;;CAGC,GACD,WAGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-mcp",
3
- "version": "4.0.0-internal.567a487",
3
+ "version": "4.0.0-internal.5a4aa81",
4
4
  "description": "MCP (Model Context Protocol) capabilities with Payload",
5
5
  "keywords": [
6
6
  "plugin",
@@ -56,18 +56,16 @@
56
56
  ],
57
57
  "dependencies": {
58
58
  "@modelcontextprotocol/server": "2.0.0",
59
- "tsx": "4.22.4",
60
- "zod": "^4.2.0"
59
+ "tsx": "4.22.4"
61
60
  },
62
61
  "devDependencies": {
63
62
  "@payloadcms/eslint-config": "3.28.0",
64
- "payload": "4.0.0-internal.567a487"
63
+ "payload": "4.0.0-internal.5a4aa81"
65
64
  },
66
65
  "peerDependencies": {
67
- "payload": "4.0.0-internal.567a487"
66
+ "payload": "4.0.0-internal.5a4aa81"
68
67
  },
69
68
  "//deps_notes": {
70
- "zod": "zod is a hard dependency of @modelcontextprotocol/server, thus we can safely use it without it impacting bundle size. Make extra sure the zod version here matches exactly what's defined in the dependencies of @modelcontextprotocol/server to avoid duplicate versions being installed.",
71
69
  "tsx": "Required by the `bin.js` stdio mcp. Keep the version pinned to whatever `payload` ships to avoid duplicate installs."
72
70
  },
73
71
  "homepage:": "https://payloadcms.com",
@@ -95,12 +95,11 @@ const checkItemAccess = async ({
95
95
  case 'collectionTool':
96
96
  return (
97
97
  !item.tool.access ||
98
- (await item.tool.access({ collectionSlug: item.collectionSlug, permissions, req }))
98
+ (await item.tool.access({ slug: item.collectionSlug, permissions, req }))
99
99
  )
100
100
  case 'globalTool':
101
101
  return (
102
- !item.tool.access ||
103
- (await item.tool.access({ globalSlug: item.globalSlug, permissions, req }))
102
+ !item.tool.access || (await item.tool.access({ slug: item.globalSlug, permissions, req }))
104
103
  )
105
104
  case 'prompt':
106
105
  return !item.prompt.access || (await item.prompt.access({ permissions, req }))