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.
Files changed (147) hide show
  1. package/README.md +18 -2
  2. package/README_EN.md +18 -2
  3. package/dist/index.js +12 -331
  4. package/dist/index.js.map +1 -1
  5. package/dist/tools/_response.d.ts +69 -0
  6. package/dist/tools/_response.js +96 -0
  7. package/dist/tools/_response.js.map +1 -0
  8. package/dist/tools/acg.js +10 -9
  9. package/dist/tools/acg.js.map +1 -1
  10. package/dist/tools/activity-tracer.js +4 -3
  11. package/dist/tools/activity-tracer.js.map +1 -1
  12. package/dist/tools/analytics-cdss.js +51 -50
  13. package/dist/tools/analytics-cdss.js.map +1 -1
  14. package/dist/tools/analytics-datacatalog.js +22 -21
  15. package/dist/tools/analytics-datacatalog.js.map +1 -1
  16. package/dist/tools/analytics-dataflow.js +27 -26
  17. package/dist/tools/analytics-dataflow.js.map +1 -1
  18. package/dist/tools/analytics-dataforest.js +25 -24
  19. package/dist/tools/analytics-dataforest.js.map +1 -1
  20. package/dist/tools/analytics-dataquery.js +6 -5
  21. package/dist/tools/analytics-dataquery.js.map +1 -1
  22. package/dist/tools/analytics-datastream.js +22 -21
  23. package/dist/tools/analytics-datastream.js.map +1 -1
  24. package/dist/tools/analytics-hadoop.js +30 -29
  25. package/dist/tools/analytics-hadoop.js.map +1 -1
  26. package/dist/tools/analytics-ses.js +43 -42
  27. package/dist/tools/analytics-ses.js.map +1 -1
  28. package/dist/tools/api-gateway.js +13 -12
  29. package/dist/tools/api-gateway.js.map +1 -1
  30. package/dist/tools/autoscaling.js +25 -24
  31. package/dist/tools/autoscaling.js.map +1 -1
  32. package/dist/tools/billing.d.ts +0 -11
  33. package/dist/tools/billing.js +210 -48
  34. package/dist/tools/billing.js.map +1 -1
  35. package/dist/tools/certificate-manager.js +4 -3
  36. package/dist/tools/certificate-manager.js.map +1 -1
  37. package/dist/tools/cloud-advisor.js +16 -15
  38. package/dist/tools/cloud-advisor.js.map +1 -1
  39. package/dist/tools/cloud-functions.js +22 -21
  40. package/dist/tools/cloud-functions.js.map +1 -1
  41. package/dist/tools/cloud-insight-integration.js +56 -35
  42. package/dist/tools/cloud-insight-integration.js.map +1 -1
  43. package/dist/tools/cloud-insight-plugin.js +291 -353
  44. package/dist/tools/cloud-insight-plugin.js.map +1 -1
  45. package/dist/tools/cloud-insight-rule.js +28 -27
  46. package/dist/tools/cloud-insight-rule.js.map +1 -1
  47. package/dist/tools/cloud-insight.js +12 -11
  48. package/dist/tools/cloud-insight.js.map +1 -1
  49. package/dist/tools/common.js +6 -5
  50. package/dist/tools/common.js.map +1 -1
  51. package/dist/tools/compute-initscript.js +5 -4
  52. package/dist/tools/compute-initscript.js.map +1 -1
  53. package/dist/tools/compute-loginkey.js +5 -4
  54. package/dist/tools/compute-loginkey.js.map +1 -1
  55. package/dist/tools/compute-placement.js +14 -13
  56. package/dist/tools/compute-placement.js.map +1 -1
  57. package/dist/tools/compute-publicip.js +8 -7
  58. package/dist/tools/compute-publicip.js.map +1 -1
  59. package/dist/tools/compute-server.js +29 -28
  60. package/dist/tools/compute-server.js.map +1 -1
  61. package/dist/tools/compute-storage.js +16 -15
  62. package/dist/tools/compute-storage.js.map +1 -1
  63. package/dist/tools/containers-nks.js +38 -37
  64. package/dist/tools/containers-nks.js.map +1 -1
  65. package/dist/tools/containers-registry.js +13 -12
  66. package/dist/tools/containers-registry.js.map +1 -1
  67. package/dist/tools/database-cache.js +25 -24
  68. package/dist/tools/database-cache.js.map +1 -1
  69. package/dist/tools/database-mongodb.js +25 -24
  70. package/dist/tools/database-mongodb.js.map +1 -1
  71. package/dist/tools/database-mssql.js +23 -22
  72. package/dist/tools/database-mssql.js.map +1 -1
  73. package/dist/tools/database-mysql.js +30 -29
  74. package/dist/tools/database-mysql.js.map +1 -1
  75. package/dist/tools/database-postgresql.js +26 -25
  76. package/dist/tools/database-postgresql.js.map +1 -1
  77. package/dist/tools/global-dns.js +13 -12
  78. package/dist/tools/global-dns.js.map +1 -1
  79. package/dist/tools/global-edge.js +21 -20
  80. package/dist/tools/global-edge.js.map +1 -1
  81. package/dist/tools/global-traffic-manager.js +27 -26
  82. package/dist/tools/global-traffic-manager.js.map +1 -1
  83. package/dist/tools/kms.js +52 -39
  84. package/dist/tools/kms.js.map +1 -1
  85. package/dist/tools/loadbalancer.js +17 -16
  86. package/dist/tools/loadbalancer.js.map +1 -1
  87. package/dist/tools/log-analytics.js +118 -110
  88. package/dist/tools/log-analytics.js.map +1 -1
  89. package/dist/tools/media-imageoptimizer.js +10 -9
  90. package/dist/tools/media-imageoptimizer.js.map +1 -1
  91. package/dist/tools/media-livestation.js +13 -12
  92. package/dist/tools/media-livestation.js.map +1 -1
  93. package/dist/tools/media-vodstation.js +11 -10
  94. package/dist/tools/media-vodstation.js.map +1 -1
  95. package/dist/tools/nat-gateway.js +6 -5
  96. package/dist/tools/nat-gateway.js.map +1 -1
  97. package/dist/tools/network-acl.js +18 -17
  98. package/dist/tools/network-acl.js.map +1 -1
  99. package/dist/tools/network-interface.js +15 -14
  100. package/dist/tools/network-interface.js.map +1 -1
  101. package/dist/tools/private-ca.js +32 -23
  102. package/dist/tools/private-ca.js.map +1 -1
  103. package/dist/tools/registry.d.ts +49 -0
  104. package/dist/tools/registry.js +254 -0
  105. package/dist/tools/registry.js.map +1 -0
  106. package/dist/tools/resource-manager.js +7 -6
  107. package/dist/tools/resource-manager.js.map +1 -1
  108. package/dist/tools/route-table.js +12 -11
  109. package/dist/tools/route-table.js.map +1 -1
  110. package/dist/tools/security-monitoring.js +120 -129
  111. package/dist/tools/security-monitoring.js.map +1 -1
  112. package/dist/tools/sens.js +7 -6
  113. package/dist/tools/sens.js.map +1 -1
  114. package/dist/tools/sourcebuild.js +18 -17
  115. package/dist/tools/sourcebuild.js.map +1 -1
  116. package/dist/tools/sourcecommit.js +13 -12
  117. package/dist/tools/sourcecommit.js.map +1 -1
  118. package/dist/tools/sourcedeploy.js +35 -34
  119. package/dist/tools/sourcedeploy.js.map +1 -1
  120. package/dist/tools/sourcepipeline.js +18 -17
  121. package/dist/tools/sourcepipeline.js.map +1 -1
  122. package/dist/tools/storage-archive.js +13 -12
  123. package/dist/tools/storage-archive.js.map +1 -1
  124. package/dist/tools/storage-nas.js +20 -19
  125. package/dist/tools/storage-nas.js.map +1 -1
  126. package/dist/tools/storage-ncloud.js +25 -24
  127. package/dist/tools/storage-ncloud.js.map +1 -1
  128. package/dist/tools/storage-object.js +29 -28
  129. package/dist/tools/storage-object.js.map +1 -1
  130. package/dist/tools/sub-account.js +19 -18
  131. package/dist/tools/sub-account.js.map +1 -1
  132. package/dist/tools/target-group.js +12 -11
  133. package/dist/tools/target-group.js.map +1 -1
  134. package/dist/tools/vpc-peering.js +8 -7
  135. package/dist/tools/vpc-peering.js.map +1 -1
  136. package/dist/tools/vpc.js +11 -10
  137. package/dist/tools/vpc.js.map +1 -1
  138. package/package.json +1 -1
  139. package/dist/auth/signature.test.d.ts +0 -1
  140. package/dist/auth/signature.test.js +0 -90
  141. package/dist/auth/signature.test.js.map +0 -1
  142. package/dist/client/ncloud-client.test.d.ts +0 -1
  143. package/dist/client/ncloud-client.test.js +0 -477
  144. package/dist/client/ncloud-client.test.js.map +0 -1
  145. package/dist/tools/compute-server.test.d.ts +0 -1
  146. package/dist/tools/compute-server.test.js +0 -224
  147. 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
