@vibetools/dokploy-mcp 0.5.0 → 1.2.0

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 (55) hide show
  1. package/README.md +39 -13
  2. package/dist/api/client.d.ts +2 -0
  3. package/dist/api/client.js +51 -16
  4. package/dist/config/resolver.js +33 -50
  5. package/dist/server.js +1 -1
  6. package/dist/tools/_database.d.ts +12 -0
  7. package/dist/tools/_database.js +115 -0
  8. package/dist/tools/_factory.d.ts +3 -1
  9. package/dist/tools/_factory.js +36 -17
  10. package/dist/tools/application.js +219 -82
  11. package/dist/tools/backup.js +30 -0
  12. package/dist/tools/compose.js +273 -35
  13. package/dist/tools/deployment.js +82 -2
  14. package/dist/tools/docker.js +62 -2
  15. package/dist/tools/domain.js +15 -2
  16. package/dist/tools/environment.d.ts +2 -0
  17. package/dist/tools/environment.js +104 -0
  18. package/dist/tools/git-provider.d.ts +2 -0
  19. package/dist/tools/git-provider.js +22 -0
  20. package/dist/tools/github.d.ts +2 -0
  21. package/dist/tools/github.js +66 -0
  22. package/dist/tools/gitlab.d.ts +2 -0
  23. package/dist/tools/gitlab.js +98 -0
  24. package/dist/tools/index.js +24 -0
  25. package/dist/tools/mariadb.d.ts +1 -2
  26. package/dist/tools/mariadb.js +9 -165
  27. package/dist/tools/mongo.d.ts +1 -2
  28. package/dist/tools/mongo.js +9 -164
  29. package/dist/tools/mounts.js +53 -9
  30. package/dist/tools/mysql.d.ts +1 -2
  31. package/dist/tools/mysql.js +9 -165
  32. package/dist/tools/notification.d.ts +2 -0
  33. package/dist/tools/notification.js +559 -0
  34. package/dist/tools/patch.d.ts +2 -0
  35. package/dist/tools/patch.js +179 -0
  36. package/dist/tools/postgres.d.ts +1 -2
  37. package/dist/tools/postgres.js +8 -164
  38. package/dist/tools/preview-deployment.d.ts +2 -0
  39. package/dist/tools/preview-deployment.js +50 -0
  40. package/dist/tools/project.js +32 -1
  41. package/dist/tools/redis.d.ts +1 -2
  42. package/dist/tools/redis.js +8 -164
  43. package/dist/tools/rollback.d.ts +2 -0
  44. package/dist/tools/rollback.js +28 -0
  45. package/dist/tools/schedule.d.ts +2 -0
  46. package/dist/tools/schedule.js +92 -0
  47. package/dist/tools/server.d.ts +2 -0
  48. package/dist/tools/server.js +192 -0
  49. package/dist/tools/settings.js +251 -0
  50. package/dist/tools/ssh-key.d.ts +2 -0
  51. package/dist/tools/ssh-key.js +74 -0
  52. package/dist/tools/user.js +75 -2
  53. package/dist/tools/volume-backups.d.ts +2 -0
  54. package/dist/tools/volume-backups.js +96 -0
  55. package/package.json +7 -2
