mcp-instana 0.6.2__py3-none-any.whl → 0.7.0__py3-none-any.whl

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 (28) hide show
  1. {mcp_instana-0.6.2.dist-info → mcp_instana-0.7.0.dist-info}/METADATA +179 -120
  2. {mcp_instana-0.6.2.dist-info → mcp_instana-0.7.0.dist-info}/RECORD +28 -21
  3. src/application/application_alert_config.py +397 -146
  4. src/application/application_analyze.py +597 -597
  5. src/application/application_call_group.py +528 -0
  6. src/application/application_catalog.py +0 -8
  7. src/application/application_global_alert_config.py +255 -38
  8. src/application/application_metrics.py +377 -237
  9. src/application/application_resources.py +414 -365
  10. src/application/application_settings.py +605 -1651
  11. src/application/application_topology.py +62 -62
  12. src/core/custom_dashboard_smart_router_tool.py +135 -0
  13. src/core/server.py +92 -119
  14. src/core/smart_router_tool.py +574 -0
  15. src/core/utils.py +17 -8
  16. src/custom_dashboard/custom_dashboard_tools.py +422 -0
  17. src/infrastructure/elicitation_handler.py +338 -0
  18. src/infrastructure/entity_registry.py +329 -0
  19. src/infrastructure/infrastructure_analyze_new.py +600 -0
  20. src/infrastructure/{infrastructure_analyze.py → infrastructure_analyze_old.py} +1 -16
  21. src/infrastructure/infrastructure_catalog.py +7 -28
  22. src/infrastructure/infrastructure_metrics.py +93 -17
  23. src/infrastructure/infrastructure_resources.py +5 -20
  24. src/infrastructure/infrastructure_topology.py +2 -8
  25. src/prompts/application/application_settings.py +58 -0
  26. {mcp_instana-0.6.2.dist-info → mcp_instana-0.7.0.dist-info}/WHEEL +0 -0
  27. {mcp_instana-0.6.2.dist-info → mcp_instana-0.7.0.dist-info}/entry_points.txt +0 -0
  28. {mcp_instana-0.6.2.dist-info → mcp_instana-0.7.0.dist-info}/licenses/LICENSE.md +0 -0
@@ -33,10 +33,228 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
33
33
  """Initialize the Application Alert MCP tools client."""
34
34
  super().__init__(read_token=read_token, base_url=base_url)
35
35
 
