cloudwatch_list_log_streams
List log streams in a specified AWS CloudWatch log group to monitor and analyze application logs. Retrieve structured data for troubleshooting and operational insights.
Instructions
Lists log streams in a specified CloudWatch log group.
Parameters:
aws_region (str): The AWS region - use 'us-east-1' if not specified.
log_group (str): The name of the log group.
limit (int): Maximum number of log streams to return.
Returns:
str: JSON-formatted list of log streams.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| aws_region | Yes | ||
| log_group | Yes | ||
| limit | No |
Implementation Reference
- server.py:424-424 (registration)The @mcp.tool() decorator registers the cloudwatch_list_log_streams function as an MCP tool.@mcp.tool()
- server.py:425-447 (handler)The async handler function that executes the tool logic: lists log streams in the specified CloudWatch log group using boto3.logs client and returns JSON.async def cloudwatch_list_log_streams( aws_region: str, log_group: str, limit: int = 50 ) -> str: """ Lists log streams in a specified CloudWatch log group. Parameters: aws_region (str): The AWS region - use 'us-east-1' if not specified. log_group (str): The name of the log group. limit (int): Maximum number of log streams to return. Returns: str: JSON-formatted list of log streams. """ try: cw_client = boto3.client('logs', region_name=aws_region) response = cw_client.describe_log_streams(logGroupName=log_group, limit=limit) log_streams = response.get('logStreams', []) return json.dumps(log_streams, indent=2) except Exception as e: return f"Error listing log streams: {str(e)}"