awslabs.cloudwatch-mcp-server 0.0.10__py3-none-any.whl → 0.0.11__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.
- awslabs/cloudwatch_mcp_server/cloudwatch_logs/tools.py +59 -10
- {awslabs_cloudwatch_mcp_server-0.0.10.dist-info → awslabs_cloudwatch_mcp_server-0.0.11.dist-info}/METADATA +1 -1
- {awslabs_cloudwatch_mcp_server-0.0.10.dist-info → awslabs_cloudwatch_mcp_server-0.0.11.dist-info}/RECORD +7 -7
- {awslabs_cloudwatch_mcp_server-0.0.10.dist-info → awslabs_cloudwatch_mcp_server-0.0.11.dist-info}/WHEEL +0 -0
- {awslabs_cloudwatch_mcp_server-0.0.10.dist-info → awslabs_cloudwatch_mcp_server-0.0.11.dist-info}/entry_points.txt +0 -0
- {awslabs_cloudwatch_mcp_server-0.0.10.dist-info → awslabs_cloudwatch_mcp_server-0.0.11.dist-info}/licenses/LICENSE +0 -0
- {awslabs_cloudwatch_mcp_server-0.0.10.dist-info → awslabs_cloudwatch_mcp_server-0.0.11.dist-info}/licenses/NOTICE +0 -0
|
@@ -168,12 +168,37 @@ class CloudWatchLogsTools:
|
|
|
168
168
|
"""
|
|
169
169
|
poll_start = timer()
|
|
170
170
|
while poll_start + max_timeout > timer():
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
try:
|
|
172
|
+
response = logs_client.get_query_results(queryId=query_id)
|
|
173
|
+
status = response['status']
|
|
174
|
+
|
|
175
|
+
logger.debug(f'Query {query_id} status: {status}')
|
|
176
|
+
|
|
177
|
+
if status in {'Complete', 'Failed', 'Cancelled'}:
|
|
178
|
+
logger.info(f'Query {query_id} finished with status {status}')
|
|
179
|
+
result = self._process_query_results(response, query_id)
|
|
180
|
+
|
|
181
|
+
# Handle case where query completed but returned no results
|
|
182
|
+
if status == 'Complete' and not result.get('results'):
|
|
183
|
+
logger.info(f'Query {query_id} completed but returned no results')
|
|
184
|
+
result['results'] = []
|
|
185
|
+
|
|
186
|
+
return result
|
|
187
|
+
|
|
188
|
+
# Handle unexpected status states
|
|
189
|
+
if status not in {'Scheduled', 'Running'}:
|
|
190
|
+
logger.warning(f'Query {query_id} has unexpected status: {status}')
|
|
191
|
+
return self._process_query_results(response, query_id)
|
|
173
192
|
|
|
174
|
-
|
|
175
|
-
logger.
|
|
176
|
-
|
|
193
|
+
except Exception as e:
|
|
194
|
+
logger.error(f'Error polling for query {query_id} completion: {str(e)}')
|
|
195
|
+
await ctx.error(f'Error during query polling: {str(e)}')
|
|
196
|
+
return {
|
|
197
|
+
'queryId': query_id,
|
|
198
|
+
'status': 'Error',
|
|
199
|
+
'message': f'Error occurred while polling: {str(e)}',
|
|
200
|
+
'results': [],
|
|
201
|
+
}
|
|
177
202
|
|
|
178
203
|
await asyncio.sleep(1)
|
|
179
204
|
|
|
@@ -184,6 +209,7 @@ class CloudWatchLogsTools:
|
|
|
184
209
|
'queryId': query_id,
|
|
185
210
|
'status': 'Polling Timeout',
|
|
186
211
|
'message': msg,
|
|
212
|
+
'results': [],
|
|
187
213
|
}
|
|
188
214
|
|
|
189
215
|
def register(self, mcp):
|
|
@@ -576,8 +602,16 @@ class CloudWatchLogsTools:
|
|
|
576
602
|
|
|
577
603
|
except Exception as e:
|
|
578
604
|
logger.error(f'Error in execute_log_insights_query_tool: {str(e)}')
|
|
579
|
-
|
|
580
|
-
|
|
605
|
+
error_msg = f'Error executing CloudWatch Logs Insights query: {str(e)}'
|
|
606
|
+
await ctx.error(error_msg)
|
|
607
|
+
|
|
608
|
+
# Instead of raising, return a consistent error result
|
|
609
|
+
return {
|
|
610
|
+
'queryId': '',
|
|
611
|
+
'status': 'Error',
|
|
612
|
+
'message': error_msg,
|
|
613
|
+
'results': [],
|
|
614
|
+
}
|
|
581
615
|
|
|
582
616
|
async def get_logs_insight_query_results(
|
|
583
617
|
self,
|
|
@@ -612,11 +646,26 @@ class CloudWatchLogsTools:
|
|
|
612
646
|
|
|
613
647
|
logger.info(f'Retrieved results for query ID {query_id}')
|
|
614
648
|
|
|
615
|
-
|
|
649
|
+
result = self._process_query_results(response, query_id)
|
|
650
|
+
|
|
651
|
+
# Ensure results is always an array, even if empty
|
|
652
|
+
if not result.get('results'):
|
|
653
|
+
result['results'] = []
|
|
654
|
+
|
|
655
|
+
return result
|
|
656
|
+
|
|
616
657
|
except Exception as e:
|
|
617
658
|
logger.error(f'Error in get_query_results_tool: {str(e)}')
|
|
618
|
-
|
|
619
|
-
|
|
659
|
+
error_msg = f'Error retrieving CloudWatch Logs Insights query results: {str(e)}'
|
|
660
|
+
await ctx.error(error_msg)
|
|
661
|
+
|
|
662
|
+
# Return consistent error structure instead of raising
|
|
663
|
+
return {
|
|
664
|
+
'queryId': query_id,
|
|
665
|
+
'status': 'Error',
|
|
666
|
+
'message': error_msg,
|
|
667
|
+
'results': [],
|
|
668
|
+
}
|
|
620
669
|
|
|
621
670
|
async def cancel_logs_insight_query(
|
|
622
671
|
self,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: awslabs.cloudwatch-mcp-server
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.11
|
|
4
4
|
Summary: An AWS Labs Model Context Protocol (MCP) server for cloudwatch
|
|
5
5
|
Project-URL: homepage, https://awslabs.github.io/mcp/
|
|
6
6
|
Project-URL: docs, https://awslabs.github.io/mcp/servers/cloudwatch-mcp-server/
|
|
@@ -5,13 +5,13 @@ awslabs/cloudwatch_mcp_server/server.py,sha256=raMeiC0F8M7cIH6-5rZnU2_DZZkPEtpvR
|
|
|
5
5
|
awslabs/cloudwatch_mcp_server/cloudwatch_alarms/models.py,sha256=vqctogiT-EjzA_VczWUYeskaF_aAOBQJR_s5KI7NkuI,7202
|
|
6
6
|
awslabs/cloudwatch_mcp_server/cloudwatch_alarms/tools.py,sha256=PGEm8alzSAbrz-X-JaWARGPHKU1IBXDTmNP8R7PZPfc,30865
|
|
7
7
|
awslabs/cloudwatch_mcp_server/cloudwatch_logs/models.py,sha256=wyfxHNN5E2K49LreqKBMAZ4Vyvc2MMkxMCfyGHsK-pQ,7982
|
|
8
|
-
awslabs/cloudwatch_mcp_server/cloudwatch_logs/tools.py,sha256=
|
|
8
|
+
awslabs/cloudwatch_mcp_server/cloudwatch_logs/tools.py,sha256=b0tobrfTkyEzKkqof0wNR649PWfOIA0euGSwT4qvevM,30018
|
|
9
9
|
awslabs/cloudwatch_mcp_server/cloudwatch_metrics/models.py,sha256=ov6aJUUrN2fz9Gom-tE4DT5h6M0PCkKwA9pEBnVv6SE,5756
|
|
10
10
|
awslabs/cloudwatch_mcp_server/cloudwatch_metrics/tools.py,sha256=GoW0gLy35gW7MspbxtfNBghUgR8xWIa4tgcohqYE1h8,33410
|
|
11
11
|
awslabs/cloudwatch_mcp_server/cloudwatch_metrics/data/metric_metadata.json,sha256=FlSUlfYVo1VdANrsBg50atggMNGSqZvhhZU7ca-v48c,745055
|
|
12
|
-
awslabs_cloudwatch_mcp_server-0.0.
|
|
13
|
-
awslabs_cloudwatch_mcp_server-0.0.
|
|
14
|
-
awslabs_cloudwatch_mcp_server-0.0.
|
|
15
|
-
awslabs_cloudwatch_mcp_server-0.0.
|
|
16
|
-
awslabs_cloudwatch_mcp_server-0.0.
|
|
17
|
-
awslabs_cloudwatch_mcp_server-0.0.
|
|
12
|
+
awslabs_cloudwatch_mcp_server-0.0.11.dist-info/METADATA,sha256=CGl6c-2NH9cfhuygysGBGvMKp-lCmmn45-b-6RoufJg,10115
|
|
13
|
+
awslabs_cloudwatch_mcp_server-0.0.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
awslabs_cloudwatch_mcp_server-0.0.11.dist-info/entry_points.txt,sha256=u8YZn3_qq9Ai7nRux17K6K7RDssOBhTSyUNyZKrQUIk,92
|
|
15
|
+
awslabs_cloudwatch_mcp_server-0.0.11.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
|
|
16
|
+
awslabs_cloudwatch_mcp_server-0.0.11.dist-info/licenses/NOTICE,sha256=xpvRUSHqG7LIpUZ1W_0D4sfPJG8lj51X6Mxjq1KJ6eQ,97
|
|
17
|
+
awslabs_cloudwatch_mcp_server-0.0.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|