- // --- Plugin Tools ---
4
- // ncloud_list_process_plugins Get process plugin list
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 body = {};
10
- if (params.instanceNo !== undefined)
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
- // ncloud_add_process_plugin Add a process monitoring plugin
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 body = {
26
- instanceNo: params.instanceNo,
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
- // ncloud_remove_process_plugin Remove a process monitoring plugin
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
- processName: z.string().describe("Name of the process plugin to remove"),
40
- confirm: z.boolean().optional().describe("Must be true to execute deletion. If false or omitted, returns a confirmation prompt."),
35
+ configList: z.array(z.string()).min(1).describe("Process names to monitor"),
36
+ type: targetType,
41
37
  }, async (params) => {
42
38
  try {
43
- if (!params.confirm) {
44
- return {
45
- content: [{
46
- type: "text",
47
- text: `⚠️ This will permanently remove process plugin [${params.processName}] from instance [${params.instanceNo}]. Do you want to proceed? (yes/no)\n\nTo confirm, call this tool again with confirm=true.`,
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
- // ncloud_list_port_plugins Get port plugin list
63
- server.tool("ncloud_list_port_plugins", "Get the list of Cloud Insight port monitoring plugins.", {
64
- instanceNo: z.string().optional().describe("Server instance number to filter plugins"),
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
- const body = {};
68
- if (params.instanceNo !== undefined)
69
- body.instanceNo = params.instanceNo;
70
- const result = await client.postRequest("/cw_fea/real/cw/api/plugin/port", body);
71
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_add_port_plugin Add a port monitoring plugin
78
- server.tool("ncloud_add_port_plugin", "Add a port monitoring plugin to Cloud Insight for monitoring specific ports on a server.", {
79
- instanceNo: z.string().describe("Server instance number to add the plugin to"),
80
- portNumber: z.number().describe("Port number to monitor"),
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
- instanceNo: params.instanceNo,
85
- portNumber: params.portNumber,
86
- };
87
- const result = await client.postRequest("/cw_fea/real/cw/api/plugin/port/add", body);
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
- // ncloud_remove_port_plugin Remove a port monitoring plugin
95
- server.tool("ncloud_remove_port_plugin", "⚠️ Destructive: Remove a port monitoring plugin from Cloud Insight.", {
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
- if (!params.confirm) {
102
- return {
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
- // ncloud_list_file_plugins Get file plugin list
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 body = {};
126
- if (params.instanceNo !== undefined)
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
- // ncloud_add_file_plugin Add a file monitoring plugin
136
- server.tool("ncloud_add_file_plugin", "Add a file monitoring plugin to Cloud Insight for monitoring specific file paths on a server.", {
137
- instanceNo: z.string().describe("Server instance number to add the plugin to"),
138
- filePath: z.string().describe("File path to monitor"),
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
- instanceNo: params.instanceNo,
143
- filePath: params.filePath,
144
- };
145
- const result = await client.postRequest("/cw_fea/real/cw/api/plugin/file/add", body);
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
- // ncloud_remove_file_plugin Remove a file monitoring plugin
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
- filePath: z.string().describe("File path of the plugin to remove"),
156
- confirm: z.boolean().optional().describe("Must be true to execute deletion. If false or omitted, returns a confirmation prompt."),
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
- instanceNo: params.instanceNo,
169
- filePath: params.filePath,
170
- };
171
- const result = await client.postRequest("/cw_fea/real/cw/api/plugin/file/remove", body);
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
- // --- Custom Resource Tools ---
179
- // ncloud_list_custom_resources Get custom resource list
180
- server.tool("ncloud_list_custom_resources", "Get the list of user-defined custom resources in Cloud Insight.", {
181
- prodKey: z.string().optional().describe("Product key to filter custom resources"),
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.prodKey !== undefined)
186
- body.prodKey = params.prodKey;
187
- const result = await client.postRequest("/cw_fea/real/cw/api/custom/resource", body);
188
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_get_custom_resource Get custom resource details
195
- server.tool("ncloud_get_custom_resource", "Get detailed information about a specific user-defined custom resource in Cloud Insight.", {
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 body = {
200
- resourceId: params.resourceId,
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
- // ncloud_create_custom_resource Create a custom resource
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 body = {
217
- prodKey: params.prodKey,
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
- // ncloud_delete_custom_resource Delete a custom resource
229
- server.tool("ncloud_delete_custom_resource", "⚠️ Destructive: Delete a user-defined custom resource from Cloud Insight.", {
230
- resourceId: z.string().describe("Custom resource ID to delete"),
231
- confirm: z.boolean().optional().describe("Must be true to execute deletion. If false or omitted, returns a confirmation prompt."),
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
- if (!params.confirm) {
235
- return {
236
- content: [{
237
- type: "text",
238
- text: `⚠️ This will permanently delete custom resource [${params.resourceId}]. Do you want to proceed? (yes/no)\n\nTo confirm, call this tool again with confirm=true.`,
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
- // --- Schema Tools ---
253
- // ncloud_get_schema_keys Get system schema product keys
254
- server.tool("ncloud_get_schema_keys", "Get the list of product keys (cw_key) available in Cloud Insight schema.", {}, async () => {
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
- const result = await client.requestRaw("GET", "/cw_fea/real/cw/api/schema/system/list");
257
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_get_product_schema Get product schema details
264
- server.tool("ncloud_get_product_schema", "Get the schema definition for a specific product in Cloud Insight, including available metrics and dimensions.", {
265
- prodKey: z.string().describe("Product key (cw_key) to get schema for"),
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
- prodKey: params.prodKey,
270
- };
271
- const result = await client.postRequest("/cw_fea/real/cw/api/schema", body);
272
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // --- Plugin Detail/Update Tools ---
279
- // ncloud_get_process_plugin Get process plugin for a specific instance
280
- server.tool("ncloud_get_process_plugin", "Get process monitoring plugin details for a specific server instance.", {
281
- instanceNo: z.string().describe("Server instance number"),
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 body = { instanceNo: params.instanceNo };
285
- const result = await client.postRequest("/cw_fea/real/cw/api/plugin/process/instance", body);
286
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_get_port_plugin — Get port plugin for a specific instance
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 body = { instanceNo: params.instanceNo };
298
- const result = await client.postRequest("/cw_fea/real/cw/api/plugin/port/instance", body);
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
- // ncloud_get_file_plugin Get file plugin for a specific instance
306
- server.tool("ncloud_get_file_plugin", "Get file monitoring plugin details for a specific server instance.", {
307
- instanceNo: z.string().describe("Server instance number"),
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 = { instanceNo: params.instanceNo };
311
- const result = await client.postRequest("/cw_fea/real/cw/api/plugin/file/instance", body);
312
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_update_process_plugin Update process plugin settings
319
- server.tool("ncloud_update_process_plugin", "Update process monitoring plugin settings in Cloud Insight.", {
320
- instanceNo: z.string().describe("Server instance number"),
321
- processName: z.string().describe("Process name to update"),
322
- newProcessName: z.string().optional().describe("New process name"),
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
- instanceNo: params.instanceNo,
327
- processName: params.processName,
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
- // ncloud_update_port_plugin Update port plugin settings
339
- server.tool("ncloud_update_port_plugin", "Update port monitoring plugin settings in Cloud Insight.", {
340
- instanceNo: z.string().describe("Server instance number"),
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
- const body = {
346
- instanceNo: params.instanceNo,
347
- portNumber: params.portNumber,
348
- };
349
- if (params.newPortNumber !== undefined)
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
- // ncloud_update_file_plugin Update file plugin settings
359
- server.tool("ncloud_update_file_plugin", "Update file monitoring plugin settings in Cloud Insight.", {
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 body = {
366
- instanceNo: params.instanceNo,
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
- // --- Additional Schema Tools ---
379
- // ncloud_create_custom_schema Create a custom schema
380
- server.tool("ncloud_create_custom_schema", "Create a user-defined custom schema in Cloud Insight for custom metrics.", {
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 body = {
390
- prodName: params.prodName,
391
- fields: params.fields,
392
- };
393
- const result = await client.postRequest("/cw_fea/real/cw/api/schema/create", body);
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
- // ncloud_delete_product_schema Delete a custom schema
401
- server.tool("ncloud_delete_product_schema", "⚠️ Destructive: Delete a user-defined custom schema from Cloud Insight.", {
402
- prodKey: z.string().describe("Product key (cw_key) of the schema to delete"),
403
- confirm: z.boolean().optional().describe("Must be true to execute deletion."),
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
- if (!params.confirm) {
407
- return {
408
- content: [{
409
- type: "text",
410
- text: `⚠️ This will permanently delete custom schema [${params.prodKey}]. To confirm, call this tool again with confirm=true.`,
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
- prodKey: z.string().describe("Product key (cw_key) of the schema to update"),
425
- fields: z.array(z.object({
426
- fieldName: z.string().describe("Field name"),
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
- prodKey: params.prodKey,
434
- fields: params.fields,
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
- // ncloud_get_extended_status Get extended metric status
444
- server.tool("ncloud_get_extended_status", "Get the Extended Metric collection status for a specific instance in Cloud Insight.", {
445
- instanceNo: z.string().describe("Server instance number to check extended metric status"),
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
- const body = { instanceNo: params.instanceNo };
449
- const result = await client.postRequest("/cw_fea/real/cw/api/schema/extended/status", body);
450
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_update_extended_enable Enable extended metric collection
457
- server.tool("ncloud_update_extended_enable", "Enable Extended Metric collection for a specific instance in Cloud Insight.", {
458
- instanceNo: z.string().describe("Server instance number to enable extended metrics for"),
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 = { instanceNo: params.instanceNo };
462
- const result = await client.postRequest("/cw_fea/real/cw/api/schema/extended/enable", body);
463
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_update_extended_disable Disable extended metric collection
470
- server.tool("ncloud_update_extended_disable", "Disable Extended Metric collection for a specific instance in Cloud Insight.", {
471
- instanceNo: z.string().describe("Server instance number to disable extended metrics for"),
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 body = { instanceNo: params.instanceNo };
475
- const result = await client.postRequest("/cw_fea/real/cw/api/schema/extended/disable", body);
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
- // --- Custom Resource Update ---
483
- // ncloud_update_custom_resource Update a custom resource
484
- server.tool("ncloud_update_custom_resource", "Update a user-defined custom resource in Cloud Insight.", {
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 body = {
491
- resourceId: params.resourceId,
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
- // --- Planned Maintenance Tools ---
505
- // ncloud_list_maintenances Get planned maintenance list
506
- server.tool("ncloud_list_maintenances", "Get the list of planned maintenance schedules in Cloud Insight.", {}, async () => {
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 result = await client.postRequest("/cw_fea/real/cw/api/maintenance/list", {});
509
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_get_maintenance_detail Get planned maintenance detail
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 body = { maintenanceId: params.maintenanceId };
521
- const result = await client.postRequest("/cw_fea/real/cw/api/maintenance/detail", body);
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
- description: z.string().optional().describe("Maintenance description"),
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.description !== undefined)
542
- body.description = params.description;
543
- const result = await client.postRequest("/cw_fea/real/cw/api/maintenance/create", body);
544
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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("Maintenance ID to update"),
553
- title: z.string().optional().describe("New maintenance title"),
554
- startTime: z.number().optional().describe("New start time in Unix epoch milliseconds"),
555
- endTime: z.number().optional().describe("New end time in Unix epoch milliseconds"),
556
- description: z.string().optional().describe("New maintenance description"),
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.description !== undefined)
569
- body.description = params.description;
570
- const result = await client.postRequest("/cw_fea/real/cw/api/maintenance/update", body);
571
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
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
- // ncloud_delete_maintenance Delete a planned maintenance schedule
578
- server.tool("ncloud_delete_maintenance", "⚠️ Destructive: Delete a planned maintenance schedule from Cloud Insight.", {
579
- maintenanceId: z.string().describe("Maintenance ID to delete"),
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 body = { maintenanceId: params.maintenanceId };
592
- const result = await client.postRequest("/cw_fea/real/cw/api/maintenance/delete", body);
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 };