Skip to main content
Glama
CSOAI-ORG

OWASP Agentic MCP

check_data_leakage

Evaluate cross-context data exposure risks for an agent by checking context isolation, session boundaries, PII detection, output sanitization, memory sharing, logging, and third-party data sharing.

Instructions

Assess cross-context data exposure risks.

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. has_context_isolation (bool): The has context isolation to analyze or process. has_session_boundaries (bool): The has session boundaries to analyze or process. has_pii_detection (bool): The has pii detection to analyze or process. has_output_sanitization (bool): The has output sanitization to analyze or process. shares_memory_across_users (bool): The shares memory across users to analyze or process. logs_contain_user_data (bool): The logs contain user data to analyze or process. third_party_data_sharing (bool): The third party data sharing 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
has_context_isolationNo
has_session_boundariesNo
has_pii_detectionNo
has_output_sanitizationNo
shares_memory_across_usersNo
logs_contain_user_dataNo
third_party_data_sharingNo
callerNo
api_keyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:570-571 (registration)
    Tool 'check_data_leakage' is registered as an MCP tool via the @mcp.tool() decorator on line 570.
    @mcp.tool()
    def check_data_leakage(
  • Main handler function for the 'check_data_leakage' tool. It assesses cross-context data exposure risks by evaluating security controls (context isolation, session boundaries, PII detection, output sanitization) and data exposure vectors (cross-user memory, log leakage, third-party sharing). Returns a JSON risk assessment with OWASP A04 reference.
    def check_data_leakage(
        agent_name: str,
        has_context_isolation: bool = False,
        has_session_boundaries: bool = False,
        has_pii_detection: bool = False,
        has_output_sanitization: bool = False,
        shares_memory_across_users: bool = False,
        logs_contain_user_data: bool = False,
        third_party_data_sharing: bool = False,
        caller: str = "",
        api_key: str = "",
    ) -> str:
        """Assess cross-context data exposure risks.
    
        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.
            has_context_isolation (bool): The has context isolation to analyze or process.
            has_session_boundaries (bool): The has session boundaries to analyze or process.
            has_pii_detection (bool): The has pii detection to analyze or process.
            has_output_sanitization (bool): The has output sanitization to analyze or process.
            shares_memory_across_users (bool): The shares memory across users to analyze or process.
            logs_contain_user_data (bool): The logs contain user data to analyze or process.
            third_party_data_sharing (bool): The third party data sharing 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 = []
        if shares_memory_across_users:
            issues.append({"issue": "Memory shared across users (cross-tenant leakage)",
                            "severity": "CRITICAL", "cwe": "CWE-200"})
        if not has_context_isolation:
            issues.append({"issue": "No context isolation between sessions",
                            "severity": "HIGH", "cwe": "CWE-668"})
        if not has_session_boundaries:
            issues.append({"issue": "Session boundaries not enforced",
                            "severity": "HIGH", "cwe": "CWE-488"})
        if not has_pii_detection:
            issues.append({"issue": "No PII/secret detection in agent outputs",
                            "severity": "HIGH", "cwe": "CWE-532"})
        if not has_output_sanitization:
            issues.append({"issue": "Agent outputs not sanitized before delivery",
                            "severity": "MEDIUM", "cwe": "CWE-116"})
        if logs_contain_user_data:
            issues.append({"issue": "Logs contain user data (potential data exposure)",
                            "severity": "MEDIUM", "cwe": "CWE-532"})
        if third_party_data_sharing:
            issues.append({"issue": "Data shared with third parties without explicit controls",
                            "severity": "HIGH", "cwe": "CWE-359"})
    
        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,
            "controls": {
                "context_isolation": has_context_isolation,
                "session_boundaries": has_session_boundaries,
                "pii_detection": has_pii_detection,
                "output_sanitization": has_output_sanitization,
            },
            "data_exposure_vectors": {
                "cross_user_memory": shares_memory_across_users,
                "log_leakage": logs_contain_user_data,
                "third_party_sharing": third_party_data_sharing,
            },
            "issues": issues,
            "owasp_ref": "A04 - Data Leakage",
        }, indent=2)
Behavior5/5

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

With no annotations provided, the description carries full burden and delivers extensive behavioral details: read-only, stateless, idempotent, authentication requirements, rate limits, error handling, and data privacy. This fully informs the agent of the tool's behavior.

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

Conciseness4/5

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

The description is well-organized into sections (Behavior, When to use, Args, Behavioral Transparency) and front-loaded with the purpose. However, there is some redundancy between the Behavior section and the later Behavioral Transparency details, and the Args section is lengthy with low-value content.

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

Completeness5/5

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

Given the tool's complexity (10 parameters, no annotations, presence of output schema), the description covers all necessary aspects: purpose, usage guidelines, behavioral traits, parameters, and error handling. It provides sufficient information for an agent to correctly select and invoke the tool.

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

Parameters2/5

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

The Args section provides one-line descriptions for each of the 10 parameters, but these are mostly tautological (e.g., 'The agent name to analyze or process') and do not add meaningful semantics beyond the schema's titles and types. With 0% schema description coverage, the description should compensate but fails to do so effectively.

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?

The description starts with 'Assess cross-context data exposure risks', a specific verb+resource that clearly indicates the tool's function. It distinguishes from sibling tools like assess_agent_security and check_excessive_agency, 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?

The description includes explicit 'When to use' and 'When NOT to use' sections, providing clear context for invocation. It advises against real-time production use without human review, but does not directly compare with sibling tools, reducing the score from perfect.

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