Skip to main content
Glama

cloudwatch_describe_log_groups

Retrieve and filter CloudWatch log groups by name pattern in a specified AWS region, returning a JSON-formatted list of matching groups for efficient log management.

Instructions

Describes available CloudWatch log groups in the specified region. Parameters: aws_region (str): The AWS region - use 'us-east-1' if not specified. log_group_name_pattern (str): The pattern to filter log group names. Pattern: [\.\-_/#A-Za-z0-9]* If you specify a string for this parameter, the operation returns only log groups that have names that match the string based on a case-sensitive substring search. For example, if you specify Foo, log groups named FooBar, aws/Foo, and GroupFoo would match, but foo, F/o/o and Froo would not match. Thus, if you don't find any results with uppercase letters, try using lowercase letters. Returns: str: JSON-formatted list of log groups.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aws_regionYes
limitNo
log_group_name_patternYes

Implementation Reference

  • Handler function decorated with @mcp.tool() that implements the cloudwatch_describe_log_groups tool. It describes CloudWatch log groups matching a name pattern in the specified AWS region using the boto3 logs client and returns JSON-formatted results.
    @mcp.tool() async def cloudwatch_describe_log_groups( aws_region: str, log_group_name_pattern: str, limit: int = 50 ) -> str: """ Describes available CloudWatch log groups in the specified region. Parameters: aws_region (str): The AWS region - use 'us-east-1' if not specified. log_group_name_pattern (str): The pattern to filter log group names. Pattern: [\.\-_/#A-Za-z0-9]* If you specify a string for this parameter, the operation returns only log groups that have names that match the string based on a case-sensitive substring search. For example, if you specify Foo, log groups named FooBar, aws/Foo, and GroupFoo would match, but foo, F/o/o and Froo would not match. Thus, if you don't find any results with uppercase letters, try using lowercase letters. Returns: str: JSON-formatted list of log groups. """ try: cw_client = boto3.client('logs', region_name=aws_region) # Describe log groups (you can add pagination if necessary) response = cw_client.describe_log_groups(logGroupNamePattern=log_group_name_pattern, limit=limit) log_groups = response.get('logGroups', []) if not log_groups: return "No log groups found." return json.dumps(log_groups, indent=2) except Exception as e: return f"Error describing log groups: {str(e)}"
  • server.py:392-392 (registration)
    The @mcp.tool() decorator registers the cloudwatch_describe_log_groups function as an MCP tool.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Brucedh/aws-ireveal-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server