Skip to main content
Glama
Brucedh

AWS‑IReveal‑MCP

config_get_resource_config_history

Retrieve configuration snapshots for AWS resources within a specified time range to track changes and audit configurations.

Instructions

Fetch configuration snapshots for a resource between two ISO timestamps.

Parameters:
  aws_region (str): The AWS region - use 'us-east-1' if not specified.
  resource_type (str): e.g. 'AWS::S3::Bucket'.
  resource_id (str): the resource's ARN or ID.
  start_time (str): ISO timestamp, e.g. '2025-04-01T00:00:00Z'.
  end_time   (str): ISO timestamp.
  limit (int): Maximum number of configuration items to return.

Returns:
  JSON list of ConfigurationItem objects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aws_regionYes
resource_typeYes
resource_idYes
start_timeYes
end_timeYes
limitNo

Implementation Reference

  • The handler function implementing the 'config_get_resource_config_history' tool. It uses the AWS Config boto3 client to fetch historical configuration snapshots for a specific resource within a time range, serializing the results as JSON.
    @mcp.tool()
    def config_get_resource_config_history(
        aws_region: str,
        resource_type: str,
        resource_id: str,
        start_time: str,
        end_time: str,
        limit: int = 10
    ) -> str:
        """
        Fetch configuration snapshots for a resource between two ISO timestamps.
    
        Parameters:
          aws_region (str): The AWS region - use 'us-east-1' if not specified.
          resource_type (str): e.g. 'AWS::S3::Bucket'.
          resource_id (str): the resource's ARN or ID.
          start_time (str): ISO timestamp, e.g. '2025-04-01T00:00:00Z'.
          end_time   (str): ISO timestamp.
          limit (int): Maximum number of configuration items to return.
    
        Returns:
          JSON list of ConfigurationItem objects.
        """
        client = boto3.client('config', region_name=aws_region)
        # Parse ISO timestamps into datetime (with UTC)
        try:
            start_dt = datetime.datetime.fromisoformat(start_time.replace('Z', '+00:00'))
            end_dt   = datetime.datetime.fromisoformat(end_time.replace('Z', '+00:00'))
        except Exception as e:
            return f"Error parsing timestamps: {e}"
    
        resp = client.get_resource_config_history(
            resourceType=resource_type,
            resourceId=resource_id,
            earlierTime=start_dt,
            laterTime=end_dt,
            limit=limit
        )
        items = resp.get("configurationItems", [])
        return json.dumps(items, indent=2, cls=DateTimeEncoder)
  • Helper class for JSON encoding datetime objects to ISO strings, used in the tool's response serialization.
    class DateTimeEncoder(json.JSONEncoder):
        def default(self, o):
            if isinstance(o, datetime.datetime):
                return o.isoformat()  # Convert datetime to ISO-format string.
            return super().default(o)
  • server.py:722-722 (registration)
    The @mcp.tool() decorator registers this function as an MCP tool, automatically inferring input schema from type hints and docstring.
    @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