awslabs.cloudwatch-mcp-server
v0.3.2An AWS Labs Model Context Protocol (MCP) server for cloudwatch
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
describe_log_groups
Lists AWS CloudWatch log groups and saved queries associated with them, optionally filtering by a name prefix. This tool retrieves information about log groups in the account, or log groups in accounts linked to this account as a monitoring account. If a prefix is provided, only log groups with names starting with the specified prefix are returned. Additionally returns any user saved queries that are associated with any of the returned log groups. Usage: Use this tool to discover log groups that you'd retrieve or query logs from and queries that have been sav…
| Parameter | Type | Description |
|---|---|---|
account_identifiers | When include_linked_accounts is set to True, use this parameter to specify the list of accounts to search. IMPORTANT: Only has affect if include_linked_accounts is True | |
include_linked_accounts | If the AWS account is a monitoring account, set this to True to have the tool return log groups in the accounts listed in account_identifiers. If this parameter is set to true and acco… | |
log_group_class | If specified, filters for only log groups of the specified class. | |
log_group_name_prefix | An exact prefix to filter log groups by name. IMPORTANT: Only log groups with names starting with this prefix will be returned. | |
max_items | The maximum number of log groups to return. | |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. |
analyze_log_group
Analyzes a CloudWatch log group for anomalies, message patterns, and error patterns within a specified time window. This tool performs an analysis of the specified log group by: 1. Discovering and checking log anomaly detectors associated with the log group 2. Retrieving anomalies from those detectors that fall within the specified time range 3. Identifying the top 5 most common message patterns 4. Finding the top 5 patterns containing error-related terms Usage: Use this tool to detect anomalies and understand common patterns in your log data,…
| Parameter | Type | Description |
|---|---|---|
end_time * | string | ISO 8601 formatted end time for the CloudWatch Logs Insights query window (e.g., "2025-04-19T21:00:00+00:00"). |
log_group_arn * | string | The log group arn to look for anomalies in, as returned by the describe_log_groups tools |
start_time * | string | ISO 8601 formatted start time for the CloudWatch Logs Insights query window (e.g., "2025-04-19T20:00:00+00:00"). |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. |
execute_log_insights_query
Executes a CloudWatch Logs Insights query and waits for the results to be available. IMPORTANT: The operation must include exactly one of the following parameters: log_group_names, or log_group_identifiers. CRITICAL: The volume of returned logs can easily overwhelm the agent context window. Always include a limit in the query (| limit 50) or using the limit parameter. Usage: Use to query, filter, collect statistics, or find patterns in one or more log groups. For example, the following query lists exceptions per hour. ``` filter @mess…
| Parameter | Type | Description |
|---|---|---|
end_time * | string | ISO 8601 formatted end time for the CloudWatch Logs Insights query window (e.g., "2025-04-19T21:00:00+00:00"). |
query_string * | string | The query string in the Cloudwatch Log Insights Query Language. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html. |
start_time * | string | ISO 8601 formatted start time for the CloudWatch Logs Insights query window (e.g., "2025-04-19T20:00:00+00:00"). |
limit | The maximum number of log events to return. It is critical to use either this parameter or a `| limit <int>` operator in the query to avoid consuming too many tokens of the agent. | |
log_group_identifiers | The list of up to 50 logGroupIdentifiers to query. You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and you're using a monitoring account,… | |
log_group_names | The list of up to 50 log group names to be queried. CRITICAL: Exactly one of [log_group_names, log_group_identifiers] should be non-null. | |
max_timeout | integer | Maximum time in second to poll for complete results before giving up |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. |
get_logs_insight_query_results
Retrieves the results of a previously started CloudWatch Logs Insights query. Usage: If a log query is started by execute_log_insights_query tool and has a polling time out, this tool can be used to try to retrieve the query results again. Returns: -------- A dictionary containing the final query results, including: - status: The current status of the query (e.g., Scheduled, Running, Complete, Failed, etc.) - results: A list of the actual query results if the status is Complete. - statistics: Query pe…
| Parameter | Type | Description |
|---|---|---|
query_id * | string | The unique ID of the query to retrieve the results for. CRITICAL: This ID is returned by the execute_log_insights_query tool. |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. |
cancel_logs_insight_query
Cancels an ongoing CloudWatch Logs Insights query. If the query has already ended, returns an error that the given query is not running. Usage: If a log query is started by execute_log_insights_query tool and has a polling time out, this tool can be used to cancel it prematurely to avoid incurring additional costs. Returns: -------- A LogsQueryCancelResult with a "success" key, which is True if the query was successfully cancelled.
| Parameter | Type | Description |
|---|---|---|
query_id * | string | The unique ID of the ongoing query to cancel. CRITICAL: This ID is returned by the execute_log_insights_query tool. |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. |
execute_cwl_insights_batch
Run a CloudWatch Logs Insights query across multiple log groups, accounts, and regions. Automatically chunks log groups (max 50 per StartQuery), throttles concurrency to 25% of account limits, retries transient failures, and splits time ranges on 10k-record or timeout hits (up to 4 levels). Results are annotated with _region, _logGroups, and optionally _account metadata. For simple single-region queries on a few log groups, use execute_log_insights_query instead. Raises: ValueError: If input parameters are invalid (e.g. start_time >= end_time).
| Parameter | Type | Description |
|---|---|---|
end_time * | string | ISO 8601 end time (e.g. "2025-04-19T21:00:00+00:00"). |
log_group_names * | array | List of CloudWatch log group names or ARNs to query. Use ARN format (arn:aws:logs:region:account-id:log-group:name) for cross-account/cross-region queries. These will be automatically chunked into bat… |
query_string * | string | CloudWatch Logs Insights query string. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html |
regions * | array | List of AWS regions to query (e.g. ["us-east-1", "eu-west-1"]). The same query and log group names are executed in every region. |
start_time * | string | ISO 8601 start time (e.g. "2025-04-19T20:00:00+00:00"). |
account_label | Optional account identifier to annotate results with (e.g., "prod-123456789012"). Useful for cross-account queries from a monitoring account to label which source account the data came from. | |
limit | Max log events per chunk. Use this or a `| limit N` clause in the query to avoid overwhelming the agent context window. | |
max_timeout | integer | Max seconds to poll each chunk before giving up (default 120). |
profile_name | AWS CLI profile name (e.g., "prod-readonly", "default"). Falls back to AWS_PROFILE env var or default credential chain. |
recommend_indexes_loggroup
Recommend field indexes for a specific CloudWatch log group. Analyzes the last 30 days of completed Logs Insights queries (CWLI, SQL, PPL), identifies which fields would benefit most from indexing, and returns prioritized recommendations scored by: query frequency (30%), equality filter usage (25%), recency (15%), scan volume (15%), cardinality of top 10 (15%). Use recommend_indexes_account first to identify which log groups to analyze.
| Parameter | Type | Description |
|---|---|---|
log_group_identifier * | string | The CloudWatch log group name or ARN to analyze. Accepts "/aws/lambda/my-func" or the full ARN. Use ARN when querying from a monitoring account. |
profile_name | AWS CLI profile name. Falls back to AWS_PROFILE or default chain. | |
region | AWS region. Defaults to AWS_REGION or us-east-1. |
recommend_indexes_account
Triage tool: find which log groups would benefit from field indexing. Scans the last 30 days of completed Logs Insights queries across the account, groups by log group, and identifies frequently queried but unindexed fields. Lightweight scan — no per-log-group Insights queries. Use recommend_indexes_loggroup for full analysis on specific log groups.
| Parameter | Type | Description |
|---|---|---|
max_queries | integer | Maximum number of queries to analyze. Higher values give more complete results but take longer. Default 5000 completes in ~5 seconds. Set to 0 for no limit. |
profile_name | AWS CLI profile name. Falls back to AWS_PROFILE or default chain. | |
region | AWS region. Defaults to AWS_REGION or us-east-1. |
get_metric_data
Retrieves CloudWatch metric data for a specific metric. This tool retrieves metric data from CloudWatch for a specific metric identified by its namespace, metric name, and dimensions, within a specified time range. It can use either standard GetMetricData API or CloudWatch Metrics Insights for more advanced querying. The function automatically determines whether to use standard GetMetricData or Metrics Insights based on the parameters provided. If any Metrics Insights specific parameters are provided (group_by_dimension, schema_dimension_keys,…
| Parameter | Type | Description |
|---|---|---|
dimensions | array | |
end_time | The end time for the metric data query (ISO format or datetime), defaults to current time | |
group_by_dimension | Dimension name to group by in Metrics Insights mode. Must be included in schema_dimension_keys. | |
limit | Maximum number of results to return in Metrics Insights mode (used with LIMIT clause). | |
metric_name | The name of the metric. Required unless queries parameter is provided. | |
namespace | The namespace of the metric. Required unless queries parameter is provided. | |
order_by_statistic | Statistic to use in the ORDER BY clause. Required if sort_order is specified. | |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
queries | Advanced queries for percentiles, math expressions, and multi-metric batching. When provided, namespace/metric_name/dimensions/statistic parameters are ignored. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. | |
schema_dimension_keys | array | List of dimension keys to include in the SCHEMA definition for Metrics Insights query. |
sort_order | Sort order for results when using ORDER BY in Metrics Insights. Can be 'ASC', 'DESC', or None. | |
start_time | The start time for the metric data query (ISO format or datetime). Defaults to 3 hours before end_time if not provided. | |
statistic | string | The statistic to use for the metric |
target_datapoints | integer | Target number of data points to return (default: 60). Controls the granularity of the returned data. |
get_metric_metadata
Gets metadata for a CloudWatch metric including description, unit and recommended statistics that can be used for metric data retrieval. This tool retrieves comprehensive metadata about a specific CloudWatch metric identified by its namespace and metric name. Note: This function uses local metadata and does not make AWS API calls. Usage: Use this tool to get detailed information about CloudWatch metrics, including their descriptions, units, and recommended statistics to use. Args: ctx: The MCP context object for error handl…
| Parameter | Type | Description |
|---|---|---|
metric_name * | string | The name of the metric (e.g., 'CPUUtilization', 'Duration') |
namespace * | string | The namespace of the metric (e.g., 'AWS/EC2', 'AWS/Lambda') |
analyze_metric
Analyzes CloudWatch metric data to determine seasonality, trend, data density and statistical properties. This tool provides RAW DATA ONLY about historical metric data and performs analysis including: - Seasonality detection - Trend analysis - Data density and publishing period - Advanced statistical measures (min/max/median, std dev, noise) Usage: Use this tool to get objective metric analysis data. Args: ctx: The MCP context object for error handling and logging. namespace: The metric namespace (e.g., "AWS/EC2…
| Parameter | Type | Description |
|---|---|---|
metric_name * | string | The name of the metric (e.g., 'CPUUtilization', 'Duration') |
namespace * | string | The namespace of the metric (e.g., 'AWS/EC2', 'AWS/Lambda') |
dimensions | array | List of dimensions that identify the metric, each with name and value |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. | |
statistic | string | The statistic to use for the metric analysis |
get_recommended_metric_alarms
Gets recommended alarms for a CloudWatch metric. This tool retrieves alarm recommendations for a specific CloudWatch metric identified by its namespace, metric name, and dimensions. The recommendations are filtered to match the provided dimensions. Usage: Use this tool to get recommended alarm configurations for CloudWatch metrics, including thresholds, evaluation periods, and other alarm settings. Args: ctx: The MCP context object for error handling and logging. namespace: The metric namespace (e.g., "AWS/EC2", "AWS/La…
| Parameter | Type | Description |
|---|---|---|
metric_name * | string | The name of the metric (e.g., 'CPUUtilization', 'Duration') |
namespace * | string | The namespace of the metric (e.g., 'AWS/EC2', 'AWS/Lambda') |
dimensions | array | List of dimensions that identify the metric, each with name and value |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. | |
statistic | string | The statistic to use for alarm recommendations |
execute_promql_query
Execute an instant PromQL query against CloudWatch. Returns the current value of metrics at a single point in time (instant vector). For time series over a range, use execute_promql_range_query instead. Use this tool when: - The user provides a PromQL expression - The user references OTLP-ingested metrics or labels (@resource.*, @aws.*, @instrumentation.*) - The user asks about enriched vended AWS metrics with OTel labels - The user wants to query by AWS resource tags (@aws.tag.*) Use get_metric_data instead when: - The…
| Parameter | Type | Description |
|---|---|---|
query * | string | The PromQL query to execute |
profile_name | AWS CLI Profile Name. Falls back to AWS_PROFILE env or default credential chain. | |
region | AWS region. Defaults to AWS_REGION env or us-east-1. | |
time | Evaluation timestamp (RFC3339 or Unix timestamp). Defaults to current time. |
execute_promql_range_query
Execute a PromQL range query against CloudWatch. Returns time series data over a time range (matrix). Use for trend analysis and graphs. Use this tool when: - The user provides a PromQL expression and wants data over a time window - The user references OTLP-ingested metrics or labels (@resource.*, @aws.*, @instrumentation.*) - The user asks about enriched vended AWS metrics with OTel labels Use get_metric_data instead when: - The user references classic CloudWatch namespaces/dimensions (AWS/EC2, etc.) - The user wants Metrics I…
| Parameter | Type | Description |
|---|---|---|
end * | string | End timestamp (RFC3339 or Unix timestamp) |
query * | string | The PromQL query to execute |
start * | string | Start timestamp (RFC3339 or Unix timestamp) |
step * | string | Query resolution step width (e.g., '60s', '5m', '1h') |
profile_name | AWS CLI Profile Name. Falls back to AWS_PROFILE env or default credential chain. | |
region | AWS region. Defaults to AWS_REGION env or us-east-1. |
get_promql_label_values
Get values for a specific PromQL label from CloudWatch. Use label_name="__name__" to list all available metric names. Use label_name="@resource.service.name" to list all services. Use this tool when: - The user wants to discover available metrics via PromQL - The user wants to see what values exist for a label - The user is exploring OTLP-ingested or enriched vended metrics Limits: max 10,000 values returned per request. Examples: - label_name="__name__" → list all metric names - label_name="@resource.service…
| Parameter | Type | Description |
|---|---|---|
label_name * | string | Label name to get values for (e.g., "__name__" for metric names, "@resource.service.name" for services) |
end | Optional end timestamp (RFC3339 or Unix) | |
match | Optional series selectors to filter results (e.g., ['{"@instrumentation.@name"="cloudwatch.aws/ec2"}']) | |
profile_name | AWS CLI Profile Name. Falls back to AWS_PROFILE env or default credential chain. | |
region | AWS region. Defaults to AWS_REGION env or us-east-1. | |
start | Optional start timestamp (RFC3339 or Unix) |
get_promql_series
Find time series matching label selectors in CloudWatch. Returns the label sets of all series matching the provided matchers. Useful for discovering what series exist and their label structure. Use this tool when: - The user wants to explore what time series exist for a metric - The user wants to see the full label set of matching series - The user is investigating OTLP-ingested or enriched vended metrics Limits: max 10,000 series returned per request. Example: match: ['{"@instrumentation.@name"="cloudwatch.aws/ec2…
| Parameter | Type | Description |
|---|---|---|
match * | array | Series selectors to match (e.g., ['{"http.server.active_requests", "@resource.service.name"="myservice"}']) |
end | Optional end timestamp (RFC3339 or Unix) | |
profile_name | AWS CLI Profile Name. Falls back to AWS_PROFILE env or default credential chain. | |
region | AWS region. Defaults to AWS_REGION env or us-east-1. | |
start | Optional start timestamp (RFC3339 or Unix) |
get_promql_labels
Get all label names available in CloudWatch PromQL. Returns a list of all label names. Useful for discovering the label structure of OTLP-ingested metrics and enriched vended AWS metrics. Use this tool when: - The user wants to know what labels/dimensions are available - The user is exploring the label structure of their metrics Common labels include: - __name__ (metric name) - @resource.service.name, @resource.cloud.region, @resource.cloud.account.id (OTel resource attributes) - @instrumentation.@name (instrumentation…
| Parameter | Type | Description |
|---|---|---|
end | Optional end timestamp (RFC3339 or Unix) | |
match | Optional series selectors to filter which labels are returned | |
profile_name | AWS CLI Profile Name. Falls back to AWS_PROFILE env or default credential chain. | |
region | AWS region. Defaults to AWS_REGION env or us-east-1. | |
start | Optional start timestamp (RFC3339 or Unix) |
get_active_alarms
Gets all CloudWatch Alarms currently in ALARM state. This tool retrieves all CloudWatch Alarms that are currently in the ALARM state, including both metric alarms and composite alarms. Results are optimized for LLM reasoning with summary-level information. Usage: Use this tool to get an overview of all active alarms in your AWS account for troubleshooting, monitoring, and operational awareness. Args: ctx: The MCP context object for error handling and logging. max_items: Maximum number of alarms to return (default: 50).…
| Parameter | Type | Description |
|---|---|---|
max_items | Maximum number of alarms to return (default: 50). Large values may cause context window overflow and impact LLM performance. | |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. |
get_alarm_history
Gets the history for a CloudWatch alarm with time range suggestions for investigation. This tool retrieves the history for a specified CloudWatch alarm, focusing primarily on state transitions to ALARM state. It also provides suggested time ranges for investigation based on the alarm's configuration and history. Usage: Use this tool to understand when an alarm fired and get useful time ranges for investigating the underlying issue using other CloudWatch tools. The tool is particularly useful for identifying patterns like alarm flapping (going i…
| Parameter | Type | Description |
|---|---|---|
alarm_name * | string | Name of the alarm to retrieve history for |
end_time | The end time for the history query in ISO format (e.g., '2023-01-01T00:00:00Z') or as a datetime object. Defaults to current time. | |
history_item_type | Type of history items to retrieve. Possible values: 'ConfigurationUpdate', 'StateUpdate', 'Action'. Defaults to 'StateUpdate'. | |
include_component_alarms | For composite alarms, whether to include details about component alarms. Defaults to false. | |
max_items | Maximum number of history items to return (default: 50). Large values may cause context window overflow and impact LLM performance. Adjust time-range to limit responses. | |
profile_name | AWS CLI Profile Name to use for AWS access. Falls back to AWS_PROFILE environment variable if not specified, or uses default AWS credential chain. | |
region | AWS region to query. Defaults to AWS_REGION environment variable or us-east-1 if not set. | |
start_time | The start time for the history query in ISO format (e.g., '2023-01-01T00:00:00Z') or as a datetime object. Defaults to 24 hours ago. |