@@ -0,0 +1,179 @@
1
+ import { z } from 'zod';
2
+ import { getTool, postTool } from './_factory.js';
3
+ const entityTypeSchema = z.enum(['application', 'compose']).describe('Entity type');
4
+ const patchTypeSchema = z.enum(['create', 'update', 'delete']).describe('Patch type');
5
+ const savePatchTypeSchema = z.enum(['create', 'update']).default('update').describe('Patch type');
6
+ const nullableString = z.string().nullable().optional();
7
+ const create = postTool({
8
+ name: 'dokploy_patch_create',
9
+ title: 'Create Patch',
10
+ description: 'Create a new patch record in Dokploy. Requires the file path and file content. Optionally associate the patch with an application or compose service.',
11
+ schema: z
12
+ .object({
13
+ filePath: z.string().min(1).describe('File path inside the repository'),
14
+ content: z.string().describe('File content'),
15
+ type: patchTypeSchema.optional(),
16
+ enabled: z.boolean().optional().describe('Whether the patch is enabled'),
17
+ applicationId: nullableString.describe('Application ID'),
18
+ composeId: nullableString.describe('Compose ID'),
19
+ })
20
+ .strict(),
21
+ endpoint: '/patch.create',
22
+ });
23
+ const one = getTool({
24
+ name: 'dokploy_patch_one',
25
+ title: 'Get Patch',
26
+ description: 'Retrieve a patch record by its ID.',
27
+ schema: z
28
+ .object({
29
+ patchId: z.string().min(1).describe('Patch ID'),
30
+ })
31
+ .strict(),
32
+ endpoint: '/patch.one',
33
+ });
34
+ const byEntityId = getTool({
35
+ name: 'dokploy_patch_by_entity_id',
36
+ title: 'List Patches by Entity',
37
+ description: 'List patches associated with a Dokploy application or compose service. Requires the entity ID and entity type.',
38
+ schema: z
39
+ .object({
40
+ id: z.string().describe('Entity ID'),
41
+ type: entityTypeSchema,
42
+ })
43
+ .strict(),
44
+ endpoint: '/patch.byEntityId',
45
+ });
46
+ const update = postTool({
47
+ name: 'dokploy_patch_update',
48
+ title: 'Update Patch',
49
+ description: 'Update an existing patch record in Dokploy. Requires the patch ID and optionally accepts updated type, file path, content, enablement state, and timestamps.',
50
+ schema: z
51
+ .object({
52
+ patchId: z.string().min(1).describe('Patch ID'),
53
+ type: patchTypeSchema.optional(),
54
+ filePath: z.string().min(1).optional().describe('File path inside the repository'),
55
+ enabled: z.boolean().optional().describe('Whether the patch is enabled'),
56
+ content: z.string().optional().describe('File content'),
57
+ createdAt: z.string().optional().describe('Creation timestamp'),
58
+ updatedAt: nullableString.describe('Update timestamp'),
59
+ })
60
+ .strict(),
61
+ endpoint: '/patch.update',
62
+ });
63
+ const remove = postTool({
64
+ name: 'dokploy_patch_delete',
65
+ title: 'Delete Patch',
66
+ description: 'Delete a patch record from Dokploy. Requires the patch ID. This is a destructive action.',
67
+ schema: z
68
+ .object({
69
+ patchId: z.string().min(1).describe('Patch ID'),
70
+ })
71
+ .strict(),
72
+ endpoint: '/patch.delete',
73
+ annotations: { destructiveHint: true },
74
+ });
75
+ const toggleEnabled = postTool({
76
+ name: 'dokploy_patch_toggle_enabled',
77
+ title: 'Toggle Patch',
78
+ description: 'Enable or disable a patch record in Dokploy. Requires the patch ID and the desired enabled state.',
79
+ schema: z
80
+ .object({
81
+ patchId: z.string().min(1).describe('Patch ID'),
82
+ enabled: z.boolean().describe('Whether the patch should be enabled'),
83
+ })
84
+ .strict(),
85
+ endpoint: '/patch.toggleEnabled',
86
+ });
87
+ const ensureRepo = postTool({
88
+ name: 'dokploy_patch_ensure_repo',
89
+ title: 'Ensure Patch Repository',
90
+ description: 'Ensure that the local patch repository exists for a Dokploy application or compose service. Requires the entity ID and entity type.',
91
+ schema: z
92
+ .object({
93
+ id: z.string().describe('Entity ID'),
94
+ type: entityTypeSchema,
95
+ })
96
+ .strict(),
97
+ endpoint: '/patch.ensureRepo',
98
+ });
99
+ const readRepoDirectories = getTool({
100
+ name: 'dokploy_patch_read_repo_directories',
101
+ title: 'Read Patch Repository Directories',
102
+ description: 'Read directory entries inside a patch repository. Requires the entity ID, entity type, and repository path.',
103
+ schema: z
104
+ .object({
105
+ id: z.string().min(1).describe('Entity ID'),
106
+ type: entityTypeSchema,
107
+ repoPath: z.string().describe('Repository path'),
108
+ })
109
+ .strict(),
110
+ endpoint: '/patch.readRepoDirectories',
111
+ });
112
+ const readRepoFile = getTool({
113
+ name: 'dokploy_patch_read_repo_file',
114
+ title: 'Read Patch Repository File',
115
+ description: 'Read a file from a patch repository. Requires the entity ID, entity type, and file path.',
116
+ schema: z
117
+ .object({
118
+ id: z.string().min(1).describe('Entity ID'),
119
+ type: entityTypeSchema,
120
+ filePath: z.string().describe('File path'),
121
+ })
122
+ .strict(),
123
+ endpoint: '/patch.readRepoFile',
124
+ });
125
+ const saveFileAsPatch = postTool({
126
+ name: 'dokploy_patch_save_file_as_patch',
127
+ title: 'Save File as Patch',
128
+ description: 'Create or update a patch record from file content. Requires the entity ID, entity type, file path, and content.',
129
+ schema: z
130
+ .object({
131
+ id: z.string().min(1).describe('Entity ID'),
132
+ type: entityTypeSchema,
133
+ filePath: z.string().describe('File path'),
134
+ content: z.string().describe('File content'),
135
+ patchType: savePatchTypeSchema.optional(),
136
+ })
137
+ .strict(),
138
+ endpoint: '/patch.saveFileAsPatch',
139
+ });
140
+ const markFileForDeletion = postTool({
141
+ name: 'dokploy_patch_mark_file_for_deletion',
142
+ title: 'Mark File for Deletion',
143
+ description: 'Mark a file for deletion through the Dokploy patch workflow. Requires the entity ID, entity type, and file path.',
144
+ schema: z
145
+ .object({
146
+ id: z.string().min(1).describe('Entity ID'),
147
+ type: entityTypeSchema,
148
+ filePath: z.string().describe('File path'),
149
+ })
150
+ .strict(),
151
+ endpoint: '/patch.markFileForDeletion',
152
+ annotations: { destructiveHint: true },
153
+ });
154
+ const cleanPatchRepos = postTool({
155
+ name: 'dokploy_patch_clean_patch_repos',
156
+ title: 'Clean Patch Repositories',
157
+ description: 'Clean Dokploy patch repositories. Optionally scope the cleanup to a specific server.',
158
+ schema: z
159
+ .object({
160
+ serverId: z.string().optional().describe('Optional server ID'),
161
+ })
162
+ .strict(),
163
+ endpoint: '/patch.cleanPatchRepos',
164
+ annotations: { destructiveHint: true },
165
+ });
166
+ export const patchTools = [
167
+ create,
168
+ one,
169
+ byEntityId,
170
+ update,
171
+ remove,
172
+ toggleEnabled,
173
+ ensureRepo,
174
+ readRepoDirectories,
175
+ readRepoFile,
176
+ saveFileAsPatch,
177
+ markFileForDeletion,
178
+ cleanPatchRepos,
179
+ ];
@@ -1,2 +1 @@
1
- import { type ToolDefinition } from './_factory.js';
2
- export declare const postgresTools: ToolDefinition[];
1
+ export declare const postgresTools: import("./_factory.js").ToolDefinition[];
@@ -1,169 +1,13 @@
1
1
  import { z } from 'zod';
