@vibetools/dokploy-mcp 0.4.0 → 1.0.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.
@@ -1,4 +1,5 @@
1
1
  import { resolveConfig } from '../config/resolver.js';
2
+ const DEFAULT_TIMEOUT = 30_000;
2
3
  function getConfig() {
3
4
  const resolved = resolveConfig();
4
5
  if (!resolved) {
@@ -14,7 +15,7 @@ function getConfig() {
14
15
  return {
15
16
  baseUrl: resolved.url.replace(/\/+$/, ''),
16
17
  apiKey: resolved.apiKey,
17
- timeout: resolved.timeout,
18
+ timeout: resolved.timeout || DEFAULT_TIMEOUT,
18
19
  };
19
20
  }
20
21
  let _config = null;
@@ -40,17 +41,18 @@ export class ApiError extends Error {
40
41
  }
41
42
  }
42
43
  function buildQueryString(body) {
43
- if (!body || typeof body !== 'object') {
44
+ if (!body || typeof body !== 'object')
44
45
  return '';
45
- }
46
- const params = new URLSearchParams();
47
- for (const [k, v] of Object.entries(body)) {
48
- if (v !== undefined && v !== null) {
49
- params.set(k, String(v));
50
- }
51
- }
52
- return params.toString();
46
+ const entries = Object.entries(body)
47
+ .filter(([, v]) => v != null)
48
+ .map(([k, v]) => [k, String(v)]);
49
+ return entries.length > 0 ? new URLSearchParams(entries).toString() : '';
53
50
  }
51
+ /**
52
+ * Checks whether an error was caused by an aborted fetch.
53
+ * Both checks are needed: older Node versions throw DOMException,
54
+ * while newer versions throw an Error with name 'AbortError'.
55
+ */
54
56
  function isAbortError(error) {
55
57
  return error instanceof DOMException || (error instanceof Error && error.name === 'AbortError');
56
58
  }
@@ -1,7 +1,28 @@
1
1
  import { execSync } from 'node:child_process';
2
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
+ import { z } from 'zod';
4
5
  import { getConfigDir, getConfigFilePath } from './types.js';
6
+ const configFileSchema = z.object({
7
+ url: z.string().min(1),
8
+ apiKey: z.string().min(1),
9
+ });
10
+ const dokployCliSchema = z.object({
11
+ url: z.string().min(1),
12
+ token: z.string().min(1),
13
+ });
14
+ const userSchema = z
15
+ .object({
16
+ email: z.string().optional(),
17
+ user: z
18
+ .object({
19
+ email: z.string().optional(),
20
+ firstName: z.string().optional(),
21
+ })
22
+ .optional(),
23
+ })
24
+ .passthrough();
25
+ const versionSchema = z.union([z.string(), z.object({ version: z.string() }).passthrough()]);
5
26
  /**
6
27
  * Normalizes a Dokploy URL to the tRPC API base.
7
28
  * Accepts any of these formats:
@@ -74,20 +95,8 @@ function readConfigFile() {
74
95
  try {
75
96
  const content = readFileSync(filePath, 'utf8');
76
97
  const parsed = JSON.parse(content);
77
- if (typeof parsed !== 'object' ||
78
- parsed === null ||
79
- !('url' in parsed) ||
80
- !('apiKey' in parsed)) {
81
- return null;
82
- }
83
- const record = parsed;
84
- if (typeof record.url !== 'string' || typeof record.apiKey !== 'string') {
85
- return null;
86
- }
87
- if (!(record.url && record.apiKey)) {
88
- return null;
89
- }
90
- return { url: record.url, apiKey: record.apiKey };
98
+ const result = configFileSchema.safeParse(parsed);
99
+ return result.success ? result.data : null;
91
100
  }
92
101
  catch {
93
102
  return null;
@@ -107,20 +116,8 @@ function readDokployCliConfig() {
107
116
  }
108
117
  const content = readFileSync(cliConfigPath, 'utf8');
109
118
  const parsed = JSON.parse(content);
110
- if (typeof parsed !== 'object' ||
111
- parsed === null ||
112
- !('url' in parsed) ||
113
- !('token' in parsed)) {
114
- return null;
115
- }
116
- const record = parsed;
117
- if (typeof record.url !== 'string' || typeof record.token !== 'string') {
118
- return null;
119
- }
120
- if (!(record.url && record.token)) {
121
- return null;
122
- }
123
- return { url: record.url, apiKey: record.token };
119
+ const result = dokployCliSchema.safeParse(parsed);
120
+ return result.success ? { url: result.data.url, apiKey: result.data.token } : null;
124
121
  }
125
122
  catch {
126
123
  return null;
@@ -212,21 +209,11 @@ function unwrapTrpc(data) {
212
209
  }
213
210
  function parseUser(data) {
214
211
  const unwrapped = unwrapTrpc(data);
215
- if (typeof unwrapped !== 'object' || unwrapped === null)
212
+ const result = userSchema.safeParse(unwrapped);
213
+ if (!result.success)
216
214
  return undefined;
217
- const record = unwrapped;
218
- // Top-level email/name
219
- if (typeof record.email === 'string')
220
- return record.email;
221
- // Nested user object (tRPC user.get response)
222
- if (typeof record.user === 'object' && record.user !== null) {
223
- const user = record.user;
224
- if (typeof user.email === 'string')
225
- return user.email;
226
- if (typeof user.firstName === 'string')
227
- return user.firstName;
228
- }
229
- return undefined;
215
+ const { email, user } = result.data;
216
+ return email ?? user?.email ?? user?.firstName;
230
217
  }
231
218
  async function fetchVersion(baseUrl, apiKey) {
232
219
  const controller = new AbortController();
@@ -241,14 +228,10 @@ async function fetchVersion(baseUrl, apiKey) {
241
228
  return undefined;
242
229
  const data = await response.json();
243
230
  const unwrapped = unwrapTrpc(data);
244
- if (typeof unwrapped === 'string')
245
- return unwrapped;
246
- if (typeof unwrapped === 'object' && unwrapped !== null) {
247
- const record = unwrapped;
248
- if (typeof record.version === 'string')
249
- return record.version;
250
- }
251
- return undefined;
231
+ const result = versionSchema.safeParse(unwrapped);
232
+ if (!result.success)
233
+ return undefined;
234
+ return typeof result.data === 'string' ? result.data : result.data.version;
252
235
  }
253
236
  catch {
254
237
  return undefined;
package/dist/index.js CHANGED
File without changes
package/dist/server.js CHANGED
@@ -3,7 +3,7 @@ import { allTools } from './tools/index.js';
3
3
  export function createServer() {
4
4
  const server = new McpServer({
5
5
  name: 'dokploy-mcp-server',
6
- version: '0.1.0',
6
+ version: '1.0.0',
7
7
  });
8
8
  for (const tool of allTools) {
9
9
  server.registerTool(tool.name, {
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { type ToolDefinition } from './_factory.js';
3
+ type AnyZodObject = z.ZodObject;
4
+ export interface DatabaseConfig {
5
+ type: string;
6
+ idField: string;
7
+ displayName: string;
8
+ defaultImage: string;
9
+ createFields: AnyZodObject;
10
+ }
11
+ export declare function createDatabaseTools(config: DatabaseConfig): ToolDefinition[];
12
+ export {};
@@ -0,0 +1,96 @@
1
+ import { z } from 'zod';
2
+ import { getTool, postTool } from './_factory.js';
3
+ export function createDatabaseTools(config) {
4
+ const { type, idField, displayName, defaultImage, createFields } = config;
5
+ const idSchema = z
6
+ .object({ [idField]: z.string().min(1).describe(`Unique ${displayName} database ID`) })
7
+ .strict();
8
+ function tool(action, title, description, schema, opts = {}) {
9
+ const endpoint = `${type}.${action}`;
10
+ const name = `dokploy_${type}_${action.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`)}`;
11
+ if (opts.get) {
12
+ return getTool({ name, title, description, schema, endpoint, annotations: opts.annotations });
13
+ }
14
+ return postTool({ name, title, description, schema, endpoint, annotations: opts.annotations });
15
+ }
16
+ const one = tool('one', `Get ${displayName} Details`, `Retrieve detailed information about a specific ${displayName} database managed by Dokploy. Returns the full configuration including connection settings, resource limits, environment variables, and current status. Requires the unique ${displayName} database ID.`, idSchema, { get: true });
17
+ const create = tool('create', `Create ${displayName} Database`, `Create a new ${displayName} database instance inside a Dokploy project. Requires a display name, app-level identifier, and the target project ID. Optionally specify a Docker image, description, or remote server. Returns the newly created database record.`, z
18
+ .object({
19
+ name: z.string().min(1).describe('Display name for the database'),
20
+ appName: z.string().min(1).describe('Unique app-level identifier'),
21
+ ...createFields.shape,
22
+ projectId: z.string().min(1).describe('Project ID to create the database in'),
23
+ dockerImage: z.string().optional().describe(`Docker image (default: ${defaultImage})`),
24
+ description: z.string().nullable().optional().describe('Optional description'),
25
+ serverId: z.string().nullable().optional().describe('Target server ID (null for local)'),
26
+ })
27
+ .strict());
28
+ const update = tool('update', `Update ${displayName} Database`, `Update the configuration of an existing ${displayName} 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 ${displayName} database ID. Only the provided fields are updated.`, z
29
+ .object({
30
+ [idField]: z.string().min(1).describe(`Unique ${displayName} database ID`),
31
+ name: z.string().min(1).optional().describe('Display name'),
32
+ appName: z.string().min(1).optional().describe('App-level identifier'),
33
+ description: z.string().nullable().optional().describe('Description'),
34
+ dockerImage: z.string().optional().describe('Docker image'),
35
+ memoryReservation: z.number().nullable().optional().describe('Memory reservation in MB'),
36
+ memoryLimit: z.number().nullable().optional().describe('Memory limit in MB'),
37
+ cpuReservation: z.number().nullable().optional().describe('CPU reservation'),
38
+ cpuLimit: z.number().nullable().optional().describe('CPU limit'),
39
+ command: z.string().nullable().optional().describe('Custom start command'),
40
+ env: z.string().nullable().optional().describe('Environment variables'),
41
+ externalPort: z.number().nullable().optional().describe('External port'),
42
+ })
43
+ .strict());
44
+ const remove = tool('remove', `Remove ${displayName} Database`, `Permanently delete a ${displayName} database from Dokploy. This action removes the database container, its data, and all associated configuration. Requires the ${displayName} database ID. This operation is destructive and cannot be undone.`, idSchema, { annotations: { destructiveHint: true } });
45
+ const move = tool('move', `Move ${displayName} Database`, `Move a ${displayName} database from its current project to a different project within Dokploy. Requires the ${displayName} database ID and the destination project ID. The database configuration and data are preserved during the move.`, z
46
+ .object({
47
+ [idField]: z.string().min(1).describe(`Unique ${displayName} database ID`),
48
+ targetProjectId: z.string().min(1).describe('Destination project ID'),
49
+ })
50
+ .strict());
51
+ const deploy = tool('deploy', `Deploy ${displayName} Database`, `Deploy a ${displayName} database container in Dokploy. Triggers the build and start process for the specified database. Requires the ${displayName} database ID. Returns the deployment status.`, idSchema);
52
+ const start = tool('start', `Start ${displayName} Database`, `Start a previously stopped ${displayName} database container in Dokploy. The database must already be deployed. Requires the ${displayName} database ID. Returns the updated status after starting.`, idSchema);
53
+ const stop = tool('stop', `Stop ${displayName} Database`, `Stop a running ${displayName} database container in Dokploy. The database data is preserved but the container will no longer accept connections. Requires the ${displayName} database ID. This is a destructive action as it interrupts active connections.`, idSchema, { annotations: { destructiveHint: true } });
54
+ const reload = tool('reload', `Reload ${displayName} Database`, `Reload the ${displayName} database container in Dokploy without a full restart. Applies configuration changes that do not require a rebuild. Requires the ${displayName} database ID and the app-level identifier. Returns the reload status.`, z
55
+ .object({
56
+ [idField]: z.string().min(1).describe(`Unique ${displayName} database ID`),
57
+ appName: z.string().min(1).describe('App-level identifier'),
58
+ })
59
+ .strict());
60
+ const rebuild = tool('rebuild', `Rebuild ${displayName} Database`, `Rebuild the ${displayName} database container from scratch in Dokploy. This tears down the existing container and recreates it with the current configuration. Requires the ${displayName} database ID. Useful after changing the Docker image or when the container is in a broken state.`, idSchema);
61
+ const changeStatus = tool('changeStatus', `Change ${displayName} Status`, `Manually set the application status of a ${displayName} database in Dokploy. Accepts one of: idle, running, done, or error. Requires the ${displayName} database ID and the new status value. Useful for correcting a stale or incorrect status.`, z
62
+ .object({
63
+ [idField]: z.string().min(1).describe(`Unique ${displayName} database ID`),
64
+ applicationStatus: z
65
+ .enum(['idle', 'running', 'done', 'error'])
66
+ .describe('New application status'),
67
+ })
68
+ .strict());
69
+ const saveExternalPort = tool('saveExternalPort', `Save ${displayName} External Port`, `Set or clear the external port mapping for a ${displayName} 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 ${displayName} database ID.`, z
70
+ .object({
71
+ [idField]: z.string().min(1).describe(`Unique ${displayName} database ID`),
72
+ externalPort: z.number().nullable().describe('External port number (null to remove)'),
73
+ })
74
+ .strict());
75
+ const saveEnvironment = tool('saveEnvironment', `Save ${displayName} Environment`, `Overwrite the environment variables for a ${displayName} 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 ${displayName} database ID.`, z
76
+ .object({
77
+ [idField]: z.string().min(1).describe(`Unique ${displayName} database ID`),
78
+ env: z.string().nullable().optional().describe('Environment variables as a string'),
79
+ })
80
+ .strict());
81
+ return [
82
+ one,
83
+ create,
84
+ update,
85
+ remove,
86
+ move,
87
+ deploy,
88
+ start,
89
+ stop,
90
+ reload,
91
+ rebuild,
92
+ changeStatus,
93
+ saveExternalPort,
94
+ saveEnvironment,
95
+ ];
96
+ }
@@ -28,7 +28,7 @@ export declare function createTool<T extends AnyZodObject>(def: {
28
28
  title: string;
29
29
  description: string;
30
30
  schema: T;
31
- annotations: ToolAnnotations;
31
+ annotations?: Partial<ToolAnnotations>;
32
32
  handler: (params: {
33
33
  input: z.infer<T>;
34
34
  api: typeof api;
@@ -16,19 +16,22 @@ function error(message, details) {
16
16
  isError: true,
17
17
  };
18
18
  }
19
+ const ERROR_MAP = {
20
+ 401: ['Authentication failed', () => 'Check your DOKPLOY_API_KEY environment variable.'],
21
+ 403: ['Permission denied', () => 'Your API key lacks permission for this operation.'],
22
+ 404: ['Resource not found', (err) => err.message],
23
+ 422: [
24
+ 'Validation error',
25
+ (err) => typeof err.body === 'object' && err.body !== null ? JSON.stringify(err.body) : err.message,
26
+ ],
27
+ };
19
28
  function mapApiError(err) {
20
- switch (err.status) {
21
- case 401:
22
- return error('Authentication failed', 'Check your DOKPLOY_API_KEY environment variable.');
23
- case 403:
24
- return error('Permission denied', 'Your API key lacks permission for this operation.');
25
- case 404:
26
- return error('Resource not found', err.message);
27
- case 422:
28
- return error('Validation error', typeof err.body === 'object' && err.body !== null ? JSON.stringify(err.body) : err.message);
29
- default:
30
- return error(`Dokploy API error (${err.status})`, err.message);
29
+ const entry = ERROR_MAP[err.status];
30
+ if (entry) {
31
+ const [message, getDetails] = entry;
32
+ return error(message, getDetails(err));
31
33
  }
34
+ return error(`Dokploy API error (${err.status})`, err.message);
32
35
  }
33
36
  export function createTool(def) {
34
37
  return {
@@ -57,7 +60,7 @@ export function postTool(opts) {
57
60
  title: opts.title,
58
61
  description: opts.description,
59
62
  schema: opts.schema,
60
- annotations: { openWorldHint: true, ...opts.annotations },
63
+ annotations: opts.annotations,
61
64
  handler: async ({ input, api }) => api.post(opts.endpoint, input),
62
65
  });
63
66
  }
@@ -70,7 +73,6 @@ export function getTool(opts) {
70
73
  annotations: {
71
74
  readOnlyHint: true,
72
75
  idempotentHint: true,
73
- openWorldHint: true,
74
76
  ...opts.annotations,
75
77
  },
76
78
  handler: async ({ input, api }) => {
@@ -1,2 +1 @@
1
- import { type ToolDefinition } from './_factory.js';
2
- export declare const mariadbTools: ToolDefinition[];
1
+ export declare const mariadbTools: import("./_factory.js").ToolDefinition[];
@@ -1,170 +1,14 @@
1
1
  import { z } from 'zod';
2
- import { getTool, postTool } from './_factory.js';
3
- // ── helpers ──────────────────────────────────────────────────────────
4
- const mdbId = z.string().min(1).describe('Unique MariaDB database ID');
5
- const DB = 'mariadb';
6
- // ── tools ────────────────────────────────────────────────────────────
7
- const one = getTool({
8
- name: `dokploy_${DB}_one`,
9
- title: 'Get MariaDB Details',
10
- description: 'Retrieve the full configuration and status details of a MariaDB database managed by Dokploy. Requires the unique MariaDB database ID. Returns all metadata including name, image, resource limits, environment variables, and current application status.',
11
- schema: z.object({ mariadbId: mdbId }).strict(),
12
- endpoint: `${DB}.one`,
13
- });
14
- const create = postTool({
15
- name: `dokploy_${DB}_create`,
16
- title: 'Create MariaDB Database',
17
- description: 'Create a new MariaDB database instance inside a Dokploy project. Requires a display name, app-level identifier, database name, user credentials, root 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 mariadbTools = createDatabaseTools({
4
+ type: 'mariadb',
5
+ idField: 'mariadbId',
6
+ displayName: 'MariaDB',
7
+ defaultImage: 'mariadb:11',
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
12
  databaseRootPassword: z.string().min(1).describe('Root password for MariaDB'),
26
- projectId: z.string().min(1).describe('Project ID to create the database in'),
27
- dockerImage: z.string().optional().describe('Docker image (default: mariadb:11)'),
28
- description: z.string().nullable().optional().describe('Optional description'),
29
- serverId: z.string().nullable().optional().describe('Target server ID (null for local)'),
30
- })
31
- .strict(),
32
- endpoint: `${DB}.create`,
33
- });
34
- const update = postTool({
35
- name: `dokploy_${DB}_update`,
36
- title: 'Update MariaDB Database',
37
- description: 'Update the configuration of an existing MariaDB database in Dokploy. Requires the MariaDB 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.',
38
- schema: z
39
- .object({
40
- mariadbId: mdbId,
41
- name: z.string().min(1).optional().describe('Display name'),
42
- appName: z.string().min(1).optional().describe('App-level identifier'),
43
- description: z.string().nullable().optional().describe('Description'),
44
- dockerImage: z.string().optional().describe('Docker image'),
45
- memoryReservation: z.number().nullable().optional().describe('Memory reservation in MB'),
46
- memoryLimit: z.number().nullable().optional().describe('Memory limit in MB'),
47
- cpuReservation: z.number().nullable().optional().describe('CPU reservation'),
48
- cpuLimit: z.number().nullable().optional().describe('CPU limit'),
49
- command: z.string().nullable().optional().describe('Custom start command'),
50
- env: z.string().nullable().optional().describe('Environment variables'),
51
- externalPort: z.number().nullable().optional().describe('External port'),
52
- })
53
- .strict(),
54
- endpoint: `${DB}.update`,
55
- });
56
- const remove = postTool({
57
- name: `dokploy_${DB}_remove`,
58
- title: 'Remove MariaDB Database',
59
- description: 'Permanently delete a MariaDB database from Dokploy. Requires the MariaDB database ID. This is a destructive operation that removes the container, all associated data, and configuration. Returns the operation status confirming deletion.',
60
- schema: z.object({ mariadbId: mdbId }).strict(),
61
- endpoint: `${DB}.remove`,
62
- annotations: { destructiveHint: true },
63
- });
64
- const move = postTool({
65
- name: `dokploy_${DB}_move`,
66
- title: 'Move MariaDB Database',
67
- description: 'Move a MariaDB database from its current project to a different project within Dokploy. Requires the MariaDB database ID and the destination project ID. The database configuration and data remain intact during the move. Returns the operation status.',
68
- schema: z
69
- .object({
70
- mariadbId: mdbId,
71
- targetProjectId: z.string().min(1).describe('Destination project ID'),
72
- })
73
- .strict(),
74
- endpoint: `${DB}.move`,
75
- });
76
- const deploy = postTool({
77
- name: `dokploy_${DB}_deploy`,
78
- title: 'Deploy MariaDB Database',
79
- description: 'Deploy a MariaDB database in Dokploy, pulling the configured Docker image and starting the container. Requires the MariaDB database ID. This triggers a full deployment lifecycle including image pull, container creation, and startup. Returns the deployment operation status.',
80
- schema: z.object({ mariadbId: mdbId }).strict(),
81
- endpoint: `${DB}.deploy`,
82
- });
83
- const start = postTool({
84
- name: `dokploy_${DB}_start`,
85
- title: 'Start MariaDB Database',
86
- description: 'Start a previously stopped MariaDB database container in Dokploy. Requires the MariaDB database ID. The container will resume with its existing data and configuration. Returns the operation status.',
87
- schema: z.object({ mariadbId: mdbId }).strict(),
88
- endpoint: `${DB}.start`,
89
- });
90
- const stop = postTool({
91
- name: `dokploy_${DB}_stop`,
92
- title: 'Stop MariaDB Database',
93
- description: 'Stop a currently running MariaDB database container in Dokploy. Requires the MariaDB database ID. The container will be gracefully stopped but its data and configuration are preserved for future restarts. Returns the operation status.',
94
- schema: z.object({ mariadbId: mdbId }).strict(),
95
- endpoint: `${DB}.stop`,
96
- annotations: { destructiveHint: true },
97
- });
98
- const reload = postTool({
99
- name: `dokploy_${DB}_reload`,
100
- title: 'Reload MariaDB Database',
101
- description: 'Reload the MariaDB database container in Dokploy without performing a full rebuild. Requires the MariaDB database ID and the app-level identifier. This restarts the container with its current configuration. Returns the operation status.',
102
- schema: z
103
- .object({
104
- mariadbId: mdbId,
105
- appName: z.string().min(1).describe('App-level identifier'),
106
- })
107
- .strict(),
108
- endpoint: `${DB}.reload`,
109
- });
110
- const rebuild = postTool({
111
- name: `dokploy_${DB}_rebuild`,
112
- title: 'Rebuild MariaDB Database',
113
- description: 'Rebuild the MariaDB database container from scratch in Dokploy. Requires the MariaDB 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.',
114
- schema: z.object({ mariadbId: mdbId }).strict(),
115
- endpoint: `${DB}.rebuild`,
116
- });
117
- const changeStatus = postTool({
118
- name: `dokploy_${DB}_change_status`,
119
- title: 'Change MariaDB Status',
120
- description: 'Manually set the application status of a MariaDB database in Dokploy. Requires the MariaDB 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.',
121
- schema: z
122
- .object({
123
- mariadbId: mdbId,
124
- applicationStatus: z
125
- .enum(['idle', 'running', 'done', 'error'])
126
- .describe('New application status'),
127
- })
128
- .strict(),
129
- endpoint: `${DB}.changeStatus`,
130
- });
131
- const saveExternalPort = postTool({
132
- name: `dokploy_${DB}_save_external_port`,
133
- title: 'Save MariaDB External Port',
134
- description: 'Set or clear the external port mapping for a MariaDB database in Dokploy. Requires the MariaDB 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.',
135
- schema: z
136
- .object({
137
- mariadbId: mdbId,
138
- externalPort: z.number().nullable().describe('External port number (null to remove)'),
139
- })
140
- .strict(),
141
- endpoint: `${DB}.saveExternalPort`,
142
- });
143
- const saveEnvironment = postTool({
144
- name: `dokploy_${DB}_save_environment`,
145
- title: 'Save MariaDB Environment',
146
- description: 'Overwrite the environment variables for a MariaDB database in Dokploy. Requires the MariaDB database ID and the environment variables as a string. This replaces all existing environment variables with the provided values. Returns the operation status.',
147
- schema: z
148
- .object({
149
- mariadbId: mdbId,
150
- env: z.string().nullable().optional().describe('Environment variables as a string'),
151
- })
152
- .strict(),
153
- endpoint: `${DB}.saveEnvironment`,
13
+ }),
154
14
  });
155
- // ── export ───────────────────────────────────────────────────────────
156
- export const mariadbTools = [
157
- one,
158
- create,
159
- update,
160
- remove,
161
- move,
162
- deploy,
163
- start,
164
- stop,
165
- reload,
166
- rebuild,
167
- changeStatus,
168
- saveExternalPort,
169
- saveEnvironment,
170
- ];
@@ -1,2 +1 @@
1
- import { type ToolDefinition } from './_factory.js';
2
- export declare const mongoTools: ToolDefinition[];
1
+ export declare const mongoTools: import("./_factory.js").ToolDefinition[];