retrieve_policy_configuration
Retrieve policy configuration details by specifying the policy name, enabling access to structured policy data for analysis and implementation.
Instructions
Retrieve and print the policy configuration for a given policy name.
Args: policy_name: The name of the policy to retrieve.
Returns: A dictionary containing the policy configuration.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy_name | Yes |
Input Schema (JSON Schema)
{
"properties": {
"policy_name": {
"title": "Policy Name",
"type": "string"
}
},
"required": [
"policy_name"
],
"title": "retrieve_policy_configurationArguments",
"type": "object"
}
Implementation Reference
- src/mcp_server.py:74-92 (handler)The handler function for the 'retrieve_policy_configuration' tool, decorated with @mcp.tool() for registration. It retrieves the policy using guardrails_client.get_policy and returns a dictionary with policy details, name, and detectors.@mcp.tool() def retrieve_policy_configuration(policy_name: str) -> Dict[str, Any]: """ Retrieve and print the policy configuration for a given policy name. Args: policy_name: The name of the policy to retrieve. Returns: A dictionary containing the policy configuration. """ policy = guardrails_client.get_policy(policy_name=policy_name) # Return policy details as a dictionary return { "policy": policy.to_dict(), "name": policy.name, "detectors": policy.detectors.to_dict() }