Skip to main content
Glama
jstibal

Openterms-mcp

get_policy

Retrieve active guardrail policies to understand workspace constraints, including spending caps, action whitelists, and escalation rules for AI agents.

Instructions

Get the active policy (guardrails) for this workspace. Returns the rules that govern what this agent is allowed to do. An agent SHOULD call this on startup to understand its constraints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler for 'get_policy' retrieves policy information from the API and formats it into a human-readable string.
    elif name == "get_policy":
        resp = client.get("/v1/policy", headers=_headers())
        if resp.status_code == 200:
            policy = resp.json()
            if not policy.get("active") and policy.get("active") is not True:
                if policy.get("version", 0) == 0:
                    return "No active policy. All actions are allowed."
            rules = policy.get("rules", [])
            lines = [
                f"Active policy (version {policy.get('version', '?')}):",
                f"  Rules ({len(rules)}):"
            ]
            for i, rule in enumerate(rules):
                rtype = rule.get("type", "unknown")
                if rtype in ("max_amount_per_receipt", "daily_spend_cap", "max_action_context_keys"):
                    lines.append(f"    {i+1}. {rtype}: limit={rule.get('limit')}")
                elif rtype == "escalate_above_amount":
                    lines.append(f"    {i+1}. {rtype}: threshold={rule.get('threshold')}")
                elif rtype in ("allowed_action_types", "blocked_action_types"):
                    lines.append(f"    {i+1}. {rtype}: {rule.get('values')}")
                elif rtype == "required_terms_url_prefix":
                    lines.append(f"    {i+1}. {rtype}: {rule.get('prefix')}")
                else:
                    lines.append(f"    {i+1}. {rtype}: {json.dumps(rule)}")
            return "\n".join(lines)
        return _format_error(resp)
  • Registration and schema definition for the 'get_policy' tool.
    {
        "name": "get_policy",
        "description": (
            "Get the active policy (guardrails) for this workspace. "
            "Returns the rules that govern what this agent is allowed to do. "
            "An agent SHOULD call this on startup to understand its constraints."
        ),
        "inputSchema": {"type": "object", "properties": {}},
    },

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/jstibal/openterms-mcp'

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