@govcraft/payload-cms-mcp 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -0
- package/dist/config/index.d.ts +27 -0
- package/dist/config/index.js +31 -0
- package/dist/config/index.js.map +1 -0
- package/dist/controllers/mcp.controller.d.ts +7 -0
- package/dist/controllers/mcp.controller.js +328 -0
- package/dist/controllers/mcp.controller.js.map +1 -0
- package/dist/controllers/payload-mcp.controller.d.ts +4 -0
- package/dist/controllers/payload-mcp.controller.js +185 -0
- package/dist/controllers/payload-mcp.controller.js.map +1 -0
- package/dist/generate-tools.d.ts +1 -0
- package/dist/generate-tools.js +1417 -0
- package/dist/generate-tools.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/anthropic-mcp.d.ts +3 -0
- package/dist/mcp/anthropic-mcp.js +332 -0
- package/dist/mcp/anthropic-mcp.js.map +1 -0
- package/dist/mcp/generated/index.d.ts +44 -0
- package/dist/mcp/generated/index.js +45 -0
- package/dist/mcp/generated/index.js.map +1 -0
- package/dist/mcp/generated/payload-tools.d.ts +7 -0
- package/dist/mcp/generated/payload-tools.js +69 -0
- package/dist/mcp/generated/payload-tools.js.map +1 -0
- package/dist/mcp/generated/payload-tools.json +13024 -0
- package/dist/mcp/generated/tools/create.json +9138 -0
- package/dist/mcp/generated/tools/createAccess.json +10 -0
- package/dist/mcp/generated/tools/createAfterChangeHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterDeleteHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterErrorHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterForgotPasswordHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterLoginHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterLogoutHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterMeHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterOperationHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterReadHook.json +9 -0
- package/dist/mcp/generated/tools/createAfterRefreshHook.json +9 -0
- package/dist/mcp/generated/tools/createArrayField.json +90 -0
- package/dist/mcp/generated/tools/createBeforeChangeHook.json +9 -0
- package/dist/mcp/generated/tools/createBeforeDeleteHook.json +9 -0
- package/dist/mcp/generated/tools/createBeforeLoginHook.json +9 -0
- package/dist/mcp/generated/tools/createBeforeOperationHook.json +9 -0
- package/dist/mcp/generated/tools/createBeforeReadHook.json +9 -0
- package/dist/mcp/generated/tools/createBeforeValidateHook.json +9 -0
- package/dist/mcp/generated/tools/createBlocksField.json +79 -0
- package/dist/mcp/generated/tools/createCodeField.json +79 -0
- package/dist/mcp/generated/tools/createCollection.json +422 -0
- package/dist/mcp/generated/tools/createCollectionAdminOptions.json +2789 -0
- package/dist/mcp/generated/tools/createDateField.json +84 -0
- package/dist/mcp/generated/tools/createEmailField.json +87 -0
- package/dist/mcp/generated/tools/createField.json +31 -0
- package/dist/mcp/generated/tools/createGlobal.json +220 -0
- package/dist/mcp/generated/tools/createGroupField.json +79 -0
- package/dist/mcp/generated/tools/createJSONField.json +79 -0
- package/dist/mcp/generated/tools/createJoinField.json +79 -0
- package/dist/mcp/generated/tools/createMeHook.json +9 -0
- package/dist/mcp/generated/tools/createNumberField.json +31 -0
- package/dist/mcp/generated/tools/createPointField.json +79 -0
- package/dist/mcp/generated/tools/createPolymorphicRelationshipField.json +31 -0
- package/dist/mcp/generated/tools/createRadioField.json +94 -0
- package/dist/mcp/generated/tools/createRefreshHook.json +9 -0
- package/dist/mcp/generated/tools/createRelationshipField.json +31 -0
- package/dist/mcp/generated/tools/createRichTextField.json +79 -0
- package/dist/mcp/generated/tools/createSelectField.json +31 -0
- package/dist/mcp/generated/tools/createSingleRelationshipField.json +31 -0
- package/dist/mcp/generated/tools/createTextField.json +31 -0
- package/dist/mcp/generated/tools/createTextareaField.json +87 -0
- package/dist/mcp/generated/tools/createUploadField.json +31 -0
- package/dist/mcp/handler.d.ts +6 -0
- package/dist/mcp/handler.js +147 -0
- package/dist/mcp/handler.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +28 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/io/index.d.ts +2 -0
- package/dist/mcp/io/index.js +31 -0
- package/dist/mcp/io/index.js.map +1 -0
- package/dist/mcp/io/stdin.d.ts +2 -0
- package/dist/mcp/io/stdin.js +118 -0
- package/dist/mcp/io/stdin.js.map +1 -0
- package/dist/mcp/session.d.ts +16 -0
- package/dist/mcp/session.js +85 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/sse.d.ts +10 -0
- package/dist/mcp/sse.js +86 -0
- package/dist/mcp/sse.js.map +1 -0
- package/dist/mcp/tools/calculator.d.ts +2 -0
- package/dist/mcp/tools/calculator.js +68 -0
- package/dist/mcp/tools/calculator.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +3 -0
- package/dist/mcp/tools/index.js +6 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/list-tools.d.ts +2 -0
- package/dist/mcp/tools/list-tools.js +47 -0
- package/dist/mcp/tools/list-tools.js.map +1 -0
- package/dist/mcp/tools/payload-tools-loader.d.ts +2 -0
- package/dist/mcp/tools/payload-tools-loader.js +21 -0
- package/dist/mcp/tools/payload-tools-loader.js.map +1 -0
- package/dist/mcp/types.d.ts +69 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/middleware/errorHandler.d.ts +14 -0
- package/dist/middleware/errorHandler.js +25 -0
- package/dist/middleware/errorHandler.js.map +1 -0
- package/dist/middleware/notFoundHandler.d.ts +2 -0
- package/dist/middleware/notFoundHandler.js +8 -0
- package/dist/middleware/notFoundHandler.js.map +1 -0
- package/dist/routes/health.d.ts +2 -0
- package/dist/routes/health.js +18 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/mcp.d.ts +2 -0
- package/dist/routes/mcp.js +11 -0
- package/dist/routes/mcp.js.map +1 -0
- package/dist/routes/payload-mcp.routes.d.ts +3 -0
- package/dist/routes/payload-mcp.routes.js +8 -0
- package/dist/routes/payload-mcp.routes.js.map +1 -0
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.js +35 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createNumberField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 NumberField configuration\n\nExample:\n```typescript\n{\n name: 'price',\n type: 'number',\n required: true,\n label: 'Product Price',\n min: 0,\n max: 1000,\n // Custom validation example\n validate: (value) => {\n if (value && value % 1 !== 0) {\n return 'Price must be a whole number';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the field"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The type of field"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The label shown in the admin UI"
|
|
18
|
+
},
|
|
19
|
+
"required": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Whether this field is required"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"name",
|
|
26
|
+
"type"
|
|
27
|
+
],
|
|
28
|
+
"description": "Field configuration"
|
|
29
|
+
},
|
|
30
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'number',\n label: 'Number Field', // Label shown in the admin UI\n required: true,\n min: 0,\n max: 100,\n // Optional: Add custom validation\n validate: (value) => {\n if (value && value % 1 !== 0) {\n return 'Please enter a whole number';\n }\n return true; // Return true if valid\n },\n // Optional: Admin UI configuration\n admin: {\n description: 'Enter a numeric value',\n width: '25%'\n }\n}"
|
|
31
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createPointField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 PointField configuration\n\nExample:\n```typescript\n{\n name: 'pointField',\n type: 'point',\n required: true,\n label: 'Point Field',\n // Custom validation example\n validate: (value, { siblingData, operation }) => {\n // Validation logic based on the value, sibling data, or operation\n if (operation === 'create' && !value) {\n return 'This field is required for new records';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "Numeric value",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the field, used as the property name in the database"
|
|
11
|
+
},
|
|
12
|
+
"type": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": [
|
|
15
|
+
"point"
|
|
16
|
+
],
|
|
17
|
+
"description": "The type of field"
|
|
18
|
+
},
|
|
19
|
+
"label": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "The label shown in the admin UI"
|
|
22
|
+
},
|
|
23
|
+
"required": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"description": "Whether this field is required"
|
|
26
|
+
},
|
|
27
|
+
"admin": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "Admin panel configuration for this field",
|
|
30
|
+
"properties": {
|
|
31
|
+
"description": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Additional description shown in the admin UI"
|
|
34
|
+
},
|
|
35
|
+
"position": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": [
|
|
38
|
+
"sidebar"
|
|
39
|
+
],
|
|
40
|
+
"description": "Position of the field in the admin UI"
|
|
41
|
+
},
|
|
42
|
+
"width": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Width of the field in the admin UI"
|
|
45
|
+
},
|
|
46
|
+
"style": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"description": "Custom CSS styles for the field"
|
|
49
|
+
},
|
|
50
|
+
"className": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "CSS class name for the field"
|
|
53
|
+
},
|
|
54
|
+
"readOnly": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Whether the field is read-only in the admin UI"
|
|
57
|
+
},
|
|
58
|
+
"hidden": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"description": "Whether the field is hidden in the admin UI"
|
|
61
|
+
},
|
|
62
|
+
"condition": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Condition for showing/hiding the field"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"validate": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Custom validation function that returns true if valid or an error message string if invalid"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"required": [
|
|
74
|
+
"name",
|
|
75
|
+
"type"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'point',\n label: 'Point Field', // Label shown in the admin UI\n required: true,\n // Add field-specific properties here\n \n // Optional: Add custom validation\n validate: (value, { siblingData, operation }) => {\n // Custom validation logic based on the value, sibling data, or operation\n if (!value && operation === 'create') {\n return 'This field is required for new records';\n }\n return true; // Return true if valid\n },\n ...{rest}\n}"
|
|
79
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createPolymorphicRelationshipField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 PolymorphicRelationshipField configuration\n\nExample:\n```typescript\n{\n name: 'polymorphicrelationshipField',\n type: 'polymorphicrelationship',\n required: true,\n label: 'Polymorphicrelationship Field',\n // Custom validation example\n validate: (value, { siblingData, operation }) => {\n // Validation logic based on the value, sibling data, or operation\n if (operation === 'create' && !value) {\n return 'This field is required for new records';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the field"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The type of field"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The label shown in the admin UI"
|
|
18
|
+
},
|
|
19
|
+
"required": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Whether this field is required"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"name",
|
|
26
|
+
"type"
|
|
27
|
+
],
|
|
28
|
+
"description": "Field configuration"
|
|
29
|
+
},
|
|
30
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'relationship',\n label: 'Relationship Field', // Label shown in the admin UI\n required: true,\n relationTo: 'collection-name', // Replace with your collection slug\n hasMany: false, // Set to true for multiple relationships\n // Optional: Admin UI configuration\n admin: {\n description: 'Select a related document'\n }\n}"
|
|
31
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createRadioField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 RadioField configuration\n\nExample:\n```typescript\n{\n name: 'radioField',\n type: 'radio',\n required: true,\n label: 'Radio Field',\n // Custom validation example\n validate: (value, { siblingData, operation }) => {\n // Validation logic based on the value, sibling data, or operation\n if (operation === 'create' && !value) {\n return 'This field is required for new records';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "Payload.RadioField configuration object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the field, used as the property name in the database"
|
|
11
|
+
},
|
|
12
|
+
"type": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": [
|
|
15
|
+
"radio"
|
|
16
|
+
],
|
|
17
|
+
"description": "The type of field"
|
|
18
|
+
},
|
|
19
|
+
"label": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "The label shown in the admin UI"
|
|
22
|
+
},
|
|
23
|
+
"required": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"description": "Whether this field is required"
|
|
26
|
+
},
|
|
27
|
+
"admin": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "Admin panel configuration for this field",
|
|
30
|
+
"properties": {
|
|
31
|
+
"description": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Additional description shown in the admin UI"
|
|
34
|
+
},
|
|
35
|
+
"position": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": [
|
|
38
|
+
"sidebar"
|
|
39
|
+
],
|
|
40
|
+
"description": "Position of the field in the admin UI"
|
|
41
|
+
},
|
|
42
|
+
"width": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Width of the field in the admin UI"
|
|
45
|
+
},
|
|
46
|
+
"style": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"description": "Custom CSS styles for the field"
|
|
49
|
+
},
|
|
50
|
+
"className": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "CSS class name for the field"
|
|
53
|
+
},
|
|
54
|
+
"readOnly": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Whether the field is read-only in the admin UI"
|
|
57
|
+
},
|
|
58
|
+
"hidden": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"description": "Whether the field is hidden in the admin UI"
|
|
61
|
+
},
|
|
62
|
+
"condition": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Condition for showing/hiding the field"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"options": {
|
|
69
|
+
"type": "array",
|
|
70
|
+
"items": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"properties": {
|
|
73
|
+
"label": {
|
|
74
|
+
"type": "string"
|
|
75
|
+
},
|
|
76
|
+
"value": {
|
|
77
|
+
"type": "string"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"description": "Options for the select/radio field"
|
|
82
|
+
},
|
|
83
|
+
"validate": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"description": "Custom validation function that returns true if valid or an error message string if invalid"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"required": [
|
|
89
|
+
"name",
|
|
90
|
+
"type"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'radio',\n label: 'Radio Field', // Label shown in the admin UI\n required: true,\n options: [\n {\n label: 'Option One',\n value: 'option-one',\n },\n {\n label: 'Option Two',\n value: 'option-two',\n },\n ],\n defaultValue: 'option-one',\n // Optional: Add custom validation\n validate: (value) => {\n // Custom validation logic\n return true; // Return true if valid\n },\n}"
|
|
94
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createRefreshHook",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 RefreshHook configuration",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {}
|
|
7
|
+
},
|
|
8
|
+
"template": "/**\n * Generic Payload CMS hook\n * See documentation for specific hook parameters\n */\nconst hook = (args) => {\n // Extract relevant properties from args based on hook type\n const { req } = args;\n \n // Example: Log hook execution\n logger.info('Hook executed');\n \n // For hooks that modify data, return the modified data\n // For other hooks, return as appropriate for the hook type\n return args.data ? { ...args.data, modified: true } : undefined;\n};"
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createRelationshipField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 RelationshipField configuration\n\nExample:\n```typescript\n{\n name: 'author',\n type: 'relationship',\n relationTo: 'users',\n hasMany: false,\n required: true,\n // Custom validation example\n validate: async (value, { req }) => {\n // Check if the related document exists and is published\n if (value) {\n const relatedDoc = await req.payload.findByID({\n collection: 'users',\n id: value,\n });\n \n if (!relatedDoc) {\n return 'Selected user does not exist';\n }\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the field"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The type of field"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The label shown in the admin UI"
|
|
18
|
+
},
|
|
19
|
+
"required": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Whether this field is required"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"name",
|
|
26
|
+
"type"
|
|
27
|
+
],
|
|
28
|
+
"description": "Field configuration"
|
|
29
|
+
},
|
|
30
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'relationship',\n label: 'Relationship Field', // Label shown in the admin UI\n required: true,\n relationTo: 'collection-name', // Replace with your collection slug\n hasMany: false, // Set to true for multiple relationships\n // Optional: Admin UI configuration\n admin: {\n description: 'Select a related document'\n }\n}"
|
|
31
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createRichTextField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 RichTextField configuration\n\nExample:\n```typescript\n{\n name: 'richtextField',\n type: 'richtext',\n required: true,\n label: 'Richtext Field',\n // Custom validation example\n validate: (value, { siblingData, operation }) => {\n // Validation logic based on the value, sibling data, or operation\n if (operation === 'create' && !value) {\n return 'This field is required for new records';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "Payload.RichTextField configuration object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the field, used as the property name in the database"
|
|
11
|
+
},
|
|
12
|
+
"type": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": [
|
|
15
|
+
"richtext"
|
|
16
|
+
],
|
|
17
|
+
"description": "The type of field"
|
|
18
|
+
},
|
|
19
|
+
"label": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "The label shown in the admin UI"
|
|
22
|
+
},
|
|
23
|
+
"required": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"description": "Whether this field is required"
|
|
26
|
+
},
|
|
27
|
+
"admin": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "Admin panel configuration for this field",
|
|
30
|
+
"properties": {
|
|
31
|
+
"description": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Additional description shown in the admin UI"
|
|
34
|
+
},
|
|
35
|
+
"position": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": [
|
|
38
|
+
"sidebar"
|
|
39
|
+
],
|
|
40
|
+
"description": "Position of the field in the admin UI"
|
|
41
|
+
},
|
|
42
|
+
"width": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Width of the field in the admin UI"
|
|
45
|
+
},
|
|
46
|
+
"style": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"description": "Custom CSS styles for the field"
|
|
49
|
+
},
|
|
50
|
+
"className": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "CSS class name for the field"
|
|
53
|
+
},
|
|
54
|
+
"readOnly": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Whether the field is read-only in the admin UI"
|
|
57
|
+
},
|
|
58
|
+
"hidden": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"description": "Whether the field is hidden in the admin UI"
|
|
61
|
+
},
|
|
62
|
+
"condition": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Condition for showing/hiding the field"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"validate": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Custom validation function that returns true if valid or an error message string if invalid"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"required": [
|
|
74
|
+
"name",
|
|
75
|
+
"type"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'richText',\n label: 'Rich Text Field', // Label shown in the admin UI\n required: true,\n admin: {\n elements: ['h2', 'h3', 'link', 'ol', 'ul', 'indent'],\n leaves: ['bold', 'italic', 'underline'],\n },\n // Optional: Add custom validation\n validate: (value) => {\n if (value && JSON.stringify(value).length < 20) {\n return 'Please enter more content';\n }\n return true; // Return true if valid\n },\n}"
|
|
79
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createSelectField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 SelectField configuration\n\nExample:\n```typescript\n{\n name: 'status',\n type: 'select',\n required: true,\n label: 'Status',\n options: [\n { label: 'Draft', value: 'draft' },\n { label: 'Published', value: 'published' },\n { label: 'Archived', value: 'archived' }\n ],\n defaultValue: 'draft',\n // Custom validation example\n validate: (value, { siblingData }) => {\n if (value === 'published' && !siblingData.publishedAt) {\n return 'Cannot set status to published without a publish date';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the field"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The type of field"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The label shown in the admin UI"
|
|
18
|
+
},
|
|
19
|
+
"required": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Whether this field is required"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"name",
|
|
26
|
+
"type"
|
|
27
|
+
],
|
|
28
|
+
"description": "Field configuration"
|
|
29
|
+
},
|
|
30
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'select',\n label: 'Select Field', // Label shown in the admin UI\n required: true,\n options: [\n { label: 'Option 1', value: 'option1' },\n { label: 'Option 2', value: 'option2' },\n { label: 'Option 3', value: 'option3' }\n ],\n // Optional: Admin UI configuration\n admin: {\n description: 'Select one option from the list'\n }\n}"
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createSingleRelationshipField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 SingleRelationshipField configuration\n\nExample:\n```typescript\n{\n name: 'singlerelationshipField',\n type: 'singlerelationship',\n required: true,\n label: 'Singlerelationship Field',\n // Custom validation example\n validate: (value, { siblingData, operation }) => {\n // Validation logic based on the value, sibling data, or operation\n if (operation === 'create' && !value) {\n return 'This field is required for new records';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the field"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The type of field"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The label shown in the admin UI"
|
|
18
|
+
},
|
|
19
|
+
"required": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Whether this field is required"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"name",
|
|
26
|
+
"type"
|
|
27
|
+
],
|
|
28
|
+
"description": "Field configuration"
|
|
29
|
+
},
|
|
30
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'relationship',\n label: 'Relationship Field', // Label shown in the admin UI\n required: true,\n relationTo: 'collection-name', // Replace with your collection slug\n hasMany: false, // Set to true for multiple relationships\n // Optional: Admin UI configuration\n admin: {\n description: 'Select a related document'\n }\n}"
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createTextField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 TextField configuration\n\nExample:\n```typescript\n{\n name: 'title',\n type: 'text',\n required: true,\n label: 'Post Title',\n minLength: 10,\n maxLength: 100,\n // Custom validation example\n validate: (value, { siblingData }) => {\n if (value && value.toLowerCase().includes('forbidden')) {\n return 'Title cannot contain the word \"forbidden\"';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the field"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The type of field"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The label shown in the admin UI"
|
|
18
|
+
},
|
|
19
|
+
"required": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Whether this field is required"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"name",
|
|
26
|
+
"type"
|
|
27
|
+
],
|
|
28
|
+
"description": "Field configuration"
|
|
29
|
+
},
|
|
30
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'text',\n label: 'Text Field', // Label shown in the admin UI\n required: true,\n minLength: 2,\n maxLength: 100,\n // Optional: Add custom validation\n validate: (value, { siblingData }) => {\n if (value && value.toLowerCase().includes('forbidden')) {\n return 'This field cannot contain the word \"forbidden\"';\n }\n return true; // Return true if valid\n },\n // Optional: Admin UI configuration\n admin: {\n description: 'Enter text content here',\n position: 'sidebar',\n width: '50%',\n readOnly: false,\n hidden: false\n }\n}"
|
|
31
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createTextareaField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 TextareaField configuration\n\nExample:\n```typescript\n{\n name: 'textareaField',\n type: 'textarea',\n required: true,\n label: 'Textarea Field',\n // Custom validation example\n validate: (value, { siblingData, operation }) => {\n // Validation logic based on the value, sibling data, or operation\n if (operation === 'create' && !value) {\n return 'This field is required for new records';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "Payload.TextareaField configuration object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the field, used as the property name in the database"
|
|
11
|
+
},
|
|
12
|
+
"type": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": [
|
|
15
|
+
"textarea"
|
|
16
|
+
],
|
|
17
|
+
"description": "The type of field"
|
|
18
|
+
},
|
|
19
|
+
"label": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "The label shown in the admin UI"
|
|
22
|
+
},
|
|
23
|
+
"required": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"description": "Whether this field is required"
|
|
26
|
+
},
|
|
27
|
+
"admin": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "Admin panel configuration for this field",
|
|
30
|
+
"properties": {
|
|
31
|
+
"description": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Additional description shown in the admin UI"
|
|
34
|
+
},
|
|
35
|
+
"position": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": [
|
|
38
|
+
"sidebar"
|
|
39
|
+
],
|
|
40
|
+
"description": "Position of the field in the admin UI"
|
|
41
|
+
},
|
|
42
|
+
"width": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Width of the field in the admin UI"
|
|
45
|
+
},
|
|
46
|
+
"style": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"description": "Custom CSS styles for the field"
|
|
49
|
+
},
|
|
50
|
+
"className": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "CSS class name for the field"
|
|
53
|
+
},
|
|
54
|
+
"readOnly": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Whether the field is read-only in the admin UI"
|
|
57
|
+
},
|
|
58
|
+
"hidden": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"description": "Whether the field is hidden in the admin UI"
|
|
61
|
+
},
|
|
62
|
+
"condition": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Condition for showing/hiding the field"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"minLength": {
|
|
69
|
+
"type": "number",
|
|
70
|
+
"description": "Minimum length of the text"
|
|
71
|
+
},
|
|
72
|
+
"maxLength": {
|
|
73
|
+
"type": "number",
|
|
74
|
+
"description": "Maximum length of the text"
|
|
75
|
+
},
|
|
76
|
+
"validate": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "Custom validation function that returns true if valid or an error message string if invalid"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": [
|
|
82
|
+
"name",
|
|
83
|
+
"type"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'textarea',\n label: 'Textarea Field', // Label shown in the admin UI\n required: true,\n minLength: 2,\n maxLength: 500,\n // Optional: Admin UI configuration\n admin: {\n description: 'Enter longer text content here'\n }\n}"
|
|
87
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "createUploadField",
|
|
3
|
+
"description": "Creates a Payload CMS 3.0 UploadField configuration\n\nExample:\n```typescript\n{\n name: 'uploadField',\n type: 'upload',\n required: true,\n label: 'Upload Field',\n // Custom validation example\n validate: (value, { siblingData, operation }) => {\n // Validation logic based on the value, sibling data, or operation\n if (operation === 'create' && !value) {\n return 'This field is required for new records';\n }\n return true;\n }\n}\n```",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the field"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The type of field"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The label shown in the admin UI"
|
|
18
|
+
},
|
|
19
|
+
"required": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Whether this field is required"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"name",
|
|
26
|
+
"type"
|
|
27
|
+
],
|
|
28
|
+
"description": "Field configuration"
|
|
29
|
+
},
|
|
30
|
+
"template": "{\n name: '{name}', // Database field name\n type: 'upload',\n label: 'Upload Field', // Label shown in the admin UI\n relationTo: 'media', // The collection to upload to\n required: true,\n // Optional: Add custom validation\n validate: (value) => {\n if (!value) {\n return 'Please upload a file';\n }\n return true; // Return true if valid\n },\n}"
|
|
31
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MCPRequest, MCPResponse, MCPError, MCPToolCall, MCPToolResult, MCPTool } from './types.js';
|
|
2
|
+
export declare function processRequest(request: MCPRequest, sessionId?: string): Promise<MCPResponse | MCPError>;
|
|
3
|
+
export declare function registerTool(tool: MCPTool): void;
|
|
4
|
+
export declare function executeTool(toolCall: MCPToolCall, sessionId: string): Promise<MCPToolResult | MCPError>;
|
|
5
|
+
export declare function getAvailableTools(): MCPTool[];
|
|
6
|
+
export declare function validateMessage(message: unknown): boolean;
|