Skip to main content
Glama
RadiumGu
by RadiumGu

get_experiment

Retrieve detailed information about a specific AWS Fault Injection Service experiment by providing its ID, including status, configuration, and results.

Instructions

Get detailed information about a specific AWS FIS experiment.

Args:
    experiment_id: ID of the experiment to retrieve
    region: AWS region to query (default: us-east-1)
    
Returns:
    JSON string containing detailed experiment information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
experiment_idYes
regionNous-east-1

Implementation Reference

  • The core handler function implementing the 'get_experiment' MCP tool. It fetches experiment details from AWS FIS using boto3, serializes datetime objects, and returns formatted JSON.
    def get_experiment(experiment_id: str, region: str = "us-east-1") -> str:
        """
        Get detailed information about a specific AWS FIS experiment.
        
        Args:
            experiment_id: ID of the experiment to retrieve
            region: AWS region to query (default: us-east-1)
            
        Returns:
            JSON string containing detailed experiment information
        """
        try:
            fis = boto3.client('fis', region_name=region)
            response = fis.get_experiment(id=experiment_id)
            
            # Get the raw experiment data
            experiment = response.get('experiment', {})
            
            # Use the recursive datetime serializer to handle all datetime objects
            serialized_experiment = _serialize_datetime(experiment)
            
            return json.dumps(serialized_experiment, indent=2)
        except Exception as e:
            return f"Error retrieving experiment: {str(e)}"
  • Registration of the 'get_experiment' tool using FastMCP's app.tool() decorator, which registers the function as an MCP tool with the name 'get_experiment'.
    app.tool()(get_experiment)
  • Helper function used by get_experiment to recursively serialize datetime objects in the AWS response to ISO strings for proper JSON output.
    def _serialize_datetime(obj: Any) -> Any:
        """
        Recursively serialize datetime objects to ISO format strings.
        
        Args:
            obj: Object that may contain datetime objects
            
        Returns:
            Object with datetime objects converted to ISO format strings
        """
        if isinstance(obj, datetime):
            return obj.isoformat()
        elif isinstance(obj, dict):
            return {key: _serialize_datetime(value) for key, value in obj.items()}
        elif isinstance(obj, list):
            return [_serialize_datetime(item) for item in obj]
        else:
            return obj
  • Import of the get_experiment handler function from tools.py into server.py for registration as an MCP tool.
    from aws_fis_mcp.tools import (
        list_experiment_templates,
        get_experiment_template,
        list_experiments,
        get_experiment,
        start_experiment,
        stop_experiment,
        create_experiment_template,
        delete_experiment_template,
        list_action_types,
        generate_template_example,
        set_write_mode,
    )

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/RadiumGu/aws-fis-mcp-server'

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