mcp-instana 0.1.1__py3-none-any.whl → 0.2.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 (55) hide show
  1. {mcp_instana-0.1.1.dist-info → mcp_instana-0.2.0.dist-info}/METADATA +459 -138
  2. mcp_instana-0.2.0.dist-info/RECORD +59 -0
  3. src/application/application_analyze.py +373 -160
  4. src/application/application_catalog.py +3 -1
  5. src/application/application_global_alert_config.py +653 -0
  6. src/application/application_metrics.py +6 -2
  7. src/application/application_resources.py +3 -1
  8. src/application/application_settings.py +966 -370
  9. src/application/application_topology.py +6 -2
  10. src/automation/action_catalog.py +416 -0
  11. src/automation/action_history.py +338 -0
  12. src/core/server.py +159 -9
  13. src/core/utils.py +2 -2
  14. src/event/events_tools.py +602 -275
  15. src/infrastructure/infrastructure_analyze.py +7 -3
  16. src/infrastructure/infrastructure_catalog.py +3 -1
  17. src/infrastructure/infrastructure_metrics.py +6 -2
  18. src/infrastructure/infrastructure_resources.py +7 -5
  19. src/infrastructure/infrastructure_topology.py +5 -3
  20. src/prompts/__init__.py +16 -0
  21. src/prompts/application/__init__.py +1 -0
  22. src/prompts/application/application_alerts.py +54 -0
  23. src/prompts/application/application_catalog.py +26 -0
  24. src/prompts/application/application_metrics.py +57 -0
  25. src/prompts/application/application_resources.py +26 -0
  26. src/prompts/application/application_settings.py +75 -0
  27. src/prompts/application/application_topology.py +30 -0
  28. src/prompts/events/__init__.py +1 -0
  29. src/prompts/events/events_tools.py +161 -0
  30. src/prompts/infrastructure/infrastructure_analyze.py +72 -0
  31. src/prompts/infrastructure/infrastructure_catalog.py +53 -0
  32. src/prompts/infrastructure/infrastructure_metrics.py +45 -0
  33. src/prompts/infrastructure/infrastructure_resources.py +74 -0
  34. src/prompts/infrastructure/infrastructure_topology.py +38 -0
  35. src/prompts/settings/__init__.py +0 -0
  36. src/prompts/settings/custom_dashboard.py +157 -0
  37. src/prompts/website/__init__.py +1 -0
  38. src/prompts/website/website_analyze.py +35 -0
  39. src/prompts/website/website_catalog.py +40 -0
  40. src/prompts/website/website_configuration.py +105 -0
  41. src/prompts/website/website_metrics.py +34 -0
  42. src/settings/__init__.py +1 -0
  43. src/settings/custom_dashboard_tools.py +417 -0
  44. src/website/__init__.py +0 -0
  45. src/website/website_analyze.py +433 -0
  46. src/website/website_catalog.py +171 -0
  47. src/website/website_configuration.py +770 -0
  48. src/website/website_metrics.py +241 -0
  49. mcp_instana-0.1.1.dist-info/RECORD +0 -30
  50. src/prompts/mcp_prompts.py +0 -900
  51. src/prompts/prompt_loader.py +0 -29
  52. src/prompts/prompt_registry.json +0 -21
  53. {mcp_instana-0.1.1.dist-info → mcp_instana-0.2.0.dist-info}/WHEEL +0 -0
  54. {mcp_instana-0.1.1.dist-info → mcp_instana-0.2.0.dist-info}/entry_points.txt +0 -0
  55. {mcp_instana-0.1.1.dist-info → mcp_instana-0.2.0.dist-info}/licenses/LICENSE.md +0 -0
@@ -10,7 +10,9 @@ from typing import Any, Dict, Optional, Union
10
10
 
11
11
  # Import the necessary classes from the SDK
12
12
  try:
