get_redteam_task_results_summary
Retrieve a summary of red team task results to identify vulnerabilities in AI systems. Use the summary to implement tailored system prompts and guardrails for effective risk mitigation.
Instructions
Get the results summary of a redteam task.
Args: test_name: The name of the redteam test.
Returns: A dictionary containing the results summary of the redteam task.
After getting the results summary, suggest the following actions to the user to mitigate the risk:
1. Mitigate the risks by using a tailored system prompt
2. Create a guardrails policy to mitigate the risks
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| test_name | Yes |
Input Schema (JSON Schema)
{
"properties": {
"test_name": {
"title": "Test Name",
"type": "string"
}
},
"required": [
"test_name"
],
"title": "get_redteam_task_results_summaryArguments",
"type": "object"
}
Implementation Reference
- src/mcp_server.py:724-762 (handler)The core handler function for the 'get_redteam_task_results_summary' tool, decorated with @mcp.tool() for registration in the MCP server. It fetches the redteam results summary, processes test type summaries concurrently, and returns an enhanced dictionary with full summaries and mitigation info.@mcp.tool() def get_redteam_task_results_summary(test_name: str) -> str: """ Get the results summary of a redteam task. Args: test_name: The name of the redteam test. Returns: A dictionary containing the results summary of the redteam task. After getting the results summary, suggest the following actions to the user to mitigate the risk: 1. Mitigate the risks by using a tailored system prompt 2. Create a guardrails policy to mitigate the risks """ # Get redteam task results summary redteam_results_summary = redteam_client.get_result_summary(test_name=test_name) redteam_results_summary = redteam_results_summary.to_dict() test_types = redteam_results_summary["summary"]["test_type"] import concurrent.futures redteam_results_summary2 = {} def fetch_test_type_summary(test_type): redteam_results_summary_test_type = redteam_client.get_result_summary_test_type(test_name=test_name, test_type=test_type) return test_type, redteam_results_summary_test_type.to_dict() with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor: future_to_test_type = {executor.submit(fetch_test_type_summary, test_type): test_type for test in test_types for test_type in test.keys()} for future in concurrent.futures.as_completed(future_to_test_type): test_type, summary = future.result() redteam_results_summary2[f"{test_type}_full_summary"] = summary redteam_results_summary2["mitigations_possible"] = "Safer System Prompt" # Return the results summary as a dictionary return redteam_results_summary2
- src/mcp_server.py:732-738 (schema)Docstring description of the tool's output schema: a dictionary with results summary, with suggestions for next actions.Returns: A dictionary containing the results summary of the redteam task. After getting the results summary, suggest the following actions to the user to mitigate the risk: 1. Mitigate the risks by using a tailored system prompt 2. Create a guardrails policy to mitigate the risks """
- src/mcp_server.py:769-781 (schema)Detailed schema/format expected for the output of this tool when used as input to the 'harden_system_prompt' tool.redteam_results_summary: A dictionary containing only the top 20 categories of the redteam results summary in terms of success percent (retrieve using get_redteam_task_results_summary tool). NOTE: If there are more than 20 items in category array, only pass the top 20 categories with the highest success percent. Format: { "category": [ { "Bias": { "total": 6, "test_type": "adv_info_test", "success(%)": 66.67 } }, contd. ] }
- src/mcp_server.py:803-815 (schema)Detailed schema/format expected for the output of this tool when used as input to the 'mitigation_guardrails_policy' tool.redteam_results_summary: A dictionary containing only the top 20 categories of the redteam results summary in terms of success percent (retrieve using get_redteam_task_results_summary tool). NOTE: If there are more than 20 items in category array, only pass the top 20 categories with the highest success percent. Format: { "category": [ { "Bias": { "total": 6, "test_type": "adv_info_test", "success(%)": 66.67 } }, contd. ] }