ncloud-mcp-server 1.0.4 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -2
- package/README_EN.md +18 -2
- package/dist/index.js +12 -331
- package/dist/index.js.map +1 -1
- package/dist/tools/_response.d.ts +69 -0
- package/dist/tools/_response.js +96 -0
- package/dist/tools/_response.js.map +1 -0
- package/dist/tools/acg.js +10 -9
- package/dist/tools/acg.js.map +1 -1
- package/dist/tools/activity-tracer.js +4 -3
- package/dist/tools/activity-tracer.js.map +1 -1
- package/dist/tools/analytics-cdss.js +51 -50
- package/dist/tools/analytics-cdss.js.map +1 -1
- package/dist/tools/analytics-datacatalog.js +22 -21
- package/dist/tools/analytics-datacatalog.js.map +1 -1
- package/dist/tools/analytics-dataflow.js +27 -26
- package/dist/tools/analytics-dataflow.js.map +1 -1
- package/dist/tools/analytics-dataforest.js +25 -24
- package/dist/tools/analytics-dataforest.js.map +1 -1
- package/dist/tools/analytics-dataquery.js +6 -5
- package/dist/tools/analytics-dataquery.js.map +1 -1
- package/dist/tools/analytics-datastream.js +22 -21
- package/dist/tools/analytics-datastream.js.map +1 -1
- package/dist/tools/analytics-hadoop.js +30 -29
- package/dist/tools/analytics-hadoop.js.map +1 -1
- package/dist/tools/analytics-ses.js +43 -42
- package/dist/tools/analytics-ses.js.map +1 -1
- package/dist/tools/api-gateway.js +13 -12
- package/dist/tools/api-gateway.js.map +1 -1
- package/dist/tools/autoscaling.js +25 -24
- package/dist/tools/autoscaling.js.map +1 -1
- package/dist/tools/billing.d.ts +0 -11
- package/dist/tools/billing.js +210 -48
- package/dist/tools/billing.js.map +1 -1
- package/dist/tools/certificate-manager.js +4 -3
- package/dist/tools/certificate-manager.js.map +1 -1
- package/dist/tools/cloud-advisor.js +16 -15
- package/dist/tools/cloud-advisor.js.map +1 -1
- package/dist/tools/cloud-functions.js +22 -21
- package/dist/tools/cloud-functions.js.map +1 -1
- package/dist/tools/cloud-insight-integration.js +56 -35
- package/dist/tools/cloud-insight-integration.js.map +1 -1
- package/dist/tools/cloud-insight-plugin.js +291 -353
- package/dist/tools/cloud-insight-plugin.js.map +1 -1
- package/dist/tools/cloud-insight-rule.js +28 -27
- package/dist/tools/cloud-insight-rule.js.map +1 -1
- package/dist/tools/cloud-insight.js +12 -11
- package/dist/tools/cloud-insight.js.map +1 -1
- package/dist/tools/common.js +6 -5
- package/dist/tools/common.js.map +1 -1
- package/dist/tools/compute-initscript.js +5 -4
- package/dist/tools/compute-initscript.js.map +1 -1
- package/dist/tools/compute-loginkey.js +5 -4
- package/dist/tools/compute-loginkey.js.map +1 -1
- package/dist/tools/compute-placement.js +14 -13
- package/dist/tools/compute-placement.js.map +1 -1
- package/dist/tools/compute-publicip.js +8 -7
- package/dist/tools/compute-publicip.js.map +1 -1
- package/dist/tools/compute-server.js +29 -28
- package/dist/tools/compute-server.js.map +1 -1
- package/dist/tools/compute-storage.js +16 -15
- package/dist/tools/compute-storage.js.map +1 -1
- package/dist/tools/containers-nks.js +38 -37
- package/dist/tools/containers-nks.js.map +1 -1
- package/dist/tools/containers-registry.js +13 -12
- package/dist/tools/containers-registry.js.map +1 -1
- package/dist/tools/database-cache.js +25 -24
- package/dist/tools/database-cache.js.map +1 -1
- package/dist/tools/database-mongodb.js +25 -24
- package/dist/tools/database-mongodb.js.map +1 -1
- package/dist/tools/database-mssql.js +23 -22
- package/dist/tools/database-mssql.js.map +1 -1
- package/dist/tools/database-mysql.js +30 -29
- package/dist/tools/database-mysql.js.map +1 -1
- package/dist/tools/database-postgresql.js +26 -25
- package/dist/tools/database-postgresql.js.map +1 -1
- package/dist/tools/global-dns.js +13 -12
- package/dist/tools/global-dns.js.map +1 -1
- package/dist/tools/global-edge.js +21 -20
- package/dist/tools/global-edge.js.map +1 -1
- package/dist/tools/global-traffic-manager.js +27 -26
- package/dist/tools/global-traffic-manager.js.map +1 -1
- package/dist/tools/kms.js +52 -39
- package/dist/tools/kms.js.map +1 -1
- package/dist/tools/loadbalancer.js +17 -16
- package/dist/tools/loadbalancer.js.map +1 -1
- package/dist/tools/log-analytics.js +118 -110
- package/dist/tools/log-analytics.js.map +1 -1
- package/dist/tools/media-imageoptimizer.js +10 -9
- package/dist/tools/media-imageoptimizer.js.map +1 -1
- package/dist/tools/media-livestation.js +13 -12
- package/dist/tools/media-livestation.js.map +1 -1
- package/dist/tools/media-vodstation.js +11 -10
- package/dist/tools/media-vodstation.js.map +1 -1
- package/dist/tools/nat-gateway.js +6 -5
- package/dist/tools/nat-gateway.js.map +1 -1
- package/dist/tools/network-acl.js +18 -17
- package/dist/tools/network-acl.js.map +1 -1
- package/dist/tools/network-interface.js +15 -14
- package/dist/tools/network-interface.js.map +1 -1
- package/dist/tools/private-ca.js +32 -23
- package/dist/tools/private-ca.js.map +1 -1
- package/dist/tools/registry.d.ts +49 -0
- package/dist/tools/registry.js +254 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/resource-manager.js +7 -6
- package/dist/tools/resource-manager.js.map +1 -1
- package/dist/tools/route-table.js +12 -11
- package/dist/tools/route-table.js.map +1 -1
- package/dist/tools/security-monitoring.js +120 -129
- package/dist/tools/security-monitoring.js.map +1 -1
- package/dist/tools/sens.js +7 -6
- package/dist/tools/sens.js.map +1 -1
- package/dist/tools/sourcebuild.js +18 -17
- package/dist/tools/sourcebuild.js.map +1 -1
- package/dist/tools/sourcecommit.js +13 -12
- package/dist/tools/sourcecommit.js.map +1 -1
- package/dist/tools/sourcedeploy.js +35 -34
- package/dist/tools/sourcedeploy.js.map +1 -1
- package/dist/tools/sourcepipeline.js +18 -17
- package/dist/tools/sourcepipeline.js.map +1 -1
- package/dist/tools/storage-archive.js +13 -12
- package/dist/tools/storage-archive.js.map +1 -1
- package/dist/tools/storage-nas.js +20 -19
- package/dist/tools/storage-nas.js.map +1 -1
- package/dist/tools/storage-ncloud.js +25 -24
- package/dist/tools/storage-ncloud.js.map +1 -1
- package/dist/tools/storage-object.js +29 -28
- package/dist/tools/storage-object.js.map +1 -1
- package/dist/tools/sub-account.js +19 -18
- package/dist/tools/sub-account.js.map +1 -1
- package/dist/tools/target-group.js +12 -11
- package/dist/tools/target-group.js.map +1 -1
- package/dist/tools/vpc-peering.js +8 -7
- package/dist/tools/vpc-peering.js.map +1 -1
- package/dist/tools/vpc.js +11 -10
- package/dist/tools/vpc.js.map +1 -1
- package/package.json +1 -1
- package/dist/auth/signature.test.d.ts +0 -1
- package/dist/auth/signature.test.js +0 -90
- package/dist/auth/signature.test.js.map +0 -1
- package/dist/client/ncloud-client.test.d.ts +0 -1
- package/dist/client/ncloud-client.test.js +0 -477
- package/dist/client/ncloud-client.test.js.map +0 -1
- package/dist/tools/compute-server.test.d.ts +0 -1
- package/dist/tools/compute-server.test.js +0 -224
- package/dist/tools/compute-server.test.js.map +0 -1
|
@@ -1,596 +1,534 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { toolText } from "./_response.js";
|
|
3
|
+
// Cloud Insight Plugin / Custom Resource / Schema / Planned Maintenance APIs
|
|
4
|
+
// Base: https://cw.apigw.ntruss.com. 경로/메서드/필드는 공식 docs(management-cloudinsight-*) 기준.
|
|
5
|
+
// - Plugin(process/port/file): prefix /cw_server/real/api/plugin/...
|
|
6
|
+
// - Custom Resource / Schema / Planned Maintenance: prefix /cw_fea/real/cw/api/...
|
|
7
|
+
const CW_SERVER = "/cw_server/real/api/plugin";
|
|
8
|
+
const CW = "/cw_fea/real/cw/api";
|
|
9
|
+
const targetType = z
|
|
10
|
+
.enum(["vpcserver", "classicserver", "cloudhadoop"])
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("Target type (default 'vpcserver')");
|
|
2
13
|
export function registerCloudInsightPluginTools(server, client) {
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
server.tool("ncloud_list_process_plugins", "Get the list of Cloud Insight process monitoring plugins.", {
|
|
6
|
-
instanceNo: z.string().optional().describe("Server instance number to filter plugins"),
|
|
7
|
-
}, async (params) => {
|
|
14
|
+
// ─── Process plugin ─────────────────────────────────────────────────────
|
|
15
|
+
server.tool("ncloud_list_process_plugins", "Get the full list of Cloud Insight process monitoring plugins.", {}, async () => {
|
|
8
16
|
try {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
body.instanceNo = params.instanceNo;
|
|
12
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/plugin/process", body);
|
|
13
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
17
|
+
const result = await client.requestRaw("GET", `${CW_SERVER}/process`);
|
|
18
|
+
return toolText(result);
|
|
14
19
|
}
|
|
15
20
|
catch (error) {
|
|
16
21
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
17
22
|
}
|
|
18
23
|
});
|
|
19
|
-
|
|
20
|
-
server.tool("ncloud_add_process_plugin", "Add a process monitoring plugin to Cloud Insight for monitoring specific processes on a server.", {
|
|
21
|
-
instanceNo: z.string().describe("Server instance number to add the plugin to"),
|
|
22
|
-
processName: z.string().describe("Name of the process to monitor"),
|
|
23
|
-
}, async (params) => {
|
|
24
|
+
server.tool("ncloud_get_process_plugin", "Get process monitoring plugin configuration for a specific server instance.", { instanceNo: z.string().describe("Server instance number") }, async (params) => {
|
|
24
25
|
try {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
processName: params.processName,
|
|
28
|
-
};
|
|
29
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/plugin/process/add", body);
|
|
30
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
26
|
+
const result = await client.requestRaw("GET", `${CW_SERVER}/process/instanceNo/${params.instanceNo}`);
|
|
27
|
+
return toolText(result);
|
|
31
28
|
}
|
|
32
29
|
catch (error) {
|
|
33
30
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
34
31
|
}
|
|
35
32
|
});
|
|
36
|
-
|
|
37
|
-
server.tool("ncloud_remove_process_plugin", "⚠️ Destructive: Remove a process monitoring plugin from Cloud Insight.", {
|
|
33
|
+
server.tool("ncloud_add_process_plugin", "Add process monitoring plugin(s) to a server instance. Provide one or more process names (wildcards like *abc* allowed).", {
|
|
38
34
|
instanceNo: z.string().describe("Server instance number"),
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
configList: z.array(z.string()).min(1).describe("Process names to monitor"),
|
|
36
|
+
type: targetType,
|
|
41
37
|
}, async (params) => {
|
|
42
38
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}],
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const body = {
|
|
52
|
-
instanceNo: params.instanceNo,
|
|
53
|
-
processName: params.processName,
|
|
54
|
-
};
|
|
55
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/plugin/process/remove", body);
|
|
56
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39
|
+
const body = { instanceNo: params.instanceNo, configList: params.configList };
|
|
40
|
+
if (params.type !== undefined)
|
|
41
|
+
body.type = params.type;
|
|
42
|
+
const result = await client.postRequest(`${CW_SERVER}/process/add`, body);
|
|
43
|
+
return toolText(result);
|
|
57
44
|
}
|
|
58
45
|
catch (error) {
|
|
59
46
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
60
47
|
}
|
|
61
48
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
server.tool("ncloud_remove_process_plugin", "⚠️ Destructive: Remove process monitoring plugin(s) from a server instance. Set confirm=true to execute.", {
|
|
50
|
+
instanceNo: z.string().describe("Server instance number"),
|
|
51
|
+
configList: z.array(z.string()).min(1).describe("Process names to remove"),
|
|
52
|
+
type: targetType,
|
|
53
|
+
confirm: z.boolean().optional().default(false).describe("Must be true to actually execute the destructive operation"),
|
|
65
54
|
}, async (params) => {
|
|
66
55
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
56
|
+
if (!params.confirm) {
|
|
57
|
+
return { content: [{ type: "text", text: `⚠️ This will remove process plugins [${params.configList.join(", ")}] from instance [${params.instanceNo}]. To execute, call again with confirm=true.` }] };
|
|
58
|
+
}
|
|
59
|
+
const body = { instanceNo: params.instanceNo, configList: params.configList };
|
|
60
|
+
if (params.type !== undefined)
|
|
61
|
+
body.type = params.type;
|
|
62
|
+
const result = await client.postRequest(`${CW_SERVER}/process/remove`, body);
|
|
63
|
+
return toolText(result);
|
|
72
64
|
}
|
|
73
65
|
catch (error) {
|
|
74
66
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
75
67
|
}
|
|
76
68
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
server.tool("ncloud_set_process_plugins", "Replace the full set of process monitoring plugins for a server instance (sends the entire list).", {
|
|
70
|
+
instanceNo: z.string().describe("Server instance number"),
|
|
71
|
+
configList: z.array(z.string()).describe("Full list of process names to monitor (replaces existing)"),
|
|
72
|
+
type: targetType,
|
|
81
73
|
}, async (params) => {
|
|
82
74
|
try {
|
|
83
|
-
const body = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
75
|
+
const body = { instanceNo: params.instanceNo, configList: params.configList };
|
|
76
|
+
if (params.type !== undefined)
|
|
77
|
+
body.type = params.type;
|
|
78
|
+
const result = await client.postRequest(`${CW_SERVER}/process`, body);
|
|
79
|
+
return toolText(result);
|
|
89
80
|
}
|
|
90
81
|
catch (error) {
|
|
91
82
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
92
83
|
}
|
|
93
84
|
});
|
|
94
|
-
//
|
|
95
|
-
server.tool("
|
|
96
|
-
instanceNo: z.string().describe("Server instance number"),
|
|
97
|
-
portNumber: z.number().describe("Port number of the plugin to remove"),
|
|
98
|
-
confirm: z.boolean().optional().describe("Must be true to execute deletion. If false or omitted, returns a confirmation prompt."),
|
|
99
|
-
}, async (params) => {
|
|
85
|
+
// ─── Port plugin ────────────────────────────────────────────────────────
|
|
86
|
+
server.tool("ncloud_list_port_plugins", "Get the full list of Cloud Insight port monitoring plugins.", {}, async () => {
|
|
100
87
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
content: [{
|
|
104
|
-
type: "text",
|
|
105
|
-
text: `⚠️ This will permanently remove port plugin [${params.portNumber}] from instance [${params.instanceNo}]. Do you want to proceed? (yes/no)\n\nTo confirm, call this tool again with confirm=true.`,
|
|
106
|
-
}],
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
const body = {
|
|
110
|
-
instanceNo: params.instanceNo,
|
|
111
|
-
portNumber: params.portNumber,
|
|
112
|
-
};
|
|
113
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/plugin/port/remove", body);
|
|
114
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
88
|
+
const result = await client.requestRaw("GET", `${CW_SERVER}/port`);
|
|
89
|
+
return toolText(result);
|
|
115
90
|
}
|
|
116
91
|
catch (error) {
|
|
117
92
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
118
93
|
}
|
|
119
94
|
});
|
|
120
|
-
|
|
121
|
-
server.tool("ncloud_list_file_plugins", "Get the list of Cloud Insight file monitoring plugins.", {
|
|
122
|
-
instanceNo: z.string().optional().describe("Server instance number to filter plugins"),
|
|
123
|
-
}, async (params) => {
|
|
95
|
+
server.tool("ncloud_get_port_plugin", "Get port monitoring plugin configuration for a specific server instance.", { instanceNo: z.string().describe("Server instance number") }, async (params) => {
|
|
124
96
|
try {
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
body.instanceNo = params.instanceNo;
|
|
128
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/plugin/file", body);
|
|
129
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
97
|
+
const result = await client.requestRaw("GET", `${CW_SERVER}/port/instanceNo/${params.instanceNo}`);
|
|
98
|
+
return toolText(result);
|
|
130
99
|
}
|
|
131
100
|
catch (error) {
|
|
132
101
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
133
102
|
}
|
|
134
103
|
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
104
|
+
server.tool("ncloud_add_port_plugin", "Add port monitoring plugin(s) to a server instance.", {
|
|
105
|
+
instanceNo: z.string().describe("Server instance number"),
|
|
106
|
+
portList: z.array(z.number()).min(1).describe("Port numbers to monitor"),
|
|
107
|
+
type: targetType,
|
|
139
108
|
}, async (params) => {
|
|
140
109
|
try {
|
|
141
|
-
const body = {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
110
|
+
const body = { instanceNo: params.instanceNo, portList: params.portList };
|
|
111
|
+
if (params.type !== undefined)
|
|
112
|
+
body.type = params.type;
|
|
113
|
+
const result = await client.postRequest(`${CW_SERVER}/port/add`, body);
|
|
114
|
+
return toolText(result);
|
|
147
115
|
}
|
|
148
116
|
catch (error) {
|
|
149
117
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
150
118
|
}
|
|
151
119
|
});
|
|
152
|
-
|
|
153
|
-
server.tool("ncloud_remove_file_plugin", "⚠️ Destructive: Remove a file monitoring plugin from Cloud Insight.", {
|
|
120
|
+
server.tool("ncloud_remove_port_plugin", "⚠️ Destructive: Remove port monitoring plugin(s) from a server instance. Set confirm=true to execute.", {
|
|
154
121
|
instanceNo: z.string().describe("Server instance number"),
|
|
155
|
-
|
|
156
|
-
|
|
122
|
+
portList: z.array(z.number()).min(1).describe("Port numbers to remove"),
|
|
123
|
+
type: targetType,
|
|
124
|
+
confirm: z.boolean().optional().default(false).describe("Must be true to actually execute the destructive operation"),
|
|
157
125
|
}, async (params) => {
|
|
158
126
|
try {
|
|
159
127
|
if (!params.confirm) {
|
|
160
|
-
return {
|
|
161
|
-
content: [{
|
|
162
|
-
type: "text",
|
|
163
|
-
text: `⚠️ This will permanently remove file plugin [${params.filePath}] from instance [${params.instanceNo}]. Do you want to proceed? (yes/no)\n\nTo confirm, call this tool again with confirm=true.`,
|
|
164
|
-
}],
|
|
165
|
-
};
|
|
128
|
+
return { content: [{ type: "text", text: `⚠️ This will remove port plugins [${params.portList.join(", ")}] from instance [${params.instanceNo}]. To execute, call again with confirm=true.` }] };
|
|
166
129
|
}
|
|
167
|
-
const body = {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
130
|
+
const body = { instanceNo: params.instanceNo, portList: params.portList };
|
|
131
|
+
if (params.type !== undefined)
|
|
132
|
+
body.type = params.type;
|
|
133
|
+
const result = await client.postRequest(`${CW_SERVER}/port/remove`, body);
|
|
134
|
+
return toolText(result);
|
|
173
135
|
}
|
|
174
136
|
catch (error) {
|
|
175
137
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
176
138
|
}
|
|
177
139
|
});
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
140
|
+
server.tool("ncloud_set_port_plugins", "Replace the full set of port monitoring plugins for a server instance (sends the entire list).", {
|
|
141
|
+
instanceNo: z.string().describe("Server instance number"),
|
|
142
|
+
portList: z.array(z.number()).describe("Full list of port numbers to monitor (replaces existing)"),
|
|
143
|
+
type: targetType,
|
|
182
144
|
}, async (params) => {
|
|
183
145
|
try {
|
|
184
|
-
const body = {};
|
|
185
|
-
if (params.
|
|
186
|
-
body.
|
|
187
|
-
const result = await client.postRequest(
|
|
188
|
-
return
|
|
146
|
+
const body = { instanceNo: params.instanceNo, portList: params.portList };
|
|
147
|
+
if (params.type !== undefined)
|
|
148
|
+
body.type = params.type;
|
|
149
|
+
const result = await client.postRequest(`${CW_SERVER}/port`, body);
|
|
150
|
+
return toolText(result);
|
|
189
151
|
}
|
|
190
152
|
catch (error) {
|
|
191
153
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
192
154
|
}
|
|
193
155
|
});
|
|
194
|
-
//
|
|
195
|
-
server.tool("
|
|
196
|
-
resourceId: z.string().describe("Custom resource ID to retrieve details for"),
|
|
197
|
-
}, async (params) => {
|
|
156
|
+
// ─── File plugin ────────────────────────────────────────────────────────
|
|
157
|
+
server.tool("ncloud_list_file_plugins", "Get the full list of Cloud Insight file monitoring plugins.", {}, async () => {
|
|
198
158
|
try {
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
};
|
|
202
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/custom/resource/detail", body);
|
|
203
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
159
|
+
const result = await client.requestRaw("GET", `${CW_SERVER}/file`);
|
|
160
|
+
return toolText(result);
|
|
204
161
|
}
|
|
205
162
|
catch (error) {
|
|
206
163
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
207
164
|
}
|
|
208
165
|
});
|
|
209
|
-
|
|
210
|
-
server.tool("ncloud_create_custom_resource", "Create a user-defined custom resource in Cloud Insight for custom monitoring targets.", {
|
|
211
|
-
prodKey: z.string().describe("Product key (cw_key) for the custom schema"),
|
|
212
|
-
resourceName: z.string().describe("Name of the custom resource"),
|
|
213
|
-
dimensions: z.record(z.string()).describe("Dimension key-value pairs identifying the resource"),
|
|
214
|
-
}, async (params) => {
|
|
166
|
+
server.tool("ncloud_get_file_plugin", "Get file monitoring plugin configuration for a specific server instance.", { instanceNo: z.string().describe("Server instance number") }, async (params) => {
|
|
215
167
|
try {
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
resourceName: params.resourceName,
|
|
219
|
-
dimensions: params.dimensions,
|
|
220
|
-
};
|
|
221
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/custom/resource/create", body);
|
|
222
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
168
|
+
const result = await client.requestRaw("GET", `${CW_SERVER}/file/instanceNo/${params.instanceNo}`);
|
|
169
|
+
return toolText(result);
|
|
223
170
|
}
|
|
224
171
|
catch (error) {
|
|
225
172
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
226
173
|
}
|
|
227
174
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
175
|
+
server.tool("ncloud_add_file_plugin", "Add file monitoring plugin(s) to a server instance.", {
|
|
176
|
+
instanceNo: z.string().describe("Server instance number"),
|
|
177
|
+
configList: z.array(z.string()).min(1).describe("File paths to monitor"),
|
|
178
|
+
type: targetType,
|
|
232
179
|
}, async (params) => {
|
|
233
180
|
try {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}],
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
const body = {
|
|
243
|
-
resourceId: params.resourceId,
|
|
244
|
-
};
|
|
245
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/custom/resource/delete", body);
|
|
246
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
181
|
+
const body = { instanceNo: params.instanceNo, configList: params.configList };
|
|
182
|
+
if (params.type !== undefined)
|
|
183
|
+
body.type = params.type;
|
|
184
|
+
const result = await client.postRequest(`${CW_SERVER}/file/add`, body);
|
|
185
|
+
return toolText(result);
|
|
247
186
|
}
|
|
248
187
|
catch (error) {
|
|
249
188
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
250
189
|
}
|
|
251
190
|
});
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
191
|
+
server.tool("ncloud_remove_file_plugin", "⚠️ Destructive: Remove file monitoring plugin(s) from a server instance. Set confirm=true to execute.", {
|
|
192
|
+
instanceNo: z.string().describe("Server instance number"),
|
|
193
|
+
configList: z.array(z.string()).min(1).describe("File paths to remove"),
|
|
194
|
+
type: targetType,
|
|
195
|
+
confirm: z.boolean().optional().default(false).describe("Must be true to actually execute the destructive operation"),
|
|
196
|
+
}, async (params) => {
|
|
255
197
|
try {
|
|
256
|
-
|
|
257
|
-
|
|
198
|
+
if (!params.confirm) {
|
|
199
|
+
return { content: [{ type: "text", text: `⚠️ This will remove file plugins [${params.configList.join(", ")}] from instance [${params.instanceNo}]. To execute, call again with confirm=true.` }] };
|
|
200
|
+
}
|
|
201
|
+
const body = { instanceNo: params.instanceNo, configList: params.configList };
|
|
202
|
+
if (params.type !== undefined)
|
|
203
|
+
body.type = params.type;
|
|
204
|
+
const result = await client.postRequest(`${CW_SERVER}/file/remove`, body);
|
|
205
|
+
return toolText(result);
|
|
258
206
|
}
|
|
259
207
|
catch (error) {
|
|
260
208
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
261
209
|
}
|
|
262
210
|
});
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
211
|
+
server.tool("ncloud_set_file_plugins", "Replace the full set of file monitoring plugins for a server instance (sends the entire list).", {
|
|
212
|
+
instanceNo: z.string().describe("Server instance number"),
|
|
213
|
+
configList: z.array(z.string()).describe("Full list of file paths to monitor (replaces existing)"),
|
|
214
|
+
type: targetType,
|
|
266
215
|
}, async (params) => {
|
|
267
216
|
try {
|
|
268
|
-
const body = {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const result = await client.postRequest(
|
|
272
|
-
return
|
|
217
|
+
const body = { instanceNo: params.instanceNo, configList: params.configList };
|
|
218
|
+
if (params.type !== undefined)
|
|
219
|
+
body.type = params.type;
|
|
220
|
+
const result = await client.postRequest(`${CW_SERVER}/file`, body);
|
|
221
|
+
return toolText(result);
|
|
273
222
|
}
|
|
274
223
|
catch (error) {
|
|
275
224
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
276
225
|
}
|
|
277
226
|
});
|
|
278
|
-
//
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
227
|
+
// ─── Custom Resource ────────────────────────────────────────────────────
|
|
228
|
+
server.tool("ncloud_list_custom_resources", "Get the list of user-defined custom resources in Cloud Insight.", {
|
|
229
|
+
resourceTypeId: z.string().optional().describe("Resource type ID (default 'DEFAULT')"),
|
|
230
|
+
query: z.string().optional().describe("Filter keyword"),
|
|
282
231
|
}, async (params) => {
|
|
283
232
|
try {
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
233
|
+
const q = {};
|
|
234
|
+
if (params.resourceTypeId !== undefined)
|
|
235
|
+
q.resourceTypeId = params.resourceTypeId;
|
|
236
|
+
if (params.query !== undefined)
|
|
237
|
+
q.query = params.query;
|
|
238
|
+
const result = await client.requestRaw("GET", `${CW}/custom/resource/list`, q);
|
|
239
|
+
return toolText(result);
|
|
287
240
|
}
|
|
288
241
|
catch (error) {
|
|
289
242
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
290
243
|
}
|
|
291
244
|
});
|
|
292
|
-
|
|
293
|
-
server.tool("ncloud_get_port_plugin", "Get port monitoring plugin details for a specific server instance.", {
|
|
294
|
-
instanceNo: z.string().describe("Server instance number"),
|
|
295
|
-
}, async (params) => {
|
|
245
|
+
server.tool("ncloud_get_custom_resource", "Get detailed information about a specific custom resource in Cloud Insight.", { resourceId: z.string().describe("Custom resource ID") }, async (params) => {
|
|
296
246
|
try {
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
247
|
+
const result = await client.requestRaw("GET", `${CW}/custom/resource/${params.resourceId}`);
|
|
248
|
+
return toolText(result);
|
|
300
249
|
}
|
|
301
250
|
catch (error) {
|
|
302
251
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
303
252
|
}
|
|
304
253
|
});
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
254
|
+
server.tool("ncloud_create_custom_resource", "Create a user-defined custom resource in Cloud Insight.", {
|
|
255
|
+
resourceName: z.string().describe("Name of the custom resource"),
|
|
256
|
+
resourceData: z
|
|
257
|
+
.object({
|
|
258
|
+
organizationCode: z.string().describe("Organization code"),
|
|
259
|
+
projectId: z.string().describe("Project ID"),
|
|
260
|
+
serverIp: z.string().describe("Server IP"),
|
|
261
|
+
serverType: z.string().describe("Server type"),
|
|
262
|
+
serverName: z.string().optional().describe("Server name"),
|
|
263
|
+
})
|
|
264
|
+
.describe("Resource data"),
|
|
265
|
+
resourceTypeId: z.string().optional().describe("Resource type ID (default 'DEFAULT')"),
|
|
266
|
+
resourceId: z.string().optional().describe("Resource ID (auto-generated if omitted)"),
|
|
308
267
|
}, async (params) => {
|
|
309
268
|
try {
|
|
310
|
-
const body = {
|
|
311
|
-
|
|
312
|
-
|
|
269
|
+
const body = { resourceName: params.resourceName, resourceData: params.resourceData };
|
|
270
|
+
if (params.resourceTypeId !== undefined)
|
|
271
|
+
body.resourceTypeId = params.resourceTypeId;
|
|
272
|
+
if (params.resourceId !== undefined)
|
|
273
|
+
body.resourceId = params.resourceId;
|
|
274
|
+
const result = await client.postRequest(`${CW}/custom/resource`, body);
|
|
275
|
+
return toolText(result);
|
|
313
276
|
}
|
|
314
277
|
catch (error) {
|
|
315
278
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
316
279
|
}
|
|
317
280
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
281
|
+
server.tool("ncloud_update_custom_resource", "Update a user-defined custom resource in Cloud Insight.", {
|
|
282
|
+
resourceId: z.string().describe("Custom resource ID to update"),
|
|
283
|
+
resourceName: z.string().describe("Name of the custom resource"),
|
|
284
|
+
resourceData: z
|
|
285
|
+
.object({
|
|
286
|
+
organizationCode: z.string().describe("Organization code"),
|
|
287
|
+
projectId: z.string().describe("Project ID"),
|
|
288
|
+
serverIp: z.string().describe("Server IP"),
|
|
289
|
+
serverType: z.string().describe("Server type"),
|
|
290
|
+
serverName: z.string().optional().describe("Server name"),
|
|
291
|
+
})
|
|
292
|
+
.describe("Resource data"),
|
|
323
293
|
}, async (params) => {
|
|
324
294
|
try {
|
|
325
|
-
const body = {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
};
|
|
329
|
-
if (params.newProcessName !== undefined)
|
|
330
|
-
body.newProcessName = params.newProcessName;
|
|
331
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/plugin/process/update", body);
|
|
332
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
295
|
+
const body = { resourceName: params.resourceName, resourceData: params.resourceData };
|
|
296
|
+
const result = await client.putRequest(`${CW}/custom/resource/${params.resourceId}`, body);
|
|
297
|
+
return toolText(result);
|
|
333
298
|
}
|
|
334
299
|
catch (error) {
|
|
335
300
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
336
301
|
}
|
|
337
302
|
});
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
portNumber: z.number().describe("Current port number"),
|
|
342
|
-
newPortNumber: z.number().optional().describe("New port number"),
|
|
303
|
+
server.tool("ncloud_delete_custom_resource", "⚠️ Destructive: Delete a user-defined custom resource from Cloud Insight. Set confirm=true to execute.", {
|
|
304
|
+
resourceId: z.string().describe("Custom resource ID to delete"),
|
|
305
|
+
confirm: z.boolean().optional().default(false).describe("Must be true to actually execute the destructive operation"),
|
|
343
306
|
}, async (params) => {
|
|
344
307
|
try {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
body.newPortNumber = params.newPortNumber;
|
|
351
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/plugin/port/update", body);
|
|
352
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
308
|
+
if (!params.confirm) {
|
|
309
|
+
return { content: [{ type: "text", text: `⚠️ This will permanently delete custom resource [${params.resourceId}]. To execute, call again with confirm=true.` }] };
|
|
310
|
+
}
|
|
311
|
+
const result = await client.requestRaw("DELETE", `${CW}/custom/resource/${params.resourceId}`);
|
|
312
|
+
return toolText(result);
|
|
353
313
|
}
|
|
354
314
|
catch (error) {
|
|
355
315
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
356
316
|
}
|
|
357
317
|
});
|
|
358
|
-
//
|
|
359
|
-
server.tool("
|
|
360
|
-
instanceNo: z.string().describe("Server instance number"),
|
|
361
|
-
filePath: z.string().describe("Current file path"),
|
|
362
|
-
newFilePath: z.string().optional().describe("New file path"),
|
|
363
|
-
}, async (params) => {
|
|
318
|
+
// ─── Schema ─────────────────────────────────────────────────────────────
|
|
319
|
+
server.tool("ncloud_get_schema_keys", "Get the list of system schema product keys (cw_key) available in Cloud Insight.", {}, async () => {
|
|
364
320
|
try {
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
filePath: params.filePath,
|
|
368
|
-
};
|
|
369
|
-
if (params.newFilePath !== undefined)
|
|
370
|
-
body.newFilePath = params.newFilePath;
|
|
371
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/plugin/file/update", body);
|
|
372
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
321
|
+
const result = await client.requestRaw("GET", `${CW}/schema/system/list`);
|
|
322
|
+
return toolText(result);
|
|
373
323
|
}
|
|
374
324
|
catch (error) {
|
|
375
325
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
376
326
|
}
|
|
377
327
|
});
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
prodName: z.string().describe("Product name for the custom schema"),
|
|
382
|
-
fields: z.array(z.object({
|
|
383
|
-
fieldName: z.string().describe("Field name"),
|
|
384
|
-
fieldType: z.enum(["STRING", "INTEGER", "LONG", "FLOAT"]).describe("Field data type"),
|
|
385
|
-
dimension: z.boolean().optional().describe("Whether this field is a dimension (default: false)"),
|
|
386
|
-
})).describe("Schema field definitions"),
|
|
328
|
+
server.tool("ncloud_get_product_schema", "Get the schema definition for a specific product in Cloud Insight (metrics and dimensions).", {
|
|
329
|
+
prodName: z.string().describe("Product name to get schema for"),
|
|
330
|
+
cw_key: z.string().optional().describe("Product key (cw_key) for custom schema"),
|
|
387
331
|
}, async (params) => {
|
|
388
332
|
try {
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
333
|
+
const q = { prodName: params.prodName };
|
|
334
|
+
if (params.cw_key !== undefined)
|
|
335
|
+
q.cw_key = params.cw_key;
|
|
336
|
+
const result = await client.requestRaw("GET", `${CW}/schema`, q);
|
|
337
|
+
return toolText(result);
|
|
395
338
|
}
|
|
396
339
|
catch (error) {
|
|
397
340
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
398
341
|
}
|
|
399
342
|
});
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
343
|
+
const schemaField = z.object({
|
|
344
|
+
fieldName: z.string().describe("Field name"),
|
|
345
|
+
fieldType: z.enum(["STRING", "INTEGER", "LONG", "FLOAT"]).describe("Field data type"),
|
|
346
|
+
dimension: z.boolean().optional().describe("Whether this field is a dimension"),
|
|
347
|
+
});
|
|
348
|
+
server.tool("ncloud_create_custom_schema", "Create a user-defined custom schema in Cloud Insight for custom metrics.", {
|
|
349
|
+
prodName: z.array(z.string()).describe("Product name(s) for the custom schema"),
|
|
350
|
+
fields: z.array(schemaField).describe("Schema field definitions"),
|
|
351
|
+
useCustomResource: z.boolean().optional().describe("Whether to use custom resource (default false)"),
|
|
404
352
|
}, async (params) => {
|
|
405
353
|
try {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}],
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
const body = { prodKey: params.prodKey };
|
|
415
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/schema/delete", body);
|
|
416
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
354
|
+
const body = { prodName: params.prodName, fields: params.fields };
|
|
355
|
+
if (params.useCustomResource !== undefined)
|
|
356
|
+
body.useCustomResource = params.useCustomResource;
|
|
357
|
+
const result = await client.postRequest(`${CW}/schema`, body);
|
|
358
|
+
return toolText(result);
|
|
417
359
|
}
|
|
418
360
|
catch (error) {
|
|
419
361
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
420
362
|
}
|
|
421
363
|
});
|
|
422
|
-
// ncloud_update_product_schema — Update a custom schema
|
|
423
364
|
server.tool("ncloud_update_product_schema", "Update a user-defined custom schema in Cloud Insight.", {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
fieldType: z.enum(["STRING", "INTEGER", "LONG", "FLOAT"]).describe("Field data type"),
|
|
428
|
-
dimension: z.boolean().optional().describe("Whether this field is a dimension"),
|
|
429
|
-
})).describe("Updated schema field definitions"),
|
|
365
|
+
prodName: z.string().describe("Product name of the schema to update"),
|
|
366
|
+
cw_key: z.string().describe("Product key (cw_key) of the schema to update"),
|
|
367
|
+
fields: z.array(schemaField).describe("Updated schema field definitions"),
|
|
430
368
|
}, async (params) => {
|
|
431
369
|
try {
|
|
432
|
-
const body = {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
};
|
|
436
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/schema/update", body);
|
|
437
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
370
|
+
const body = { prodName: params.prodName, cw_key: params.cw_key, fields: params.fields };
|
|
371
|
+
const result = await client.putRequest(`${CW}/schema`, body);
|
|
372
|
+
return toolText(result);
|
|
438
373
|
}
|
|
439
374
|
catch (error) {
|
|
440
375
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
441
376
|
}
|
|
442
377
|
});
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
378
|
+
server.tool("ncloud_delete_product_schema", "⚠️ Destructive: Delete a user-defined custom schema from Cloud Insight. Set confirm=true to execute.", {
|
|
379
|
+
prodName: z.string().describe("Product name of the schema to delete"),
|
|
380
|
+
cw_key: z.string().describe("Product key (cw_key) of the schema to delete"),
|
|
381
|
+
confirm: z.boolean().optional().default(false).describe("Must be true to actually execute the destructive operation"),
|
|
446
382
|
}, async (params) => {
|
|
447
383
|
try {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
384
|
+
if (!params.confirm) {
|
|
385
|
+
return { content: [{ type: "text", text: `⚠️ This will permanently delete custom schema [${params.prodName} / ${params.cw_key}]. To execute, call again with confirm=true.` }] };
|
|
386
|
+
}
|
|
387
|
+
const result = await client.requestRaw("DELETE", `${CW}/schema`, { cw_key: params.cw_key, prodName: params.prodName });
|
|
388
|
+
return toolText(result);
|
|
451
389
|
}
|
|
452
390
|
catch (error) {
|
|
453
391
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
454
392
|
}
|
|
455
393
|
});
|
|
456
|
-
//
|
|
457
|
-
server.tool("
|
|
458
|
-
|
|
394
|
+
// ─── Extended metric ─────────────────────────────────────────────────────
|
|
395
|
+
server.tool("ncloud_get_extended_status", "Get the Extended Metric collection status for servers in Cloud Insight.", {
|
|
396
|
+
prodKey: z.string().describe("Product key (cw_key)"),
|
|
397
|
+
servers: z.array(z.string()).describe("Server instance numbers to check"),
|
|
459
398
|
}, async (params) => {
|
|
460
399
|
try {
|
|
461
|
-
const body = {
|
|
462
|
-
const result = await client.postRequest(
|
|
463
|
-
return
|
|
400
|
+
const body = { prodKey: params.prodKey, servers: params.servers };
|
|
401
|
+
const result = await client.postRequest(`${CW}/schema/extended/status`, body);
|
|
402
|
+
return toolText(result);
|
|
464
403
|
}
|
|
465
404
|
catch (error) {
|
|
466
405
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
467
406
|
}
|
|
468
407
|
});
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
408
|
+
server.tool("ncloud_update_extended_enable", "Enable Extended Metric collection for instances in Cloud Insight.", {
|
|
409
|
+
cw_key: z.string().describe("Product key (cw_key)"),
|
|
410
|
+
instanceIds: z.string().describe("Comma-separated server instance numbers"),
|
|
472
411
|
}, async (params) => {
|
|
473
412
|
try {
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
413
|
+
const result = await client.requestRaw("PUT", `${CW}/schema/extended/enable`, { cw_key: params.cw_key, instanceIds: params.instanceIds });
|
|
414
|
+
return toolText(result);
|
|
477
415
|
}
|
|
478
416
|
catch (error) {
|
|
479
417
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
480
418
|
}
|
|
481
419
|
});
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
resourceId: z.string().describe("Custom resource ID to update"),
|
|
486
|
-
resourceName: z.string().optional().describe("New name for the custom resource"),
|
|
487
|
-
dimensions: z.record(z.string()).optional().describe("Updated dimension key-value pairs"),
|
|
420
|
+
server.tool("ncloud_update_extended_disable", "Disable Extended Metric collection for instances in Cloud Insight.", {
|
|
421
|
+
cw_key: z.string().describe("Product key (cw_key)"),
|
|
422
|
+
instanceIds: z.string().describe("Comma-separated server instance numbers"),
|
|
488
423
|
}, async (params) => {
|
|
489
424
|
try {
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
};
|
|
493
|
-
if (params.resourceName !== undefined)
|
|
494
|
-
body.resourceName = params.resourceName;
|
|
495
|
-
if (params.dimensions !== undefined)
|
|
496
|
-
body.dimensions = params.dimensions;
|
|
497
|
-
const result = await client.postRequest("/cw_fea/real/cw/api/custom/resource/update", body);
|
|
498
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
425
|
+
const result = await client.requestRaw("PUT", `${CW}/schema/extended/disable`, { cw_key: params.cw_key, instanceIds: params.instanceIds });
|
|
426
|
+
return toolText(result);
|
|
499
427
|
}
|
|
500
428
|
catch (error) {
|
|
501
429
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
502
430
|
}
|
|
503
431
|
});
|
|
504
|
-
//
|
|
505
|
-
|
|
506
|
-
|
|
432
|
+
// ─── Planned Maintenance ─────────────────────────────────────────────────
|
|
433
|
+
server.tool("ncloud_list_maintenances", "Get the list of planned maintenance schedules in Cloud Insight (paged). The API requires a filter: either a time range (from/to/timeType) OR a resource (resourceId+productKey). If none is given, a default ±180-day window by startTime is applied.", {
|
|
434
|
+
pageNum: z.number().optional().default(1).describe("Page number (>= 1)"),
|
|
435
|
+
pageSize: z.number().optional().default(100).describe("Page size (>= 1)"),
|
|
436
|
+
from: z.number().optional().describe("Filter start (epoch ms), used with 'to' and 'timeType'"),
|
|
437
|
+
to: z.number().optional().describe("Filter end (epoch ms)"),
|
|
438
|
+
timeType: z.enum(["startTime", "endTime"]).optional().describe("Which time the from/to filter applies to (default startTime)"),
|
|
439
|
+
resourceId: z.string().optional().describe("Filter by resource ID (use together with productKey instead of a time range)"),
|
|
440
|
+
productKey: z.string().optional().describe("Filter by product key (use together with resourceId)"),
|
|
441
|
+
}, async (params) => {
|
|
507
442
|
try {
|
|
508
|
-
const
|
|
509
|
-
|
|
443
|
+
const q = { pageNum: params.pageNum ?? 1, pageSize: params.pageSize ?? 100 };
|
|
444
|
+
if (params.resourceId !== undefined && params.productKey !== undefined) {
|
|
445
|
+
// 리소스 필터 모드
|
|
446
|
+
q.resourceId = params.resourceId;
|
|
447
|
+
q.productKey = params.productKey;
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
// 시간범위 필터 모드 — 미지정 시 ±180일 기본창 주입(API가 필터를 요구하므로 무인자 400 방지)
|
|
451
|
+
const DAY = 86_400_000;
|
|
452
|
+
q.from = params.from ?? Date.now() - 180 * DAY;
|
|
453
|
+
q.to = params.to ?? Date.now() + 180 * DAY;
|
|
454
|
+
q.timeType = params.timeType ?? "startTime";
|
|
455
|
+
}
|
|
456
|
+
const result = await client.requestRaw("GET", `${CW}/planned-maintenances`, q);
|
|
457
|
+
return toolText(result);
|
|
510
458
|
}
|
|
511
459
|
catch (error) {
|
|
512
460
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
513
461
|
}
|
|
514
462
|
});
|
|
515
|
-
|
|
516
|
-
server.tool("ncloud_get_maintenance_detail", "Get detailed information about a specific planned maintenance schedule.", {
|
|
517
|
-
maintenanceId: z.string().describe("Maintenance ID to retrieve details for"),
|
|
518
|
-
}, async (params) => {
|
|
463
|
+
server.tool("ncloud_get_maintenance_detail", "Get detailed information about a specific planned maintenance schedule.", { maintenanceId: z.string().describe("Planned maintenance ID") }, async (params) => {
|
|
519
464
|
try {
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
465
|
+
const result = await client.requestRaw("GET", `${CW}/planned-maintenances/${params.maintenanceId}`);
|
|
466
|
+
return toolText(result);
|
|
523
467
|
}
|
|
524
468
|
catch (error) {
|
|
525
469
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
526
470
|
}
|
|
527
471
|
});
|
|
528
|
-
// ncloud_create_maintenance — Create a planned maintenance schedule
|
|
529
472
|
server.tool("ncloud_create_maintenance", "Create a new planned maintenance schedule in Cloud Insight.", {
|
|
530
473
|
title: z.string().describe("Maintenance title"),
|
|
531
474
|
startTime: z.number().describe("Start time in Unix epoch milliseconds"),
|
|
532
475
|
endTime: z.number().describe("End time in Unix epoch milliseconds"),
|
|
533
|
-
|
|
476
|
+
dimensions: z.record(z.unknown()).describe("Target dimensions (resource identifiers)"),
|
|
477
|
+
desc: z.string().optional().describe("Maintenance description"),
|
|
534
478
|
}, async (params) => {
|
|
535
479
|
try {
|
|
536
480
|
const body = {
|
|
537
481
|
title: params.title,
|
|
538
482
|
startTime: params.startTime,
|
|
539
483
|
endTime: params.endTime,
|
|
484
|
+
dimensions: params.dimensions,
|
|
540
485
|
};
|
|
541
|
-
if (params.
|
|
542
|
-
body.
|
|
543
|
-
const result = await client.postRequest(
|
|
544
|
-
return
|
|
486
|
+
if (params.desc !== undefined)
|
|
487
|
+
body.desc = params.desc;
|
|
488
|
+
const result = await client.postRequest(`${CW}/planned-maintenances`, body);
|
|
489
|
+
return toolText(result);
|
|
545
490
|
}
|
|
546
491
|
catch (error) {
|
|
547
492
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
548
493
|
}
|
|
549
494
|
});
|
|
550
|
-
// ncloud_update_maintenance — Update a planned maintenance schedule
|
|
551
495
|
server.tool("ncloud_update_maintenance", "Update an existing planned maintenance schedule in Cloud Insight.", {
|
|
552
|
-
maintenanceId: z.string().describe("
|
|
553
|
-
title: z.string().optional().describe("
|
|
554
|
-
startTime: z.number().optional().describe("
|
|
555
|
-
endTime: z.number().optional().describe("
|
|
556
|
-
|
|
496
|
+
maintenanceId: z.string().describe("Planned maintenance ID to update"),
|
|
497
|
+
title: z.string().optional().describe("Maintenance title"),
|
|
498
|
+
startTime: z.number().optional().describe("Start time in Unix epoch milliseconds"),
|
|
499
|
+
endTime: z.number().optional().describe("End time in Unix epoch milliseconds"),
|
|
500
|
+
dimensions: z.record(z.unknown()).optional().describe("Target dimensions"),
|
|
501
|
+
desc: z.string().optional().describe("Maintenance description"),
|
|
557
502
|
}, async (params) => {
|
|
558
503
|
try {
|
|
559
|
-
const body = {
|
|
560
|
-
maintenanceId: params.maintenanceId,
|
|
561
|
-
};
|
|
504
|
+
const body = {};
|
|
562
505
|
if (params.title !== undefined)
|
|
563
506
|
body.title = params.title;
|
|
564
507
|
if (params.startTime !== undefined)
|
|
565
508
|
body.startTime = params.startTime;
|
|
566
509
|
if (params.endTime !== undefined)
|
|
567
510
|
body.endTime = params.endTime;
|
|
568
|
-
if (params.
|
|
569
|
-
body.
|
|
570
|
-
|
|
571
|
-
|
|
511
|
+
if (params.dimensions !== undefined)
|
|
512
|
+
body.dimensions = params.dimensions;
|
|
513
|
+
if (params.desc !== undefined)
|
|
514
|
+
body.desc = params.desc;
|
|
515
|
+
const result = await client.putRequest(`${CW}/planned-maintenances/${params.maintenanceId}`, body);
|
|
516
|
+
return toolText(result);
|
|
572
517
|
}
|
|
573
518
|
catch (error) {
|
|
574
519
|
return { content: [{ type: "text", text: error.message }], isError: true };
|
|
575
520
|
}
|
|
576
521
|
});
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
confirm: z.boolean().optional().describe("Must be true to execute deletion."),
|
|
522
|
+
server.tool("ncloud_delete_maintenance", "⚠️ Destructive: Delete a planned maintenance schedule from Cloud Insight. Set confirm=true to execute.", {
|
|
523
|
+
maintenanceId: z.string().describe("Planned maintenance ID to delete"),
|
|
524
|
+
confirm: z.boolean().optional().default(false).describe("Must be true to actually execute the destructive operation"),
|
|
581
525
|
}, async (params) => {
|
|
582
526
|
try {
|
|
583
527
|
if (!params.confirm) {
|
|
584
|
-
return {
|
|
585
|
-
content: [{
|
|
586
|
-
type: "text",
|
|
587
|
-
text: `⚠️ This will permanently delete maintenance schedule [${params.maintenanceId}]. To confirm, call this tool again with confirm=true.`,
|
|
588
|
-
}],
|
|
589
|
-
};
|
|
528
|
+
return { content: [{ type: "text", text: `⚠️ This will permanently delete maintenance schedule [${params.maintenanceId}]. To execute, call again with confirm=true.` }] };
|
|
590
529
|
}
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
530
|
+
const result = await client.requestRaw("DELETE", `${CW}/planned-maintenances/${params.maintenanceId}`);
|
|
531
|
+
return toolText(result);
|
|
594
532
|
}
|
|
595
533
|
catch (error) {
|
|
596
534
|
return { content: [{ type: "text", text: error.message }], isError: true };
|