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
| Name | Required | Description | Default |
|---|---|---|---|
| experiment_id | Yes | ||
| region | No | us-east-1 |
Implementation Reference
- aws_fis_mcp/tools.py:154-177 (handler)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)}"
- aws_fis_mcp/server.py:28-28 (registration)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)
- aws_fis_mcp/tools.py:34-52 (helper)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
- aws_fis_mcp/server.py:7-19 (registration)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, )