36
- @register_as_tool(
37
- title="Find Active Global Application Alert Configs",
38
- annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False)
39
- )
36
+ # CRUD Operations Dispatcher - called by smart_router_tool.py
37
+ async def execute_alert_config_operation(
38
+ self,
39
+ operation: str,
40
+ application_id: Optional[str] = None,
41
+ id: Optional[str] = None,
42
+ alert_ids: Optional[List[str]] = None,
43
+ valid_on: Optional[int] = None,
44
+ created: Optional[int] = None,
45
+ payload: Optional[Union[Dict[str, Any], str]] = None,
46
+ ctx=None
47
+ ) -> Dict[str, Any]:
48
+ """
49
+ Execute Global Application Alert Config CRUD operations.
50
+ Called by the smart router tool.
51
+
52
+ Args:
53
+ operation: Operation to perform (find_active, find_versions, find, create, update, delete, enable, disable, restore)
54
+ application_id: Application ID (for find_active)
55
+ id: Alert config ID
56
+ alert_ids: List of alert IDs to filter
57
+ valid_on: Unix timestamp for specific version
58
+ created: Unix timestamp for restore
59
+ payload: Configuration payload
60
+ ctx: MCP context
61
+
62
+ Returns:
63
+ Operation result dictionary
64
+ """
65
+ try:
66
+ if operation == "find_active":
67
+ return await self._find_active_configs(application_id, alert_ids, ctx)
68
+ elif operation == "find_versions":
69
+ return await self._find_config_versions(id, ctx)
70
+ elif operation == "find":
71
+ return await self._find_config(id, valid_on, ctx)
72
+ elif operation == "create":
73
+ return await self._create_config(payload, ctx)
74
+ elif operation == "update":
75
+ return await self._update_config(id, payload, ctx)
76
+ elif operation == "delete":
77
+ return await self._delete_config(id, ctx)
78
+ elif operation == "enable":
79
+ return await self._enable_config(id, ctx)
80
+ elif operation == "disable":
81
+ return await self._disable_config(id, ctx)
82
+ elif operation == "restore":
83
+ return await self._restore_config(id, created, ctx)
84
+ else:
85
+ return {"error": f"Operation '{operation}' not supported"}
86
+
87
+ except Exception as e:
88
+ logger.error(f"Error executing {operation}: {e}", exc_info=True)
89
+ return {"error": f"Error executing {operation}: {e!s}"}
90
+
91
+ # Individual operation functions
92
+
93
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
94
+ async def _find_active_configs(
95
+ self,
96
+ application_id: Optional[str],
97
+ alert_ids: Optional[List[str]],
98
+ ctx=None,
99
+ api_client=None
100
+ ) -> Dict[str, Any]:
101
+ """Find active global application alert configs."""
102
+ if not application_id:
103
+ return {"error": "application_id is required for find_active operation"}
104
+
105
+ return await self.find_active_global_application_alert_configs(
106
+ application_id=application_id,
107
+ alert_ids=alert_ids,
108
+ ctx=ctx,
109
+ api_client=api_client
110
+ )
111
+
112
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
113
+ async def _find_config_versions(
114
+ self,
115
+ id: Optional[str],
116
+ ctx=None,
117
+ api_client=None
118
+ ) -> Dict[str, Any]:
119
+ """Find all versions of a global application alert config."""
120
+ if not id:
121
+ return {"error": "id is required for find_versions operation"}
122
+
123
+ return await self.find_global_application_alert_config_versions(
124
+ id=id,
125
+ ctx=ctx,
126
+ api_client=api_client
127
+ )
128
+
129
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
130
+ async def _find_config(
131
+ self,
132
+ id: Optional[str],
133
+ valid_on: Optional[int],
134
+ ctx=None,
135
+ api_client=None
136
+ ) -> Dict[str, Any]:
137
+ """Find a specific global application alert config."""
138
+ return await self.find_global_application_alert_config(
139
+ id=id,
140
+ valid_on=valid_on,
141
+ ctx=ctx,
142
+ api_client=api_client
143
+ )
144
+
145
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
146
+ async def _create_config(
147
+ self,
148
+ payload: Optional[Union[Dict[str, Any], str]],
149
+ ctx=None,
150
+ api_client=None
151
+ ) -> Dict[str, Any]:
152
+ """Create a new global application alert config."""
153
+ if not payload:
154
+ return {"error": "payload is required for create operation"}
155
+
156
+ return await self.create_global_application_alert_config(
157
+ payload=payload,
158
+ ctx=ctx,
159
+ api_client=api_client
160
+ )
161
+
162
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
163
+ async def _update_config(
164
+ self,
165
+ id: Optional[str],
166
+ payload: Optional[Union[Dict[str, Any], str]],
167
+ ctx=None,
168
+ api_client=None
169
+ ) -> Dict[str, Any]:
170
+ """Update an existing global application alert config."""
171
+ if not id:
172
+ return {"error": "id is required for update operation"}
173
+ if not payload:
174
+ return {"error": "payload is required for update operation"}
175
+
176
+ return await self.update_global_application_alert_config(
177
+ id=id,
178
+ payload=payload,
179
+ ctx=ctx,
180
+ api_client=api_client
181
+ )
182
+
183
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
184
+ async def _delete_config(
185
+ self,
186
+ id: Optional[str],
187
+ ctx=None,
188
+ api_client=None
189
+ ) -> Dict[str, Any]:
190
+ """Delete a global application alert config."""
191
+ if not id:
192
+ return {"error": "id is required for delete operation"}
193
+
194
+ return await self.delete_global_application_alert_config(
195
+ id=id,
196
+ ctx=ctx,
197
+ api_client=api_client
198
+ )
199
+
200
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
201
+ async def _enable_config(
202
+ self,
203
+ id: Optional[str],
204
+ ctx=None,
205
+ api_client=None
206
+ ) -> Dict[str, Any]:
207
+ """Enable a global application alert config."""
208
+ if not id:
209
+ return {"error": "id is required for enable operation"}
210
+
211
+ return await self.enable_global_application_alert_config(
212
+ id=id,
213
+ ctx=ctx,
214
+ api_client=api_client
215
+ )
216
+
217
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
218
+ async def _disable_config(
219
+ self,
220
+ id: Optional[str],
221
+ ctx=None,
222
+ api_client=None
223
+ ) -> Dict[str, Any]:
224
+ """Disable a global application alert config."""
225
+ if not id:
226
+ return {"error": "id is required for disable operation"}
227
+
228
+ return await self.disable_global_application_alert_config(
229
+ id=id,
230
+ ctx=ctx,
231
+ api_client=api_client
232
+ )
233
+
234
+ @with_header_auth(GlobalApplicationAlertConfigurationApi)
235
+ async def _restore_config(
236
+ self,
237
+ id: Optional[str],
238
+ created: Optional[int],
239
+ ctx=None,
240
+ api_client=None
241
+ ) -> Dict[str, Any]:
242
+ """Restore a deleted global application alert config."""
243
+ if not id:
244
+ return {"error": "id is required for restore operation"}
245
+ if not created:
246
+ return {"error": "created timestamp is required for restore operation"}
247
+
248
+ return await self.restore_global_application_alert_config(
249
+ id=id,
250
+ created=created,
251
+ ctx=ctx,
252
+ api_client=api_client
253
+ )
254
+
255
+ # Original individual methods - no @register_as_tool decorator
256
+ # These are called internally by the operation functions above
257
+
40
258
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
41
259
  async def find_active_global_application_alert_configs(self,
42
260
  application_id: str,
@@ -82,9 +300,32 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
82
300
  logger.debug(f"Parsed JSON result: {result}")
83
301
 
84
302
  if isinstance(result, list):
85
- return {"configs": result}
303
+ configs = result
304
+ else:
305
+ configs = [result] if result else []
306
+
307
+ # Limit to first 10 results
308
+ total_count = len(configs)
309
+ limited_configs = configs[:10]
310
+
311
+ # Provide helpful feedback based on the result
312
+ if not configs:
313
+ return {
314
+ "configs": [],
315
+ "count": 0,
316
+ "total": 0,
317
+ "showing": 0,
318
+ "message": f"No active global alert configurations found for application ID: {application_id}",
319
+ "suggestion": "You can create a new global alert configuration using the 'create' operation."
320
+ }
86
321
  else:
87
- return {"configs": [result] if result else []}
322
+ return {
323
+ "configs": limited_configs,
324
+ "count": len(limited_configs),
325
+ "total": total_count,
326
+ "showing": len(limited_configs),
327
+ "message": f"Found {total_count} active global alert configuration(s) for application ID: {application_id}. Showing first {len(limited_configs)}."
328
+ }
88
329
 
89
330
  except json.JSONDecodeError as e:
90
331
  error_msg = f"Failed to parse response JSON: {e}"
@@ -96,10 +337,7 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
96
337
  return {"error": f"Failed to get active global application alert config: {e!s}"}
97
338
 
98
339
 
99
- @register_as_tool(
100
- title="Find Global Application Alert Config Versions",
101
- annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False)
102
- )
340
+ # @register_as_tool decorator removed - now called via router
103
341
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
104
342
  async def find_global_application_alert_config_versions(self,
105
343
  id: str,
@@ -147,10 +385,7 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
147
385
  logger.error(f"Error in find_global_application_alert_config_versions: {e}", exc_info=True)
148
386
  return {"error": f"Failed to get global application alert config versions: {e!s}"}
149
387
 
150
- @register_as_tool(
151
- title="Find Global Application Alert Config",
152
- annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False)
153
- )
388
+ # @register_as_tool decorator removed - now called via router
154
389
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
155
390
  async def find_global_application_alert_config(self,
156
391
  id: Optional[str] = None,
@@ -196,10 +431,7 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
196
431
  logger.error(f"Error in find_global_application_alert_config: {e}", exc_info=True)
197
432
  return {"error": f"Failed to get global application alert configs: {e!s}"}
198
433
 
199
- @register_as_tool(
200
- title="Delete Global Application Alert Config",
201
- annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=True)
202
- )
434
+ # @register_as_tool decorator removed - now called via router
203
435
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
204
436
  async def delete_global_application_alert_config(self,
205
437
  id: str,
@@ -240,10 +472,7 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
240
472
  logger.error(f"Error in delete_global_application_alert_config: {e}", exc_info=True)
241
473
  return {"error": f"Failed to delete global application alert config: {e!s}"}
242
474
 
243
- @register_as_tool(
244
- title="Enable Global Application Alert Config",
245
- annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=False)
246
- )
475
+ # @register_as_tool decorator removed - now called via router
247
476
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
248
477
  async def enable_global_application_alert_config(self,
249
478
  id: str,
@@ -288,10 +517,7 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
288
517
  logger.error(f"Error in enable_global_application_alert_config: {e}", exc_info=True)
289
518
  return {"error": f"Failed to enable global application alert config: {e!s}"}
290
519
 
291
- @register_as_tool(
292
- title="Disable Global Application Alert Config",
293
- annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=False)
294
- )
520
+ # @register_as_tool decorator removed - now called via router
295
521
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
296
522
  async def disable_global_application_alert_config(self,
297
523
  id: str,
@@ -336,10 +562,7 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
336
562
  logger.error(f"Error in disable_global_application_alert_config: {e}", exc_info=True)
337
563
  return {"error": f"Failed to disable global application alert config: {e!s}"}
338
564
 
339
- @register_as_tool(
340
- title="Restore Global Application Alert Config",
341
- annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=False)
342
- )
565
+ # @register_as_tool decorator removed - now called via router
343
566
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
344
567
  async def restore_global_application_alert_config(self,
345
568
  id: str,
@@ -389,10 +612,7 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
389
612
  logger.error(f"Error in restore_global_application_alert_config: {e}", exc_info=True)
390
613
  return {"error": f"Failed to restore global application alert config: {e!s}"}
391
614
 
392
- @register_as_tool(
393
- title="Create Global Application Alert Config",
394
- annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=False)
395
- )
615
+ # @register_as_tool decorator removed - now called via router
396
616
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
397
617
  async def create_global_application_alert_config(self,
398
618
  payload: Union[Dict[str, Any], str],
@@ -534,10 +754,7 @@ class ApplicationGlobalAlertMCPTools(BaseInstanaClient):
534
754
  logger.error(f"Error in create_global_application_alert_config: {e}", exc_info=True)
535
755
  return {"error": f"Failed to create global application alert config: {e!s}"}
536
756
 
537
- @register_as_tool(
538
- title="Update Global Application Alert Config",
539
- annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=False)
540
- )
757
+ # @register_as_tool decorator removed - now called via router
541
758
  @with_header_auth(GlobalApplicationAlertConfigurationApi)
542
759
  async def update_global_application_alert_config(self,
543
760
  id: str,