13
- from instana_client.api.infrastructure_analyze_api import InfrastructureAnalyzeApi
13
+ from instana_client.api.infrastructure_analyze_api import (
14
+ InfrastructureAnalyzeApi,
15
+ )
14
16
  from instana_client.api_client import ApiClient
15
17
  from instana_client.configuration import Configuration
16
18
  from instana_client.models.get_available_metrics_query import (
@@ -22,7 +24,9 @@ try:
22
24
  from instana_client.models.get_infrastructure_groups_query import (
23
25
  GetInfrastructureGroupsQuery,
24
26
  )
25
- from instana_client.models.get_infrastructure_query import GetInfrastructureQuery
27
+ from instana_client.models.get_infrastructure_query import (
28
+ GetInfrastructureQuery,
29
+ )
26
30
  except ImportError as e:
27
31
  import logging
28
32
  logger = logging.getLogger(__name__)
@@ -271,7 +275,7 @@ class InfrastructureAnalyzeMCPTools(BaseInstanaClient):
271
275
  # Create the GetInfrastructureQuery object
272
276
  try:
273
277
  # Create the query object directly from the request body
274
- get_infra_query = GetInfrastructureQuery(**request_body)
278
+ get_infra_query = GetInfrastructureQuery(**request_body) #type: ignore
275
279
  logger.debug("Successfully created GetInfrastructureQuery object")
276
280
  except Exception as model_error:
277
281
  error_msg = f"Failed to create GetInfrastructureQuery object: {model_error}"
@@ -9,7 +9,9 @@ from typing import Any, Dict, List, Optional
9
9
 
10
10
  # Import the necessary classes from the SDK
11
11
  try:
12
- from instana_client.api.infrastructure_catalog_api import InfrastructureCatalogApi
12
+ from instana_client.api.infrastructure_catalog_api import (
13
+ InfrastructureCatalogApi,
14
+ )
13
15
  from instana_client.api_client import ApiClient
14
16
  from instana_client.configuration import Configuration
15
17
  except ImportError as e:
@@ -18,8 +18,12 @@ from src.core.utils import (
18
18
  )
19
19
 
20
20
  try:
21
- from instana_client.api.infrastructure_metrics_api import InfrastructureMetricsApi
22
- from instana_client.models.get_combined_metrics import GetCombinedMetrics
21
+ from instana_client.api.infrastructure_metrics_api import (
22
+ InfrastructureMetricsApi,
23
+ )
24
+ from instana_client.models.get_combined_metrics import (
25
+ GetCombinedMetrics,
26
+ )
23
27
  except ImportError as e:
24
28
  import logging
25
29
  logger = logging.getLogger(__name__)
@@ -11,7 +11,7 @@ from typing import Any, Dict, List, Optional, Union
11
11
 
12
12
  # Import the necessary classes from the SDK
13
13
  try:
14
- from instana_client.api.infrastructure_resources_api import (
14
+ from instana_client.api.infrastructure_resources_api import ( #type: ignore
15
15
  InfrastructureResourcesApi,
16
16
  )
17
17
  # Check if GetSnapshotsQuery exists, otherwise we'll handle it differently
@@ -411,7 +411,9 @@ class InfrastructureResourcesMCPTools(BaseInstanaClient):
411
411
  logger.debug(f"Using to_time={to_time}, window_size={window_size}")
412
412
 
413
413
  if has_get_snapshots_query:
414
- from instana_client.models.get_snapshots_query import GetSnapshotsQuery
414
+ from instana_client.models.get_snapshots_query import (
415
+ GetSnapshotsQuery, #type: ignore
416
+ )
415
417
 
416
418
  query_obj = GetSnapshotsQuery(
417
419
  snapshot_ids=snapshot_ids,
@@ -594,8 +596,8 @@ class InfrastructureResourcesMCPTools(BaseInstanaClient):
594
596
 
595
597
  # Limit the number of items to return
596
598
  if items_count > 10:
597
- result_dict['summary'] = f"Showing 10 of {items_count} items"
598
- result_dict['items'] = result_dict['items'][:10]
599
+ result_dict['summary'] = f"Showing 10 of {items_count} items" #type: ignore
600
+ result_dict['items'] = result_dict['items'][:10] #type: ignore
599
601
 
600
602
  # If tagTree exists, extract tag names
601
603
  if 'tagTree' in result_dict and isinstance(result_dict['tagTree'], list):
@@ -612,7 +614,7 @@ class InfrastructureResourcesMCPTools(BaseInstanaClient):
612
614
  })
613
615
 
614
616
  # Replace the large tagTree with the extracted tag names
615
- result_dict['tagNames'] = tag_names
617
+ result_dict['tagNames'] = tag_names #type: ignore
616
618
  del result_dict['tagTree']
617
619
 
618
620
  return result_dict
@@ -10,9 +10,11 @@ from typing import Any, Dict, Optional
10
10
 
11
11
  # Import the necessary classes from the SDK
12
12
  try:
13
- from instana_client.api.infrastructure_topology_api import InfrastructureTopologyApi
14
- from instana_client.api_client import ApiClient
15
- from instana_client.configuration import Configuration
13
+ from instana_client.api.infrastructure_topology_api import (
14
+ InfrastructureTopologyApi, #type: ignore
15
+ )
16
+ from instana_client.api_client import ApiClient #type: ignore
17
+ from instana_client.configuration import Configuration #type: ignore
16
18
 
17
19
  except ImportError:
18
20
  import logging
@@ -0,0 +1,16 @@
1
+ """Prompts package for MCP Instana."""
2
+ import logging
3
+
4
+ from fastmcp import FastMCP
5
+
6
+ # Create an MCP server
7
+ mcp = FastMCP("Instana MCP Server")
8
+
9
+ # Global registry for all prompts
10
+ PROMPT_REGISTRY = []
11
+
12
+ def auto_register_prompt(func):
13
+ """Wrap MCP's @mcp.prompt to also store prompt in a registry."""
14
+ func = mcp.prompt()(func) # apply MCP's decorator
15
+ PROMPT_REGISTRY.append(func)
16
+ return func
@@ -0,0 +1 @@
1
+ """Application-specific prompts package."""
@@ -0,0 +1,54 @@
1
+ from typing import Optional
2
+
3
+ from src.prompts import auto_register_prompt
4
+
5
+
6
+ class ApplicationAlertsPrompts:
7
+ """Class containing application alerts related prompts"""
8
+
9
+
10
+ @auto_register_prompt
11
+ @staticmethod
12
+ def app_alerts_list(from_time: Optional[int]=None, to_time: Optional[int]=None, name_filter: Optional[str] = None, severity: Optional[str] = None) -> str:
13
+ """List all application alerts in Instana server"""
14
+ return f"""
15
+ List application alerts with filters:
16
+ - Name filter: {name_filter or 'None'}
17
+ - Severity: {severity or 'None'}
18
+ - Time range: {from_time} to {to_time or 'current time'}
19
+ """
20
+
21
+
22
+ @auto_register_prompt
23
+ @staticmethod
24
+ def app_alert_details(alert_ids: Optional[list] = None, application_id: Optional[str] = None) -> str:
25
+ """Get Smart Alert Configurations details for a specific application"""
26
+ return f"""
27
+ Get alert details for:
28
+ - Alert IDs: {alert_ids or 'None'}
29
+ - Application ID: {application_id or 'None'}
30
+ """
31
+
32
+
33
+ @auto_register_prompt
34
+ @staticmethod
35
+ def app_alert_config_delete(id: str) -> str:
36
+ """Delete a Smart Alert Configuration by ID"""
37
+ return f"Delete alert configuration with ID: {id}"
38
+
39
+
40
+ @auto_register_prompt
41
+ @staticmethod
42
+ def app_alert_config_enable(id: str) -> str:
43
+ """Enable a Smart Alert Configuration by ID"""
44
+ return f"Enable alert configuration with ID: {id}"
45
+
46
+ @classmethod
47
+ def get_prompts(cls):
48
+ """Return all prompts defined in this class"""
49
+ return [
50
+ ('app_alerts_list', cls.app_alerts_list),
51
+ ('app_alert_details', cls.app_alert_details),
52
+ ('app_alert_config_delete', cls.app_alert_config_delete),
53
+ ('app_alert_config_enable', cls.app_alert_config_enable),
54
+ ]
@@ -0,0 +1,26 @@
1
+ from typing import Optional
2
+
3
+ from src.prompts import auto_register_prompt
4
+
5
+
6
+ class ApplicationCatalogPrompts:
7
+ """Class containing application catalog related prompts"""
8
+
9
+ @auto_register_prompt
10
+ @staticmethod
11
+ def app_catalog_yesterday(limit: int, use_case: Optional[str] = None, data_source: Optional[str] = None, var_from: Optional[int] = None) -> str:
12
+ """List 3 available application tag catalog data for yesterday"""
13
+ return f"""
14
+ Get application catalog data:
15
+ - Use case: {use_case or 'None'}
16
+ - Data source: {data_source or 'None'}
17
+ - From: {var_from or 'last 24 hours'}
18
+ - Limit: {limit or '100'}
19
+ """
20
+
21
+ @classmethod
22
+ def get_prompts(cls):
23
+ """Return all prompts defined in this class"""
24
+ return [
25
+ ('app_catalog_yesterday', cls.app_catalog_yesterday),
26
+ ]
@@ -0,0 +1,57 @@
1
+ from typing import Optional
2
+
3
+ from src.prompts import auto_register_prompt
4
+
5
+
6
+ class ApplicationMetricsPrompts:
7
+ """Class containing application metrics related prompts"""
8
+
9
+ @auto_register_prompt
10
+ @staticmethod
11
+ def get_application_metrics(application_ids: Optional[list] = None, metrics: Optional[list] = None, time_frame: Optional[dict] = None, fill_time_series: Optional[bool] = None) -> str:
12
+ """Retrieve metrics for specific applications including latency, error rates, etc., over a given time frame"""
13
+ return f"""
14
+ Get application metrics for:
15
+ - Application IDs: {application_ids or 'None'}
16
+ - Metrics: {metrics or 'None'}
17
+ - Time frame: {time_frame or 'None'}
18
+ - Fill time series: {fill_time_series or 'None'}
19
+ """
20
+
21
+ @auto_register_prompt
22
+ @staticmethod
23
+ def get_application_endpoints_metrics(application_ids: Optional[list] = None, metrics: Optional[list] = None, time_frame: Optional[dict] = None, order: Optional[dict] = None, pagination: Optional[dict] = None, filters: Optional[dict] = None, fill_time_series: Optional[bool] = None) -> str:
24
+ """Retrieve metrics for endpoints within an application, such as latency, error rates, and call counts"""
25
+ return f"""
26
+ Get endpoint metrics for applications:
27
+ - Application IDs: {application_ids}
28
+ - Metrics: {metrics}
29
+ - Time frame: {time_frame}
30
+ - Order: {order or 'None'}
31
+ - Pagination: {pagination or 'None'}
32
+ - Filters: {filters or 'None'}
33
+ - Fill time series: {fill_time_series or 'None'}
34
+ """
35
+
36
+ @auto_register_prompt
37
+ @staticmethod
38
+ def get_application_service_metrics(service_ids: list, metrics: Optional[list] = None, var_from: Optional[int] = None, to: Optional[int] = None, fill_time_series: Optional[bool] = None, include_snapshot_ids: Optional[bool] = None) -> str:
39
+ """Fetch metrics over a specific time frame for specific services"""
40
+ return f"""
41
+ Get service metrics:
42
+ - Service IDs: {service_ids}
43
+ - Metrics: {metrics or 'None'}
44
+ - From: {var_from or '1 hour ago'}
45
+ - To: {to or 'now'}
46
+ - Fill time series: {fill_time_series or 'None'}
47
+ - Include snapshot IDs: {include_snapshot_ids or 'None'}
48
+ """
49
+
50
+ @classmethod
51
+ def get_prompts(cls):
52
+ """Return all prompts defined in this class"""
53
+ return [
54
+ ('get_application_metrics', cls.get_application_metrics),
55
+ ('get_application_endpoints_metrics', cls.get_application_endpoints_metrics),
56
+ ('get_application_service_metrics', cls.get_application_service_metrics),
57
+ ]
@@ -0,0 +1,26 @@
1
+ from typing import Optional
2
+
3
+ from src.prompts import auto_register_prompt
4
+
5
+
6
+ class ApplicationResourcesPrompts:
7
+ """Class containing application resources related prompts"""
8
+
9
+ @auto_register_prompt
10
+ @staticmethod
11
+ def application_insights_summary(window_size: int, to_time: int, name_filter: Optional[str] = None, application_boundary_scope: Optional[str] = None) -> str:
12
+ """Retrieve a list of services within application perspectives from Instana"""
13
+ return f"""
14
+ Get application insights summary with:
15
+ - Name filter: {name_filter or 'None'}
16
+ - Window size: {window_size or '1 hour'}
17
+ - To time: {to_time or 'now'}
18
+ - Boundary scope: {application_boundary_scope or 'None'}
19
+ """
20
+
21
+ @classmethod
22
+ def get_prompts(cls):
23
+ """Return all prompts defined in this class"""
24
+ return [
25
+ ('application_insights_summary', cls.application_insights_summary),
26
+ ]
@@ -0,0 +1,75 @@
1
+ from typing import Optional
2
+
3
+ from src.prompts import auto_register_prompt
4
+
5
+
6
+ class ApplicationSettingsPrompts:
7
+ """Class containing application settings related prompts"""
8
+
9
+ @auto_register_prompt
10
+ @staticmethod
11
+ def get_all_applications_configs() -> str:
12
+ """Get a list of all Application Perspectives with their configuration settings"""
13
+ return "Retrieve all application configurations"
14
+
15
+ @auto_register_prompt
16
+ @staticmethod
17
+ def get_application_config(id: str) -> str:
18
+ """Get an Application Perspective configuration by ID"""
19
+ return f"Retrieve application configuration with ID: {id}"
20
+
21
+ @auto_register_prompt
22
+ @staticmethod
23
+ def get_all_endpoint_configs() -> str:
24
+ """Get a list of all Endpoint Perspectives with their configuration settings"""
25
+ return "Retrieve all endpoint configurations"
26
+
27
+ @auto_register_prompt
28
+ @staticmethod
29
+ def get_endpoint_config(id: str) -> str:
30
+ """Retrieve the endpoint configuration of a service"""
31
+ return f"Get endpoint configuration with ID: {id}"
32
+
33
+ @auto_register_prompt
34
+ @staticmethod
35
+ def get_all_manual_service_configs() -> str:
36
+ """Get a list of all Manual Service Perspectives with their configuration settings"""
37
+ return "Retrieve all manual service configurations"
38
+
39
+ @auto_register_prompt
40
+ @staticmethod
41
+ def add_manual_service_config(
42
+ enabled: bool,
43
+ tag_filter_expression: dict,
44
+ unmonitored_service_name: Optional[str] = None,
45
+ existing_service_id: Optional[str] = None,
46
+ description: Optional[str] = None
47
+ ) -> str:
48
+ """Create a manual service mapping configuration"""
49
+ return f"""
50
+ Add manual service configuration:
51
+ - Tag filter: {tag_filter_expression}
52
+ - Unmonitored service name: {unmonitored_service_name or 'None'}
53
+ - Existing service ID: {existing_service_id or 'None'}
54
+ - Description: {description or 'None'}
55
+ - Enabled: {enabled or 'True'}
56
+ """
57
+
58
+ @auto_register_prompt
59
+ @staticmethod
60
+ def get_service_config(id: str) -> str:
61
+ """Retrieve the particular custom service configuration"""
62
+ return f"Get service configuration with ID: {id}"
63
+
64
+ @classmethod
65
+ def get_prompts(cls):
66
+ """Return all prompts defined in this class"""
67
+ return [
68
+ ('get_all_applications_configs', cls.get_all_applications_configs),
69
+ ('get_application_config', cls.get_application_config),
70
+ ('get_all_endpoint_configs', cls.get_all_endpoint_configs),
71
+ ('get_endpoint_config', cls.get_endpoint_config),
72
+ ('get_all_manual_service_configs', cls.get_all_manual_service_configs),
73
+ ('add_manual_service_config', cls.add_manual_service_config),
74
+ ('get_service_config', cls.get_service_config),
75
+ ]
@@ -0,0 +1,30 @@
1
+ from typing import Optional
2
+
3
+ from src.prompts import auto_register_prompt
4
+
5
+
6
+ class ApplicationTopologyPrompts:
7
+ """Class containing application topology related prompts"""
8
+
9
+ @auto_register_prompt
10
+ @staticmethod
11
+ def get_application_topology(
12
+ window_size: Optional[int] = None,
13
+ to_timestamp: Optional[int] = None,
14
+ application_id: Optional[str] = None,
15
+ application_boundary_scope: Optional[str] = None) -> str:
16
+ """Retrieve the service topology showing connections between services"""
17
+ return f"""
18
+ Get application topology:
19
+ - Window size: {window_size or '1 hour'}
20
+ - To timestamp: {to_timestamp or 'current time'}
21
+ - Application ID: {application_id or 'None'}
22
+ - Boundary scope: {application_boundary_scope or 'INBOUND'}
23
+ """
24
+
25
+ @classmethod
26
+ def get_prompts(cls):
27
+ """Return all prompts defined in this class"""
28
+ return [
29
+ ('get_application_topology', cls.get_application_topology),
30
+ ]
@@ -0,0 +1 @@
1
+ """Events-specific prompts package."""
@@ -0,0 +1,161 @@
1
+ from typing import List, Optional, Union
2
+
3
+ from src.prompts import auto_register_prompt
4
+
5
+
6
+ class EventsPrompts:
7
+ """Class containing events related prompts"""
8
+
9
+ @auto_register_prompt
10
+ @staticmethod
11
+ def get_event(
12
+ event_id: str
13
+ ) -> str:
14
+ """Get an overview of a specific event"""
15
+ return f"""
16
+ Get specific event:
17
+ - Event ID: {event_id}
18
+ """
19
+
20
+ @auto_register_prompt
21
+ @staticmethod
22
+ def get_kubernetes_info_events(
23
+ from_time: Optional[int] = None,
24
+ to_time: Optional[int] = None,
25
+ time_range: Optional[str] = None,
26
+ max_events: Optional[int] = 50
27
+ ) -> str:
28
+ """Get Kubernetes info events and analyze them"""
29
+ return f"""
30
+ Get Kubernetes info events:
31
+ - From time: {from_time or '(default: 24 hours ago)'}
32
+ - To time: {to_time or '(default: current time)'}
33
+ - Time range: {time_range or '(not specified)'}
34
+ - Max events: {max_events}
35
+ """
36
+
37
+ @auto_register_prompt
38
+ @staticmethod
39
+ def get_agent_monitoring_events(
40
+ query: Optional[str] = None,
41
+ from_time: Optional[int] = None,
42
+ to_time: Optional[int] = None,
43
+ size: Optional[int] = 100,
44
+ max_events: Optional[int] = 50,
45
+ time_range: Optional[str] = None
46
+ ) -> str:
47
+ """Get Agent monitoring events and analyze them"""
48
+ return f"""
49
+ Get Agent monitoring events:
50
+ - Query: {query or '(not specified)'}
51
+ - From time: {from_time or '(default: 1 hour ago)'}
52
+ - To time: {to_time or '(default: current time)'}
53
+ - Size: {size}
54
+ - Max events: {max_events}
55
+ - Time range: {time_range or '(not specified)'}
56
+ """
57
+
58
+ @auto_register_prompt
59
+ @staticmethod
60
+ def get_issues(
61
+ query: Optional[str] = None,
62
+ from_time: Optional[int] = None,
63
+ to_time: Optional[int] = None,
64
+ filter_event_updates: Optional[bool] = None,
65
+ exclude_triggered_before: Optional[int] = None,
66
+ event_type_filters: Optional[list[str]] = None,
67
+ max_events: Optional[int] = 50,
68
+ size: Optional[int] = 100,
69
+ time_range: Optional[str] = None
70
+ ) -> str:
71
+ """Get all issues within a specified time range"""
72
+ return f"""
73
+ Get all events:
74
+ - Query: {query or '(not specified)'}
75
+ - From time: {from_time or '(default: 1 hour ago)'}
76
+ - To time: {to_time or '(default: current time)'}
77
+ - Size: {size}
78
+ - Max events: {max_events}
79
+ - Time range: {time_range or '(not specified)'}
80
+ - Filter event updates: {filter_event_updates or 'False'}
81
+ - Exclude triggered before: {exclude_triggered_before or 'None'}
82
+ - Event type filters: {event_type_filters or 'None'}
83
+ """
84
+
85
+ @auto_register_prompt
86
+ @staticmethod
87
+ def get_incidents(
88
+ query: Optional[str] = None,
89
+ from_time: Optional[int] = None,
90
+ to_time: Optional[int] = None,
91
+ filter_event_updates: Optional[bool] = None,
92
+ exclude_triggered_before: Optional[int] = None,
93
+ event_type_filters: Optional[list[str]] = None,
94
+ max_events: Optional[int] = 50,
95
+ size: Optional[int] = 100,
96
+ time_range: Optional[str] = None
97
+ ) -> str:
98
+ """Get all incidents within a specified time range"""
99
+ return f"""
100
+ Get all events:
101
+ - Query: {query or '(not specified)'}
102
+ - From time: {from_time or '(default: 1 hour ago)'}
103
+ - To time: {to_time or '(default: current time)'}
104
+ - Size: {size}
105
+ - Max events: {max_events}
106
+ - Time range: {time_range or '(not specified)'}
107
+ - Filter event updates: {filter_event_updates or 'False'}
108
+ - Exclude triggered before: {exclude_triggered_before or 'None'}
109
+ - Event type filters: {event_type_filters or 'None'}
110
+ """
111
+
112
+ @auto_register_prompt
113
+ @staticmethod
114
+ def get_changes(
115
+ query: Optional[str] = None,
116
+ from_time: Optional[int] = None,
117
+ to_time: Optional[int] = None,
118
+ filter_event_updates: Optional[bool] = None,
119
+ exclude_triggered_before: Optional[int] = None,
120
+ event_type_filters: Optional[list[str]] = None,
121
+ max_events: Optional[int] = 50,
122
+ size: Optional[int] = 100,
123
+ time_range: Optional[str] = None
124
+ ) -> str:
125
+ """Get all changes within a specified time range"""
126
+ return f"""
127
+ Get all events:
128
+ - Query: {query or '(not specified)'}
129
+ - From time: {from_time or '(default: 1 hour ago)'}
130
+ - To time: {to_time or '(default: current time)'}
131
+ - Size: {size}
132
+ - Max events: {max_events}
133
+ - Time range: {time_range or '(not specified)'}
134
+ - Filter event updates: {filter_event_updates or 'False'}
135
+ - Exclude triggered before: {exclude_triggered_before or 'None'}
136
+ - Event type filters: {event_type_filters or 'None'}
137
+ """
138
+
139
+ @auto_register_prompt
140
+ @staticmethod
141
+ def get_events_by_ids(
142
+ event_ids: Union[List[str], str]
143
+ ) -> str:
144
+ """Get multiple events by their IDs"""
145
+ return f"""
146
+ Get events by IDs:
147
+ - Event IDs: {event_ids}
148
+ """
149
+
150
+ @classmethod
151
+ def get_prompts(cls):
152
+ """Return all prompts defined in this class"""
153
+ return [
154
+ ('get_event', cls.get_event),
155
+ ('get_kubernetes_info_events', cls.get_kubernetes_info_events),
156
+ ('get_agent_monitoring_events', cls.get_agent_monitoring_events),
157
+ ('get_issues', cls.get_issues),
158
+ ('get_incidents', cls.get_incidents),
159
+ ('get_changes', cls.get_changes),
160
+ ('get_events_by_ids', cls.get_events_by_ids),
161
+ ]
@@ -0,0 +1,72 @@
1
+ """
2
+ Infrastructure Analyze MCP Prompts Module
3
+
4
+ This module provides infrastructure analyze-specific MCP prompts for Instana monitoring.
5
+ """
6
+
7
+ from typing import Callable, Dict, List, Optional, Tuple
8
+
9
+ from src.prompts import auto_register_prompt
10
+
11
+
12
+ class InfrastructureAnalyzePrompts:
13
+ """Class containing prompts for infrastructure analysis in Instana."""
14
+
15
+ @auto_register_prompt
16
+ @staticmethod
17
+ def infra_available_metrics(
18
+ type: str,
19
+ query: Optional[str] = None,
20
+ var_from: Optional[int] = None,
21
+ to: Optional[int] = None,
22
+ windowSize: Optional[int] = None) -> str:
23
+ """Get available infrastructure metrics for a given entity type"""
24
+ return f"""
25
+ Get available infrastructure metrics:
26
+ - Type: {type}
27
+ - Query: {query or 'None'}
28
+ - From: {var_from or 'None'}
29
+ - To: {to or 'None'}
30
+ - Window size: {windowSize or 'None'}
31
+ """
32
+
33
+ @auto_register_prompt
34
+ @staticmethod
35
+ def infra_get_entities(
36
+ type: str,
37
+ metrics: Optional[str] = None,
38
+ windowSize: Optional[int] = None,
39
+ to: Optional[int] = None) -> str:
40
+ """Fetch infrastructure entities and their metrics"""
41
+ return f"""
42
+ Get infrastructure entities:
43
+ - Type: {type}
44
+ - Metrics: {metrics}
45
+ - Window size: {windowSize or 'None'}
46
+ - To: {to or 'None'}
47
+ """
48
+
49
+ @auto_register_prompt
50
+ @staticmethod
51
+ def infra_available_plugins(
52
+ offline: bool,
53
+ query: Optional[str] = None,
54
+ windowSize: Optional[int] = None,
55
+ to: Optional[int] = None) -> str:
56
+ """List available infrastructure monitoring plugins"""
57
+ return f"""
58
+ Get available infrastructure plugins:
59
+ - Query: {query or 'None'}
60
+ - Offline: {offline or 'False'}
61
+ - Window size: {windowSize or 'None'}
62
+ - To: {to or 'None'}
63
+ """
64
+
65
+ @classmethod
66
+ def get_prompts(cls):
67
+ """Get all prompts defined in this class"""
68
+ return [
69
+ ('infra_available_metrics', cls.infra_available_metrics),
70
+ ('infra_get_entities', cls.infra_get_entities),
71
+ ('infra_available_plugins', cls.infra_available_plugins),
72
+ ]