@hanzo/platform-mcp 1.4.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.
- package/LICENSE +13 -0
- package/README.md +534 -0
- package/build/http-server.js +286 -0
- package/build/index.js +35 -0
- package/build/mcp/tools/application/applicationCleanQueues.js +23 -0
- package/build/mcp/tools/application/applicationCreate.js +39 -0
- package/build/mcp/tools/application/applicationDelete.js +21 -0
- package/build/mcp/tools/application/applicationDeploy.js +21 -0
- package/build/mcp/tools/application/applicationMarkRunning.js +23 -0
- package/build/mcp/tools/application/applicationMove.js +22 -0
- package/build/mcp/tools/application/applicationOne.js +26 -0
- package/build/mcp/tools/application/applicationReadAppMonitoring.js +26 -0
- package/build/mcp/tools/application/applicationReadTraefikConfig.js +26 -0
- package/build/mcp/tools/application/applicationRedeploy.js +23 -0
- package/build/mcp/tools/application/applicationRefreshToken.js +23 -0
- package/build/mcp/tools/application/applicationReload.js +22 -0
- package/build/mcp/tools/application/applicationSaveBitbucketProvider.js +49 -0
- package/build/mcp/tools/application/applicationSaveBuildType.js +56 -0
- package/build/mcp/tools/application/applicationSaveDockerProvider.js +43 -0
- package/build/mcp/tools/application/applicationSaveEnvironment.js +33 -0
- package/build/mcp/tools/application/applicationSaveGitProvider.js +49 -0
- package/build/mcp/tools/application/applicationSaveGiteaProvider.js +43 -0
- package/build/mcp/tools/application/applicationSaveGithubProvider.js +51 -0
- package/build/mcp/tools/application/applicationSaveGitlabProvider.js +48 -0
- package/build/mcp/tools/application/applicationStart.js +21 -0
- package/build/mcp/tools/application/applicationStop.js +21 -0
- package/build/mcp/tools/application/applicationUpdate.js +319 -0
- package/build/mcp/tools/application/applicationUpdateTraefikConfig.js +26 -0
- package/build/mcp/tools/application/index.js +24 -0
- package/build/mcp/tools/compose/composeCreate.js +31 -0
- package/build/mcp/tools/compose/composeDeploy.js +26 -0
- package/build/mcp/tools/compose/composeOne.js +24 -0
- package/build/mcp/tools/compose/composeReload.js +28 -0
- package/build/mcp/tools/compose/composeRemove.js +26 -0
- package/build/mcp/tools/compose/composeSaveEnvironment.js +28 -0
- package/build/mcp/tools/compose/composeStart.js +26 -0
- package/build/mcp/tools/compose/composeStop.js +26 -0
- package/build/mcp/tools/compose/composeUpdate.js +34 -0
- package/build/mcp/tools/compose/index.js +9 -0
- package/build/mcp/tools/index.js +12 -0
- package/build/mcp/tools/mysql/index.js +13 -0
- package/build/mcp/tools/mysql/mysqlChangeStatus.js +24 -0
- package/build/mcp/tools/mysql/mysqlCreate.js +50 -0
- package/build/mcp/tools/mysql/mysqlDeploy.js +21 -0
- package/build/mcp/tools/mysql/mysqlMove.js +24 -0
- package/build/mcp/tools/mysql/mysqlOne.js +23 -0
- package/build/mcp/tools/mysql/mysqlRebuild.js +21 -0
- package/build/mcp/tools/mysql/mysqlReload.js +22 -0
- package/build/mcp/tools/mysql/mysqlRemove.js +21 -0
- package/build/mcp/tools/mysql/mysqlSaveEnvironment.js +26 -0
- package/build/mcp/tools/mysql/mysqlSaveExternalPort.js +25 -0
- package/build/mcp/tools/mysql/mysqlStart.js +21 -0
- package/build/mcp/tools/mysql/mysqlStop.js +21 -0
- package/build/mcp/tools/mysql/mysqlUpdate.js +103 -0
- package/build/mcp/tools/postgres/index.js +13 -0
- package/build/mcp/tools/postgres/postgresChangeStatus.js +26 -0
- package/build/mcp/tools/postgres/postgresCreate.js +48 -0
- package/build/mcp/tools/postgres/postgresDeploy.js +23 -0
- package/build/mcp/tools/postgres/postgresMove.js +26 -0
- package/build/mcp/tools/postgres/postgresOne.js +26 -0
- package/build/mcp/tools/postgres/postgresRebuild.js +23 -0
- package/build/mcp/tools/postgres/postgresReload.js +26 -0
- package/build/mcp/tools/postgres/postgresRemove.js +23 -0
- package/build/mcp/tools/postgres/postgresSaveEnvironment.js +28 -0
- package/build/mcp/tools/postgres/postgresSaveExternalPort.js +27 -0
- package/build/mcp/tools/postgres/postgresStart.js +23 -0
- package/build/mcp/tools/postgres/postgresStop.js +23 -0
- package/build/mcp/tools/postgres/postgresUpdate.js +97 -0
- package/build/mcp/tools/project/index.js +6 -0
- package/build/mcp/tools/project/projectAll.js +68 -0
- package/build/mcp/tools/project/projectCreate.js +30 -0
- package/build/mcp/tools/project/projectDuplicate.js +54 -0
- package/build/mcp/tools/project/projectOne.js +24 -0
- package/build/mcp/tools/project/projectRemove.js +21 -0
- package/build/mcp/tools/project/projectUpdate.js +39 -0
- package/build/mcp/tools/toolFactory.js +60 -0
- package/build/server.js +12 -0
- package/build/types/platform.js +3 -0
- package/build/utils/apiClient.js +126 -0
- package/build/utils/clientConfig.js +37 -0
- package/build/utils/logger.js +38 -0
- package/build/utils/responseFormatter.js +33 -0
- package/package.json +63 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlChangeStatus = createTool({
|
|
6
|
+
name: "mysql-changeStatus",
|
|
7
|
+
description: "Changes the status of a MySQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to update."),
|
|
10
|
+
applicationStatus: z
|
|
11
|
+
.enum(["idle", "running", "done", "error"])
|
|
12
|
+
.describe("The new status for the MySQL database."),
|
|
13
|
+
}),
|
|
14
|
+
annotations: {
|
|
15
|
+
title: "Change MySQL Database Status",
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
idempotentHint: true,
|
|
18
|
+
openWorldHint: false,
|
|
19
|
+
},
|
|
20
|
+
handler: async (input) => {
|
|
21
|
+
const response = await apiClient.post("/mysql.changeStatus", input);
|
|
22
|
+
return ResponseFormatter.success(`MySQL database status changed to "${input.applicationStatus}" successfully`, response.data);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlCreate = createTool({
|
|
6
|
+
name: "mysql-create",
|
|
7
|
+
description: "Creates a new MySQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
name: z.string().min(1).describe("The name of the MySQL database."),
|
|
10
|
+
appName: z.string().min(1).describe("The app name for the MySQL database."),
|
|
11
|
+
databaseName: z
|
|
12
|
+
.string()
|
|
13
|
+
.min(1)
|
|
14
|
+
.describe("The name of the database to create."),
|
|
15
|
+
databaseUser: z
|
|
16
|
+
.string()
|
|
17
|
+
.min(1)
|
|
18
|
+
.describe("The username for database access."),
|
|
19
|
+
databasePassword: z.string().describe("The password for database access."),
|
|
20
|
+
databaseRootPassword: z.string().describe("The root password for MySQL."),
|
|
21
|
+
dockerImage: z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.default("mysql:8")
|
|
25
|
+
.describe("Docker image to use for MySQL."),
|
|
26
|
+
projectId: z
|
|
27
|
+
.string()
|
|
28
|
+
.describe("The ID of the project where the database will be created."),
|
|
29
|
+
description: z
|
|
30
|
+
.string()
|
|
31
|
+
.nullable()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("An optional description for the database."),
|
|
34
|
+
serverId: z
|
|
35
|
+
.string()
|
|
36
|
+
.nullable()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("The ID of the server where the database will be deployed."),
|
|
39
|
+
}),
|
|
40
|
+
annotations: {
|
|
41
|
+
title: "Create MySQL Database",
|
|
42
|
+
destructiveHint: false,
|
|
43
|
+
idempotentHint: false,
|
|
44
|
+
openWorldHint: true,
|
|
45
|
+
},
|
|
46
|
+
handler: async (input) => {
|
|
47
|
+
const response = await apiClient.post("/mysql.create", input);
|
|
48
|
+
return ResponseFormatter.success(`MySQL database "${input.name}" created successfully`, response.data);
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlDeploy = createTool({
|
|
6
|
+
name: "mysql-deploy",
|
|
7
|
+
description: "Deploys a MySQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to deploy."),
|
|
10
|
+
}),
|
|
11
|
+
annotations: {
|
|
12
|
+
title: "Deploy MySQL Database",
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
idempotentHint: false,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
},
|
|
17
|
+
handler: async (input) => {
|
|
18
|
+
const response = await apiClient.post("/mysql.deploy", input);
|
|
19
|
+
return ResponseFormatter.success("MySQL database deployed successfully", response.data);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlMove = createTool({
|
|
6
|
+
name: "mysql-move",
|
|
7
|
+
description: "Moves a MySQL database to a different project in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to move."),
|
|
10
|
+
targetProjectId: z
|
|
11
|
+
.string()
|
|
12
|
+
.describe("The ID of the target project to move the database to."),
|
|
13
|
+
}),
|
|
14
|
+
annotations: {
|
|
15
|
+
title: "Move MySQL Database",
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
idempotentHint: true,
|
|
18
|
+
openWorldHint: false,
|
|
19
|
+
},
|
|
20
|
+
handler: async (input) => {
|
|
21
|
+
const response = await apiClient.post("/mysql.move", input);
|
|
22
|
+
return ResponseFormatter.success("MySQL database moved successfully", response.data);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlOne = createTool({
|
|
6
|
+
name: "mysql-one",
|
|
7
|
+
description: "Gets a specific MySQL database by its ID in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to retrieve."),
|
|
10
|
+
}),
|
|
11
|
+
annotations: {
|
|
12
|
+
title: "Get MySQL Database",
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
idempotentHint: true,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
},
|
|
17
|
+
handler: async (input) => {
|
|
18
|
+
const response = await apiClient.get("/mysql.one", {
|
|
19
|
+
params: { mysqlId: input.mysqlId },
|
|
20
|
+
});
|
|
21
|
+
return ResponseFormatter.success("MySQL database retrieved successfully", response.data);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlRebuild = createTool({
|
|
6
|
+
name: "mysql-rebuild",
|
|
7
|
+
description: "Rebuilds a MySQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to rebuild."),
|
|
10
|
+
}),
|
|
11
|
+
annotations: {
|
|
12
|
+
title: "Rebuild MySQL Database",
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
idempotentHint: false,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
},
|
|
17
|
+
handler: async (input) => {
|
|
18
|
+
const response = await apiClient.post("/mysql.rebuild", input);
|
|
19
|
+
return ResponseFormatter.success("MySQL database rebuild initiated successfully", response.data);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlReload = createTool({
|
|
6
|
+
name: "mysql-reload",
|
|
7
|
+
description: "Reloads a MySQL database configuration in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to reload."),
|
|
10
|
+
appName: z.string().min(1).describe("The app name for the MySQL database."),
|
|
11
|
+
}),
|
|
12
|
+
annotations: {
|
|
13
|
+
title: "Reload MySQL Database",
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
idempotentHint: true,
|
|
16
|
+
openWorldHint: false,
|
|
17
|
+
},
|
|
18
|
+
handler: async (input) => {
|
|
19
|
+
const response = await apiClient.post("/mysql.reload", input);
|
|
20
|
+
return ResponseFormatter.success("MySQL database reloaded successfully", response.data);
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlRemove = createTool({
|
|
6
|
+
name: "mysql-remove",
|
|
7
|
+
description: "Removes a MySQL database from Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to remove."),
|
|
10
|
+
}),
|
|
11
|
+
annotations: {
|
|
12
|
+
title: "Remove MySQL Database",
|
|
13
|
+
destructiveHint: true,
|
|
14
|
+
idempotentHint: false,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
},
|
|
17
|
+
handler: async (input) => {
|
|
18
|
+
const response = await apiClient.post("/mysql.remove", input);
|
|
19
|
+
return ResponseFormatter.success("MySQL database removed successfully", response.data);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlSaveEnvironment = createTool({
|
|
6
|
+
name: "mysql-saveEnvironment",
|
|
7
|
+
description: "Saves environment variables for a MySQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to configure."),
|
|
10
|
+
env: z
|
|
11
|
+
.string()
|
|
12
|
+
.nullable()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Environment variables to set for the MySQL database."),
|
|
15
|
+
}),
|
|
16
|
+
annotations: {
|
|
17
|
+
title: "Save MySQL Environment Variables",
|
|
18
|
+
destructiveHint: false,
|
|
19
|
+
idempotentHint: true,
|
|
20
|
+
openWorldHint: false,
|
|
21
|
+
},
|
|
22
|
+
handler: async (input) => {
|
|
23
|
+
const response = await apiClient.post("/mysql.saveEnvironment", input);
|
|
24
|
+
return ResponseFormatter.success("MySQL environment variables saved successfully", response.data);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlSaveExternalPort = createTool({
|
|
6
|
+
name: "mysql-saveExternalPort",
|
|
7
|
+
description: "Saves external port configuration for a MySQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to configure."),
|
|
10
|
+
externalPort: z
|
|
11
|
+
.number()
|
|
12
|
+
.nullable()
|
|
13
|
+
.describe("The external port number to expose the database on."),
|
|
14
|
+
}),
|
|
15
|
+
annotations: {
|
|
16
|
+
title: "Save MySQL External Port",
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
idempotentHint: true,
|
|
19
|
+
openWorldHint: false,
|
|
20
|
+
},
|
|
21
|
+
handler: async (input) => {
|
|
22
|
+
const response = await apiClient.post("/mysql.saveExternalPort", input);
|
|
23
|
+
return ResponseFormatter.success("MySQL external port configuration saved successfully", response.data);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlStart = createTool({
|
|
6
|
+
name: "mysql-start",
|
|
7
|
+
description: "Starts a MySQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to start."),
|
|
10
|
+
}),
|
|
11
|
+
annotations: {
|
|
12
|
+
title: "Start MySQL Database",
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
idempotentHint: true,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
},
|
|
17
|
+
handler: async (input) => {
|
|
18
|
+
const response = await apiClient.post("/mysql.start", input);
|
|
19
|
+
return ResponseFormatter.success("MySQL database started successfully", response.data);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlStop = createTool({
|
|
6
|
+
name: "mysql-stop",
|
|
7
|
+
description: "Stops a MySQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z.string().describe("The ID of the MySQL database to stop."),
|
|
10
|
+
}),
|
|
11
|
+
annotations: {
|
|
12
|
+
title: "Stop MySQL Database",
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
idempotentHint: true,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
},
|
|
17
|
+
handler: async (input) => {
|
|
18
|
+
const response = await apiClient.post("/mysql.stop", input);
|
|
19
|
+
return ResponseFormatter.success("MySQL database stopped successfully", response.data);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const mysqlUpdate = createTool({
|
|
6
|
+
name: "mysql-update",
|
|
7
|
+
description: "Updates a MySQL database configuration in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
mysqlId: z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1)
|
|
12
|
+
.describe("The ID of the MySQL database to update."),
|
|
13
|
+
name: z
|
|
14
|
+
.string()
|
|
15
|
+
.min(1)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("The name of the MySQL database."),
|
|
18
|
+
appName: z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("The app name for the MySQL database."),
|
|
23
|
+
description: z
|
|
24
|
+
.string()
|
|
25
|
+
.nullable()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("An optional description for the database."),
|
|
28
|
+
databaseName: z
|
|
29
|
+
.string()
|
|
30
|
+
.min(1)
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("The name of the database."),
|
|
33
|
+
databaseUser: z
|
|
34
|
+
.string()
|
|
35
|
+
.min(1)
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("The username for database access."),
|
|
38
|
+
databasePassword: z
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("The password for database access."),
|
|
42
|
+
databaseRootPassword: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("The root password for MySQL."),
|
|
46
|
+
dockerImage: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.default("mysql:8")
|
|
50
|
+
.describe("Docker image to use for MySQL."),
|
|
51
|
+
command: z
|
|
52
|
+
.string()
|
|
53
|
+
.nullable()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe("Custom command to run in the container."),
|
|
56
|
+
env: z
|
|
57
|
+
.string()
|
|
58
|
+
.nullable()
|
|
59
|
+
.optional()
|
|
60
|
+
.describe("Environment variables for the database."),
|
|
61
|
+
memoryReservation: z
|
|
62
|
+
.string()
|
|
63
|
+
.nullable()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("Memory reservation for the container."),
|
|
66
|
+
memoryLimit: z
|
|
67
|
+
.string()
|
|
68
|
+
.nullable()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Memory limit for the container."),
|
|
71
|
+
cpuReservation: z
|
|
72
|
+
.string()
|
|
73
|
+
.nullable()
|
|
74
|
+
.optional()
|
|
75
|
+
.describe("CPU reservation for the container."),
|
|
76
|
+
cpuLimit: z
|
|
77
|
+
.string()
|
|
78
|
+
.nullable()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe("CPU limit for the container."),
|
|
81
|
+
externalPort: z
|
|
82
|
+
.number()
|
|
83
|
+
.nullable()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe("External port to expose the database on."),
|
|
86
|
+
applicationStatus: z
|
|
87
|
+
.enum(["idle", "running", "done", "error"])
|
|
88
|
+
.optional()
|
|
89
|
+
.describe("The status of the MySQL database."),
|
|
90
|
+
createdAt: z.string().optional().describe("Creation timestamp."),
|
|
91
|
+
projectId: z.string().optional().describe("The ID of the project."),
|
|
92
|
+
}),
|
|
93
|
+
annotations: {
|
|
94
|
+
title: "Update MySQL Database",
|
|
95
|
+
destructiveHint: false,
|
|
96
|
+
idempotentHint: true,
|
|
97
|
+
openWorldHint: true,
|
|
98
|
+
},
|
|
99
|
+
handler: async (input) => {
|
|
100
|
+
const response = await apiClient.post("/mysql.update", input);
|
|
101
|
+
return ResponseFormatter.success("MySQL database updated successfully", response.data);
|
|
102
|
+
},
|
|
103
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { postgresChangeStatus } from "./postgresChangeStatus.js";
|
|
2
|
+
export { postgresCreate } from "./postgresCreate.js";
|
|
3
|
+
export { postgresDeploy } from "./postgresDeploy.js";
|
|
4
|
+
export { postgresMove } from "./postgresMove.js";
|
|
5
|
+
export { postgresOne } from "./postgresOne.js";
|
|
6
|
+
export { postgresRebuild } from "./postgresRebuild.js";
|
|
7
|
+
export { postgresReload } from "./postgresReload.js";
|
|
8
|
+
export { postgresRemove } from "./postgresRemove.js";
|
|
9
|
+
export { postgresSaveEnvironment } from "./postgresSaveEnvironment.js";
|
|
10
|
+
export { postgresSaveExternalPort } from "./postgresSaveExternalPort.js";
|
|
11
|
+
export { postgresStart } from "./postgresStart.js";
|
|
12
|
+
export { postgresStop } from "./postgresStop.js";
|
|
13
|
+
export { postgresUpdate } from "./postgresUpdate.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const postgresChangeStatus = createTool({
|
|
6
|
+
name: "postgres-changeStatus",
|
|
7
|
+
description: "Changes the status of a PostgreSQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
postgresId: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The ID of the PostgreSQL database to change status for."),
|
|
12
|
+
applicationStatus: z
|
|
13
|
+
.enum(["idle", "running", "done", "error"])
|
|
14
|
+
.describe("The new status for the PostgreSQL database."),
|
|
15
|
+
}),
|
|
16
|
+
annotations: {
|
|
17
|
+
title: "Change PostgreSQL Database Status",
|
|
18
|
+
destructiveHint: true,
|
|
19
|
+
idempotentHint: false,
|
|
20
|
+
openWorldHint: true,
|
|
21
|
+
},
|
|
22
|
+
handler: async (input) => {
|
|
23
|
+
const response = await apiClient.post("/postgres.changeStatus", input);
|
|
24
|
+
return ResponseFormatter.success(`PostgreSQL database "${input.postgresId}" status changed to "${input.applicationStatus}" successfully`, response.data);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const postgresCreate = createTool({
|
|
6
|
+
name: "postgres-create",
|
|
7
|
+
description: "Creates a new PostgreSQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
name: z.string().min(1).describe("The name of the PostgreSQL database."),
|
|
10
|
+
appName: z.string().describe("The app name for the PostgreSQL database."),
|
|
11
|
+
databaseName: z
|
|
12
|
+
.string()
|
|
13
|
+
.min(1)
|
|
14
|
+
.describe("The name of the database to create."),
|
|
15
|
+
databaseUser: z
|
|
16
|
+
.string()
|
|
17
|
+
.min(1)
|
|
18
|
+
.describe("The username for database access."),
|
|
19
|
+
databasePassword: z.string().describe("The password for database access."),
|
|
20
|
+
dockerImage: z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe("Docker image to use for PostgreSQL."),
|
|
24
|
+
projectId: z
|
|
25
|
+
.string()
|
|
26
|
+
.describe("The ID of the project where the database will be created."),
|
|
27
|
+
description: z
|
|
28
|
+
.string()
|
|
29
|
+
.nullable()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("An optional description for the database."),
|
|
32
|
+
serverId: z
|
|
33
|
+
.string()
|
|
34
|
+
.nullable()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("The ID of the server where the database will be deployed."),
|
|
37
|
+
}),
|
|
38
|
+
annotations: {
|
|
39
|
+
title: "Create PostgreSQL Database",
|
|
40
|
+
destructiveHint: false,
|
|
41
|
+
idempotentHint: false,
|
|
42
|
+
openWorldHint: true,
|
|
43
|
+
},
|
|
44
|
+
handler: async (input) => {
|
|
45
|
+
const response = await apiClient.post("/postgres.create", input);
|
|
46
|
+
return ResponseFormatter.success(`PostgreSQL database "${input.name}" created successfully`, response.data);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const postgresDeploy = createTool({
|
|
6
|
+
name: "postgres-deploy",
|
|
7
|
+
description: "Deploys a PostgreSQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
postgresId: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The ID of the PostgreSQL database to deploy."),
|
|
12
|
+
}),
|
|
13
|
+
annotations: {
|
|
14
|
+
title: "Deploy PostgreSQL Database",
|
|
15
|
+
destructiveHint: true,
|
|
16
|
+
idempotentHint: false,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
},
|
|
19
|
+
handler: async (input) => {
|
|
20
|
+
const response = await apiClient.post("/postgres.deploy", input);
|
|
21
|
+
return ResponseFormatter.success(`PostgreSQL database "${input.postgresId}" deployment started successfully`, response.data);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const postgresMove = createTool({
|
|
6
|
+
name: "postgres-move",
|
|
7
|
+
description: "Moves a PostgreSQL database to a different project in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
postgresId: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The ID of the PostgreSQL database to move."),
|
|
12
|
+
targetProjectId: z
|
|
13
|
+
.string()
|
|
14
|
+
.describe("The ID of the target project to move the database to."),
|
|
15
|
+
}),
|
|
16
|
+
annotations: {
|
|
17
|
+
title: "Move PostgreSQL Database",
|
|
18
|
+
destructiveHint: true,
|
|
19
|
+
idempotentHint: false,
|
|
20
|
+
openWorldHint: true,
|
|
21
|
+
},
|
|
22
|
+
handler: async (input) => {
|
|
23
|
+
const response = await apiClient.post("/postgres.move", input);
|
|
24
|
+
return ResponseFormatter.success(`PostgreSQL database "${input.postgresId}" moved to project "${input.targetProjectId}" successfully`, response.data);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const postgresOne = createTool({
|
|
6
|
+
name: "postgres-one",
|
|
7
|
+
description: "Gets a specific PostgreSQL database by its ID in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
postgresId: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The ID of the PostgreSQL database to retrieve."),
|
|
12
|
+
}),
|
|
13
|
+
annotations: {
|
|
14
|
+
title: "Get PostgreSQL Database Details",
|
|
15
|
+
readOnlyHint: true,
|
|
16
|
+
idempotentHint: true,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
},
|
|
19
|
+
handler: async (input) => {
|
|
20
|
+
const postgres = await apiClient.get(`/postgres.one?postgresId=${input.postgresId}`);
|
|
21
|
+
if (!postgres?.data) {
|
|
22
|
+
return ResponseFormatter.error("Failed to fetch PostgreSQL database", `PostgreSQL database with ID "${input.postgresId}" not found`);
|
|
23
|
+
}
|
|
24
|
+
return ResponseFormatter.success(`Successfully fetched PostgreSQL database "${input.postgresId}"`, postgres.data);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const postgresRebuild = createTool({
|
|
6
|
+
name: "postgres-rebuild",
|
|
7
|
+
description: "Rebuilds a PostgreSQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
postgresId: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The ID of the PostgreSQL database to rebuild."),
|
|
12
|
+
}),
|
|
13
|
+
annotations: {
|
|
14
|
+
title: "Rebuild PostgreSQL Database",
|
|
15
|
+
destructiveHint: true,
|
|
16
|
+
idempotentHint: false,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
},
|
|
19
|
+
handler: async (input) => {
|
|
20
|
+
const response = await apiClient.post("/postgres.rebuild", input);
|
|
21
|
+
return ResponseFormatter.success(`PostgreSQL database "${input.postgresId}" rebuild started successfully`, response.data);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const postgresReload = createTool({
|
|
6
|
+
name: "postgres-reload",
|
|
7
|
+
description: "Reloads a PostgreSQL database in Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
postgresId: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The ID of the PostgreSQL database to reload."),
|
|
12
|
+
appName: z
|
|
13
|
+
.string()
|
|
14
|
+
.describe("The app name of the PostgreSQL database to reload."),
|
|
15
|
+
}),
|
|
16
|
+
annotations: {
|
|
17
|
+
title: "Reload PostgreSQL Database",
|
|
18
|
+
destructiveHint: true,
|
|
19
|
+
idempotentHint: false,
|
|
20
|
+
openWorldHint: true,
|
|
21
|
+
},
|
|
22
|
+
handler: async (input) => {
|
|
23
|
+
const response = await apiClient.post("/postgres.reload", input);
|
|
24
|
+
return ResponseFormatter.success(`PostgreSQL database "${input.postgresId}" reloaded successfully`, response.data);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import apiClient from "../../../utils/apiClient.js";
|
|
3
|
+
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
|
|
4
|
+
import { createTool } from "../toolFactory.js";
|
|
5
|
+
export const postgresRemove = createTool({
|
|
6
|
+
name: "postgres-remove",
|
|
7
|
+
description: "Removes/deletes a PostgreSQL database from Platform.",
|
|
8
|
+
schema: z.object({
|
|
9
|
+
postgresId: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The ID of the PostgreSQL database to remove."),
|
|
12
|
+
}),
|
|
13
|
+
annotations: {
|
|
14
|
+
title: "Remove PostgreSQL Database",
|
|
15
|
+
destructiveHint: true,
|
|
16
|
+
idempotentHint: false,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
},
|
|
19
|
+
handler: async (input) => {
|
|
20
|
+
const response = await apiClient.post("/postgres.remove", input);
|
|
21
|
+
return ResponseFormatter.success(`PostgreSQL database "${input.postgresId}" removed successfully`, response.data);
|
|
22
|
+
},
|
|
23
|
+
});
|