Skip to main content
Glama
CSOAI-ORG

OWASP Agentic MCP

check_excessive_agency

Analyzes agent permissions against task requirements to identify excessive privileges and enforce least access.

Instructions

Assess agent for excessive permissions (least privilege).

Behavior: This tool is read-only and stateless — it produces analysis output without modifying any external systems, databases, or files. Safe to call repeatedly with identical inputs (idempotent). Free tier: 10/day rate limit. Pro tier: unlimited. No authentication required for basic usage.

When to use: Use this tool when you need structured analysis or classification of inputs against established frameworks or standards.

When NOT to use: Not suitable for real-time production decision-making without human review of results.

Args: agent_name (str): The agent name to analyze or process. tools_available (int): The tools available to analyze or process. tools_used_in_task (int): The tools used in task to analyze or process. has_approval_gates (bool): The has approval gates to analyze or process. has_scope_limits (bool): The has scope limits to analyze or process. can_access_filesystem (bool): The can access filesystem to analyze or process. can_access_network (bool): The can access network to analyze or process. can_execute_code (bool): The can execute code to analyze or process. can_modify_data (bool): The can modify data to analyze or process. can_send_communications (bool): The can send communications to analyze or process. api_key (str): The api key to analyze or process.

Behavioral Transparency: - Side Effects: This tool is read-only and produces no side effects. It does not modify any external state, databases, or files. All output is computed in-memory and returned directly to the caller. - Authentication: No authentication required for basic usage. Pro/Enterprise tiers require a valid MEOK API key passed via the MEOK_API_KEY environment variable. - Rate Limits: Free tier: 10 calls/day. Pro tier: unlimited. Rate limit headers are included in responses (X-RateLimit-Remaining, X-RateLimit-Reset). - Error Handling: Returns structured error objects with 'error' key on failure. Never raises unhandled exceptions. Invalid inputs return descriptive validation errors. - Idempotency: Fully idempotent — calling with the same inputs always produces the same output. Safe to retry on timeout or transient failure. - Data Privacy: No input data is stored, logged, or transmitted to external services. All processing happens locally within the MCP server process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_nameYes
tools_availableNo
tools_used_in_taskNo
has_approval_gatesNo
has_scope_limitsNo
can_access_filesystemNo
can_access_networkNo
can_execute_codeNo
can_modify_dataNo
can_send_communicationsNo
callerNo
api_keyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The check_excessive_agency tool handler function. Registered with @mcp.tool() decorator, it assesses an AI agent for excessive permissions (OWASP A03). Takes parameters like agent_name, tools_available, tools_used_in_task, has_approval_gates, has_scope_limits, and dangerous capabilities (filesystem, network, code execution, data modification, communications). Returns JSON with risk level, issues, and recommendations for least privilege.
    @mcp.tool()
    def check_excessive_agency(
        agent_name: str,
        tools_available: int = 0,
        tools_used_in_task: int = 0,
        has_approval_gates: bool = False,
        has_scope_limits: bool = False,
        can_access_filesystem: bool = False,
        can_access_network: bool = False,
        can_execute_code: bool = False,
        can_modify_data: bool = False,
        can_send_communications: bool = False,
        caller: str = "",
        api_key: str = "",
    ) -> str:
        """Assess agent for excessive permissions (least privilege).
    
        Behavior:
            This tool is read-only and stateless — it produces analysis output
            without modifying any external systems, databases, or files.
            Safe to call repeatedly with identical inputs (idempotent).
            Free tier: 10/day rate limit. Pro tier: unlimited.
            No authentication required for basic usage.
    
        When to use:
            Use this tool when you need structured analysis or classification
            of inputs against established frameworks or standards.
    
        When NOT to use:
            Not suitable for real-time production decision-making without
            human review of results.
    
        Args:
            agent_name (str): The agent name to analyze or process.
            tools_available (int): The tools available to analyze or process.
            tools_used_in_task (int): The tools used in task to analyze or process.
            has_approval_gates (bool): The has approval gates to analyze or process.
            has_scope_limits (bool): The has scope limits to analyze or process.
            can_access_filesystem (bool): The can access filesystem to analyze or process.
            can_access_network (bool): The can access network to analyze or process.
            can_execute_code (bool): The can execute code to analyze or process.
            can_modify_data (bool): The can modify data to analyze or process.
            can_send_communications (bool): The can send communications to analyze or process.
            api_key (str): The api key to analyze or process.
    
        Behavioral Transparency:
            - Side Effects: This tool is read-only and produces no side effects. It does not modify
              any external state, databases, or files. All output is computed in-memory and returned
              directly to the caller.
            - Authentication: No authentication required for basic usage. Pro/Enterprise tiers
              require a valid MEOK API key passed via the MEOK_API_KEY environment variable.
            - Rate Limits: Free tier: 10 calls/day. Pro tier: unlimited. Rate limit headers are
              included in responses (X-RateLimit-Remaining, X-RateLimit-Reset).
            - Error Handling: Returns structured error objects with 'error' key on failure.
              Never raises unhandled exceptions. Invalid inputs return descriptive validation errors.
            - Idempotency: Fully idempotent — calling with the same inputs always produces the
              same output. Safe to retry on timeout or transient failure.
            - Data Privacy: No input data is stored, logged, or transmitted to external services.
              All processing happens locally within the MCP server process.
        """
        if err := _check_auth(api_key):
            return err
        if err := _rl(caller):
            return err
    
        issues = []
        dangerous_caps = {
            "filesystem_access": can_access_filesystem,
            "network_access": can_access_network,
            "code_execution": can_execute_code,
            "data_modification": can_modify_data,
            "send_communications": can_send_communications,
        }
    
        active_dangerous = {k: v for k, v in dangerous_caps.items() if v}
        if len(active_dangerous) >= 3:
            issues.append({"issue": f"Agent has {len(active_dangerous)} dangerous capabilities active",
                            "severity": "CRITICAL", "capabilities": list(active_dangerous.keys())})
    
        if can_execute_code and not has_approval_gates:
            issues.append({"issue": "Code execution without approval gates", "severity": "CRITICAL"})
        if can_send_communications and not has_approval_gates:
            issues.append({"issue": "Can send communications without approval", "severity": "HIGH"})
        if not has_scope_limits:
            issues.append({"issue": "No scope limitations defined", "severity": "HIGH"})
    
        if tools_available > 0 and tools_used_in_task > 0:
            utilization = tools_used_in_task / tools_available * 100
            if utilization < 20 and tools_available > 10:
                issues.append({"issue": f"Only {tools_used_in_task}/{tools_available} tools used ({utilization:.0f}%). Over-provisioned.",
                                "severity": "MEDIUM"})
    
        risk = "LOW"
        if any(i["severity"] == "CRITICAL" for i in issues):
            risk = "CRITICAL"
        elif any(i["severity"] == "HIGH" for i in issues):
            risk = "HIGH"
        elif issues:
            risk = "MEDIUM"
    
        return json.dumps({
            "agent": agent_name,
            "risk_level": risk,
            "tools_available": tools_available,
            "tools_used": tools_used_in_task,
            "dangerous_capabilities": active_dangerous,
            "has_approval_gates": has_approval_gates,
            "has_scope_limits": has_scope_limits,
            "issues": issues,
            "owasp_ref": "A03 - Excessive Agency",
            "recommendation": "Apply least privilege: remove unused tools, add approval gates for dangerous actions."
                if risk != "LOW" else "Agent follows least privilege principles.",
        }, indent=2)
  • server.py:455-456 (registration)
    Tool registration via @mcp.tool() decorator on line 455. The FastMCP instance 'mcp' is created at line 127 in server.py.
    @mcp.tool()
    def check_excessive_agency(
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It thoroughly covers read-only, stateless, idempotent, rate limits (10/day free, unlimited pro), authentication (none required for basic), error handling (structured errors), and data privacy (no storage). All key behavioral traits disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with clear sections (Behavior, When to use, etc.), but contains redundancy (e.g., behavior info repeated in both 'Behavior' and 'Behavioral Transparency'). Could be more concise; some sentences are wordy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 12 parameters (1 required) and an output schema, the description covers behavior thoroughly and provides some parameter guidance. However, parameter descriptions are shallow and do not fully explain purpose or constraints for all fields, leaving some gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description includes an 'Args' section listing each parameter with a short description (e.g., 'The agent name to analyze or process'). These descriptions are present but mostly generic and repetitive, adding limited meaning beyond parameter names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description starts with 'Assess agent for excessive permissions (least privilege)' – a specific verb+resource that clearly states the tool's purpose. It is distinct from sibling tools like assess_agent_security or check_data_leakage, which focus on other security aspects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Includes explicit 'When to use' and 'When NOT to use' sections, providing context for appropriate invocation. However, the 'When to use' is somewhat generic ('structured analysis') and could be more specific to excessive agency assessment.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/CSOAI-ORG/owasp-agentic-mcp'

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