2
- import { getTool, postTool } from './_factory.js';
3
- // ── helpers ──────────────────────────────────────────────────────────
4
- const pgId = z.string().min(1).describe('Unique Postgres database ID');
5
- const DB = 'postgres';
6
- // ── tools ────────────────────────────────────────────────────────────
7
- const one = getTool({
8
- name: `dokploy_${DB}_one`,
9
- title: 'Get Postgres Details',
10
- description: 'Retrieve detailed information about a specific Postgres database managed by Dokploy. Returns the full configuration including connection settings, resource limits, environment variables, and current status. Requires the unique Postgres database ID.',
11
- schema: z.object({ postgresId: pgId }).strict(),
12
- endpoint: `${DB}.one`,
13
- });
14
- const create = postTool({
15
- name: `dokploy_${DB}_create`,
16
- title: 'Create Postgres Database',
17
- description: 'Create a new Postgres database instance inside a Dokploy project. Requires a display name, app-level identifier, database name, user credentials, and the target project ID. Optionally specify a Docker image, description, or remote server. Returns the newly created database record.',
18
- schema: z
19
- .object({
20
- name: z.string().min(1).describe('Display name for the database'),
21
- appName: z.string().min(1).describe('Unique app-level identifier'),
2
+ import { createDatabaseTools } from './_database.js';
3
+ export const postgresTools = createDatabaseTools({
4
+ type: 'postgres',
5
+ idField: 'postgresId',
6
+ displayName: 'Postgres',
7
+ defaultImage: 'postgres:18',
8
+ createFields: z.object({
22
9
  databaseName: z.string().min(1).describe('Name of the database to create'),
23
10
  databaseUser: z.string().min(1).describe('Database user'),
24
11
  databasePassword: z.string().min(1).describe('Database password'),
25
- projectId: z.string().min(1).describe('Project ID to create the database in'),
26
- dockerImage: z.string().optional().describe('Docker image (default: postgres:15)'),
27
- description: z.string().nullable().optional().describe('Optional description'),
28
- serverId: z.string().nullable().optional().describe('Target server ID (null for local)'),
29
- })
30
- .strict(),
31
- endpoint: `${DB}.create`,
32
- });
33
- const update = postTool({
34
- name: `dokploy_${DB}_update`,
35
- title: 'Update Postgres Database',
36
- description: 'Update the configuration of an existing Postgres database in Dokploy. Supports modifying the display name, Docker image, resource limits (CPU and memory), custom start command, environment variables, and external port. Requires the Postgres database ID. Only the provided fields are updated.',
37
- schema: z
38
- .object({
39
- postgresId: pgId,
40
- name: z.string().min(1).optional().describe('Display name'),
41
- appName: z.string().min(1).optional().describe('App-level identifier'),
42
- description: z.string().nullable().optional().describe('Description'),
43
- dockerImage: z.string().optional().describe('Docker image'),
44
- memoryReservation: z.number().nullable().optional().describe('Memory reservation in MB'),
45
- memoryLimit: z.number().nullable().optional().describe('Memory limit in MB'),
46
- cpuReservation: z.number().nullable().optional().describe('CPU reservation'),
47
- cpuLimit: z.number().nullable().optional().describe('CPU limit'),
48
- command: z.string().nullable().optional().describe('Custom start command'),
49
- env: z.string().nullable().optional().describe('Environment variables'),
50
- externalPort: z.number().nullable().optional().describe('External port'),
51
- })
52
- .strict(),
53
- endpoint: `${DB}.update`,
54
- });
55
- const remove = postTool({
56
- name: `dokploy_${DB}_remove`,
57
- title: 'Remove Postgres Database',
58
- description: 'Permanently delete a Postgres database from Dokploy. This action removes the database container, its data, and all associated configuration. Requires the Postgres database ID. This operation is destructive and cannot be undone.',
59
- schema: z.object({ postgresId: pgId }).strict(),
60
- endpoint: `${DB}.remove`,
61
- annotations: { destructiveHint: true },
62
- });
63
- const move = postTool({
64
- name: `dokploy_${DB}_move`,
65
- title: 'Move Postgres Database',
66
- description: 'Move a Postgres database from its current project to a different project within Dokploy. Requires the Postgres database ID and the destination project ID. The database configuration and data are preserved during the move.',
67
- schema: z
68
- .object({
69
- postgresId: pgId,
70
- targetProjectId: z.string().min(1).describe('Destination project ID'),
71
- })
72
- .strict(),
73
- endpoint: `${DB}.move`,
74
- });
75
- const deploy = postTool({
76
- name: `dokploy_${DB}_deploy`,
77
- title: 'Deploy Postgres Database',
78
- description: 'Deploy a Postgres database container in Dokploy. Triggers the build and start process for the specified database. Requires the Postgres database ID. Returns the deployment status.',
79
- schema: z.object({ postgresId: pgId }).strict(),
80
- endpoint: `${DB}.deploy`,
81
- });
82
- const start = postTool({
83
- name: `dokploy_${DB}_start`,
84
- title: 'Start Postgres Database',
85
- description: 'Start a previously stopped Postgres database container in Dokploy. The database must already be deployed. Requires the Postgres database ID. Returns the updated status after starting.',
86
- schema: z.object({ postgresId: pgId }).strict(),
87
- endpoint: `${DB}.start`,
88
- });
89
- const stop = postTool({
90
- name: `dokploy_${DB}_stop`,
91
- title: 'Stop Postgres Database',
92
- description: 'Stop a running Postgres database container in Dokploy. The database data is preserved but the container will no longer accept connections. Requires the Postgres database ID. This is a destructive action as it interrupts active connections.',
93
- schema: z.object({ postgresId: pgId }).strict(),
94
- endpoint: `${DB}.stop`,
95
- annotations: { destructiveHint: true },
96
- });
97
- const reload = postTool({
98
- name: `dokploy_${DB}_reload`,
99
- title: 'Reload Postgres Database',
100
- description: 'Reload the Postgres database container in Dokploy without a full restart. Applies configuration changes that do not require a rebuild. Requires the Postgres database ID and the app-level identifier. Returns the reload status.',
101
- schema: z
102
- .object({
103
- postgresId: pgId,
104
- appName: z.string().min(1).describe('App-level identifier'),
105
- })
106
- .strict(),
107
- endpoint: `${DB}.reload`,
108
- });
109
- const rebuild = postTool({
110
- name: `dokploy_${DB}_rebuild`,
111
- title: 'Rebuild Postgres Database',
112
- description: 'Rebuild the Postgres database container from scratch in Dokploy. This tears down the existing container and recreates it with the current configuration. Requires the Postgres database ID. Useful after changing the Docker image or when the container is in a broken state.',
113
- schema: z.object({ postgresId: pgId }).strict(),
114
- endpoint: `${DB}.rebuild`,
115
- });
116
- const changeStatus = postTool({
117
- name: `dokploy_${DB}_change_status`,
118
- title: 'Change Postgres Status',
119
- description: 'Manually set the application status of a Postgres database in Dokploy. Accepts one of: idle, running, done, or error. Requires the Postgres database ID and the new status value. Useful for correcting a stale or incorrect status.',
120
- schema: z
121
- .object({
122
- postgresId: pgId,
123
- applicationStatus: z
124
- .enum(['idle', 'running', 'done', 'error'])
125
- .describe('New application status'),
126
- })
127
- .strict(),
128
- endpoint: `${DB}.changeStatus`,
129
- });
130
- const saveExternalPort = postTool({
131
- name: `dokploy_${DB}_save_external_port`,
132
- title: 'Save Postgres External Port',
133
- description: 'Set or clear the external port mapping for a Postgres database in Dokploy. When set, the database is accessible from outside the Docker network on the specified port. Pass null to remove the external port. Requires the Postgres database ID.',
134
- schema: z
135
- .object({
136
- postgresId: pgId,
137
- externalPort: z.number().nullable().describe('External port number (null to remove)'),
138
- })
139
- .strict(),
140
- endpoint: `${DB}.saveExternalPort`,
141
- });
142
- const saveEnvironment = postTool({
143
- name: `dokploy_${DB}_save_environment`,
144
- title: 'Save Postgres Environment',
145
- description: 'Overwrite the environment variables for a Postgres database in Dokploy. Replaces all existing environment variables with the provided value. Pass the variables as a single string (one per line, KEY=VALUE format). Requires the Postgres database ID.',
146
- schema: z
147
- .object({
148
- postgresId: pgId,
149
- env: z.string().nullable().optional().describe('Environment variables as a string'),
150
- })
151
- .strict(),
152
- endpoint: `${DB}.saveEnvironment`,
12
+ }),
153
13
  });
154
- // ── export ───────────────────────────────────────────────────────────
155
- export const postgresTools = [
156
- one,
157
- create,
158
- update,
159
- remove,
160
- move,
161
- deploy,
162
- start,
163
- stop,
164
- reload,
165
- rebuild,
166
- changeStatus,
167
- saveExternalPort,
168
- saveEnvironment,
169
- ];
@@ -0,0 +1,2 @@
1
+ import { type ToolDefinition } from './_factory.js';
2
+ export declare const previewDeploymentTools: ToolDefinition[];
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod';
2
+ import { getTool, postTool } from './_factory.js';
3
+ const all = getTool({
4
+ name: 'dokploy_preview_deployment_all',
5
+ title: 'List Preview Deployments',
6
+ description: 'List preview deployments for a Dokploy application. Requires the application ID.',
7
+ schema: z
8
+ .object({
9
+ applicationId: z.string().min(1).describe('Application ID'),
10
+ })
11
+ .strict(),
12
+ endpoint: '/previewDeployment.all',
13
+ });
14
+ const one = getTool({
15
+ name: 'dokploy_preview_deployment_one',
16
+ title: 'Get Preview Deployment',
17
+ description: 'Retrieve a preview deployment by its ID.',
18
+ schema: z
19
+ .object({
20
+ previewDeploymentId: z.string().describe('Preview deployment ID'),
21
+ })
22
+ .strict(),
23
+ endpoint: '/previewDeployment.one',
24
+ });
25
+ const remove = postTool({
26
+ name: 'dokploy_preview_deployment_delete',
27
+ title: 'Delete Preview Deployment',
28
+ description: 'Delete a preview deployment in Dokploy. Requires the preview deployment ID. This is a destructive action.',
29
+ schema: z
30
+ .object({
31
+ previewDeploymentId: z.string().describe('Preview deployment ID'),
32
+ })
33
+ .strict(),
34
+ endpoint: '/previewDeployment.delete',
35
+ annotations: { destructiveHint: true },
36
+ });
37
+ const redeploy = postTool({
38
+ name: 'dokploy_preview_deployment_redeploy',
39
+ title: 'Redeploy Preview Deployment',
40
+ description: 'Redeploy a preview deployment in Dokploy. Requires the preview deployment ID and optionally accepts a title and description.',
41
+ schema: z
42
+ .object({
43
+ previewDeploymentId: z.string().describe('Preview deployment ID'),
44
+ title: z.string().optional().describe('Optional deployment title'),
45
+ description: z.string().optional().describe('Optional deployment description'),
46
+ })
47
+ .strict(),
48
+ endpoint: '/previewDeployment.redeploy',
49
+ });
50
+ export const previewDeploymentTools = [all, one, remove, redeploy];
@@ -8,6 +8,13 @@ const all = getTool({
8
8
  schema: z.object({}).strict(),
9
9
  endpoint: '/project.all',
10
10
  });
11
+ const allForPermissions = getTool({
12
+ name: 'dokploy_project_all_for_permissions',
13
+ title: 'List Projects for Permissions',
14
+ description: 'List projects in the format used by Dokploy permission assignment workflows.',
15
+ schema: z.object({}).strict(),
16
+ endpoint: '/project.allForPermissions',
17
+ });
11
18
  const one = getTool({
12
19
  name: 'dokploy_project_one',
13
20
  title: 'Get Project Details',
@@ -90,5 +97,29 @@ const remove = postTool({
90
97
  endpoint: '/project.remove',
91
98
  annotations: { destructiveHint: true },
92
99
  });
100
+ const search = getTool({
101
+ name: 'dokploy_project_search',
102
+ title: 'Search Projects',
103
+ description: 'Search Dokploy projects by free text or field-specific filters. Supports pagination through limit and offset.',
104
+ schema: z
105
+ .object({
106
+ q: z.string().optional().describe('Free-text query'),
107
+ name: z.string().optional().describe('Project name'),
108
+ description: z.string().optional().describe('Project description'),
109
+ limit: z.number().min(1).max(100).optional().describe('Maximum number of results'),
110
+ offset: z.number().min(0).optional().describe('Number of results to skip'),
111
+ })
112
+ .strict(),
113
+ endpoint: '/project.search',
114
+ });
93
115
  // ── export ───────────────────────────────────────────────────────────
94
- export const projectTools = [all, one, create, update, duplicate, remove];
116
+ export const projectTools = [
117
+ all,
118
+ allForPermissions,
119
+ one,
120
+ create,
121
+ update,
122
+ duplicate,
123
+ remove,
124
+ search,
125
+ ];
@@ -1,2 +1 @@
1
- import { type ToolDefinition } from './_factory.js';
2
- export declare const redisTools: ToolDefinition[];
1
+ export declare const redisTools: import("./_factory.js").ToolDefinition[];
@@ -1,167 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { getTool, postTool } from './_factory.js';
3
- // ── helpers ──────────────────────────────────────────────────────────
4
- const rdId = z.string().min(1).describe('Unique Redis database ID');
5
- const DB = 'redis';
6
- // ── tools ────────────────────────────────────────────────────────────
7
- const one = getTool({
8
- name: `dokploy_${DB}_one`,
9
- title: 'Get Redis Details',
10
- description: 'Retrieve the full configuration and status details of a Redis database managed by Dokploy. Requires the unique Redis database ID. Returns all metadata including name, image, resource limits, environment variables, and current application status.',
11
- schema: z.object({ redisId: rdId }).strict(),
12
- endpoint: `${DB}.one`,
13
- });
14
- const create = postTool({
15
- name: `dokploy_${DB}_create`,
16
- title: 'Create Redis Database',
17
- description: 'Create a new Redis database instance inside a Dokploy project. Requires a display name, app-level identifier, database password, and the target project ID. Optionally specify a Docker image, description, or remote server. Returns the newly created database record.',
18
- schema: z
19
- .object({
20
- name: z.string().min(1).describe('Display name for the database'),
21
- appName: z.string().min(1).describe('Unique app-level identifier'),
2
+ import { createDatabaseTools } from './_database.js';
3
+ export const redisTools = createDatabaseTools({
4
+ type: 'redis',
5
+ idField: 'redisId',
6
+ displayName: 'Redis',
7
+ defaultImage: 'redis:8',
8
+ createFields: z.object({
22
9
  databasePassword: z.string().min(1).describe('Database password'),
23
- projectId: z.string().min(1).describe('Project ID to create the database in'),
24
- dockerImage: z.string().optional().describe('Docker image (default: redis:7)'),
25
- description: z.string().nullable().optional().describe('Optional description'),
26
- serverId: z.string().nullable().optional().describe('Target server ID (null for local)'),
27
- })
28
- .strict(),
29
- endpoint: `${DB}.create`,
30
- });
31
- const update = postTool({
32
- name: `dokploy_${DB}_update`,
33
- title: 'Update Redis Database',
34
- description: 'Update the configuration of an existing Redis database in Dokploy. Requires the Redis database ID and accepts optional fields such as name, Docker image, resource limits (memory and CPU), custom start command, environment variables, and external port. Returns the updated database configuration.',
35
- schema: z
36
- .object({
37
- redisId: rdId,
38
- name: z.string().min(1).optional().describe('Display name'),
39
- appName: z.string().min(1).optional().describe('App-level identifier'),
40
- description: z.string().nullable().optional().describe('Description'),
41
- dockerImage: z.string().optional().describe('Docker image'),
42
- memoryReservation: z.number().nullable().optional().describe('Memory reservation in MB'),
43
- memoryLimit: z.number().nullable().optional().describe('Memory limit in MB'),
44
- cpuReservation: z.number().nullable().optional().describe('CPU reservation'),
45
- cpuLimit: z.number().nullable().optional().describe('CPU limit'),
46
- command: z.string().nullable().optional().describe('Custom start command'),
47
- env: z.string().nullable().optional().describe('Environment variables'),
48
- externalPort: z.number().nullable().optional().describe('External port'),
49
- })
50
- .strict(),
51
- endpoint: `${DB}.update`,
52
- });
53
- const remove = postTool({
54
- name: `dokploy_${DB}_remove`,
55
- title: 'Remove Redis Database',
56
- description: 'Permanently delete a Redis database from Dokploy. Requires the Redis database ID. This is a destructive operation that removes the container, all associated data, and configuration. Returns the operation status confirming deletion.',
57
- schema: z.object({ redisId: rdId }).strict(),
58
- endpoint: `${DB}.remove`,
59
- annotations: { destructiveHint: true },
60
- });
61
- const move = postTool({
62
- name: `dokploy_${DB}_move`,
63
- title: 'Move Redis Database',
64
- description: 'Move a Redis database from its current project to a different project within Dokploy. Requires the Redis database ID and the destination project ID. The database configuration and data remain intact during the move. Returns the operation status.',
65
- schema: z
66
- .object({
67
- redisId: rdId,
68
- targetProjectId: z.string().min(1).describe('Destination project ID'),
69
- })
70
- .strict(),
71
- endpoint: `${DB}.move`,
72
- });
73
- const deploy = postTool({
74
- name: `dokploy_${DB}_deploy`,
75
- title: 'Deploy Redis Database',
76
- description: 'Deploy a Redis database in Dokploy, pulling the configured Docker image and starting the container. Requires the Redis database ID. This triggers a full deployment lifecycle including image pull, container creation, and startup. Returns the deployment operation status.',
77
- schema: z.object({ redisId: rdId }).strict(),
78
- endpoint: `${DB}.deploy`,
79
- });
80
- const start = postTool({
81
- name: `dokploy_${DB}_start`,
82
- title: 'Start Redis Database',
83
- description: 'Start a previously stopped Redis database container in Dokploy. Requires the Redis database ID. The container will resume with its existing data and configuration. Returns the operation status.',
84
- schema: z.object({ redisId: rdId }).strict(),
85
- endpoint: `${DB}.start`,
86
- });
87
- const stop = postTool({
88
- name: `dokploy_${DB}_stop`,
89
- title: 'Stop Redis Database',
90
- description: 'Stop a currently running Redis database container in Dokploy. Requires the Redis database ID. The container will be gracefully stopped but its data and configuration are preserved for future restarts. Returns the operation status.',
91
- schema: z.object({ redisId: rdId }).strict(),
92
- endpoint: `${DB}.stop`,
93
- annotations: { destructiveHint: true },
94
- });
95
- const reload = postTool({
96
- name: `dokploy_${DB}_reload`,
97
- title: 'Reload Redis Database',
98
- description: 'Reload the Redis database container in Dokploy without performing a full rebuild. Requires the Redis database ID and the app-level identifier. This restarts the container with its current configuration. Returns the operation status.',
99
- schema: z
100
- .object({
101
- redisId: rdId,
102
- appName: z.string().min(1).describe('App-level identifier'),
103
- })
104
- .strict(),
105
- endpoint: `${DB}.reload`,
106
- });
107
- const rebuild = postTool({
108
- name: `dokploy_${DB}_rebuild`,
109
- title: 'Rebuild Redis Database',
110
- description: 'Rebuild the Redis database container from scratch in Dokploy. Requires the Redis database ID. This tears down the existing container and recreates it using the current configuration, which is useful when the container state has become inconsistent. Returns the operation status.',
111
- schema: z.object({ redisId: rdId }).strict(),
112
- endpoint: `${DB}.rebuild`,
113
- });
114
- const changeStatus = postTool({
115
- name: `dokploy_${DB}_change_status`,
116
- title: 'Change Redis Status',
117
- description: 'Manually set the application status of a Redis database in Dokploy. Requires the Redis database ID and the desired status (idle, running, done, or error). This is typically used for administrative overrides when the reported status does not match reality. Returns the updated status.',
118
- schema: z
119
- .object({
120
- redisId: rdId,
121
- applicationStatus: z
122
- .enum(['idle', 'running', 'done', 'error'])
123
- .describe('New application status'),
124
- })
125
- .strict(),
126
- endpoint: `${DB}.changeStatus`,
127
- });
128
- const saveExternalPort = postTool({
129
- name: `dokploy_${DB}_save_external_port`,
130
- title: 'Save Redis External Port',
131
- description: 'Set or clear the external port mapping for a Redis database in Dokploy. Requires the Redis database ID and the desired external port number, or null to remove the external port mapping. This controls whether the database is accessible from outside the Docker network. Returns the operation status.',
132
- schema: z
133
- .object({
134
- redisId: rdId,
135
- externalPort: z.number().nullable().describe('External port number (null to remove)'),
136
- })
137
- .strict(),
138
- endpoint: `${DB}.saveExternalPort`,
139
- });
140
- const saveEnvironment = postTool({
141
- name: `dokploy_${DB}_save_environment`,
142
- title: 'Save Redis Environment',
143
- description: 'Overwrite the environment variables for a Redis database in Dokploy. Requires the Redis database ID and the environment variables as a string. This replaces all existing environment variables with the provided values. Returns the operation status.',
144
- schema: z
145
- .object({
146
- redisId: rdId,
147
- env: z.string().nullable().optional().describe('Environment variables as a string'),
148
- })
149
- .strict(),
150
- endpoint: `${DB}.saveEnvironment`,
10
+ }),
151
11
  });
152
- // ── export ───────────────────────────────────────────────────────────
153
- export const redisTools = [
154
- one,
155
- create,
156
- update,
157
- remove,
158
- move,
159
- deploy,
160
- start,
161
- stop,
162
- reload,
163
- rebuild,
164
- changeStatus,
165
- saveExternalPort,
166
- saveEnvironment,
167
- ];
@@ -0,0 +1,2 @@
1
+ import { type ToolDefinition } from './_factory.js';
2
+ export declare const rollbackTools: ToolDefinition[];