Skip to main content
Glama

check_policy

Verify if actions comply with organizational policies to enforce AI agent governance and maintain compliance standards.

Instructions

Check if an action is allowed by the organization's policies.

Args:
    action_type: The action to check (e.g. "data:read:users", "api:external:call")
    agent_id: Optional agent ID to check policies for

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
action_typeYes
agent_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The check_policy tool implementation, which queries an external API to determine if an action complies with organization policies.
    @mcp.tool()
    async def check_policy(action_type: str, agent_id: str | None = None) -> str:
        """Check if an action is allowed by the organization's policies.
    
        Args:
            action_type: The action to check (e.g. "data:read:users", "api:external:call")
            agent_id: Optional agent ID to check policies for
        """
        try:
            policies = await _request("GET", "/policies")
            matching = []
            for p in policies:
                if not p.get("is_active"):
                    continue
                pattern = p.get("action_pattern", "")
                if pattern == "*" or action_type.startswith(pattern.rstrip("*")):
                    matching.append(p)
    
            if not matching:
                return f"ALLOWED: No policies match action '{action_type}'"
    
            blocked = [p for p in matching if p["action"] in ("block", "block_and_alert")]
            if blocked:
                names = ", ".join(p["name"] for p in blocked)
                return f"BLOCKED: Action '{action_type}' blocked by: {names}"
    
            alerted = [p for p in matching if p["action"] in ("alert", "block_and_alert")]
            if alerted:
                names = ", ".join(p["name"] for p in alerted)
                return f"ALLOWED with ALERT: Action '{action_type}' triggers alerts: {names}"
    
            return f"ALLOWED: Action '{action_type}' passes all policies"
        except Exception as e:
            return f"Error checking policies: {e}"

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/jagmarques/asqav-mcp'

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