Skip to main content
Glama

generate_saq

Generate a PCI DSS Self-Assessment Questionnaire template for compliance assessment, gap analysis, and audit readiness.

Instructions

Generate a PCI DSS Self-Assessment Questionnaire template.

Behavior: This tool generates structured output without modifying external systems. Output is deterministic for identical inputs. No side effects. Free tier: 10/day rate limit. Pro tier: unlimited. No authentication required for basic usage.

When to use: Use this tool when you need to assess, audit, or verify compliance requirements. Ideal for gap analysis, readiness checks, and generating compliance documentation.

When NOT to use: Do not use as a substitute for qualified legal counsel. This tool provides technical compliance guidance, not legal advice.

Args: organization_name (str): The organization name to analyze or process. saq_type (str): The saq type 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
organization_nameYes
saq_typeNoD
callerNo
api_keyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the generate_saq tool. Decorated with @mcp.tool(), it takes organization_name, saq_type, caller, and api_key params. It validates auth, rate limits, looks up the SAQ type from SAQ_TYPES dict, maps applicable PCI requirements from PCI_REQUIREMENTS, and returns a JSON document with SAQ template data including requirement checks, attestation, and disclaimer.
    @mcp.tool()
    def generate_saq(
        organization_name: str,
        saq_type: str = "D",
        caller: str = "",
        api_key: str = "",
    ) -> str:
        """Generate a PCI DSS Self-Assessment Questionnaire template.
    
        Behavior:
            This tool generates structured output without modifying external systems.
            Output is deterministic for identical inputs. No side effects.
            Free tier: 10/day rate limit. Pro tier: unlimited.
            No authentication required for basic usage.
    
        When to use:
            Use this tool when you need to assess, audit, or verify compliance
            requirements. Ideal for gap analysis, readiness checks, and generating
            compliance documentation.
    
        When NOT to use:
            Do not use as a substitute for qualified legal counsel. This tool
            provides technical compliance guidance, not legal advice.
    
        Args:
            organization_name (str): The organization name to analyze or process.
            saq_type (str): The saq type 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
    
        saq_type_upper = saq_type.upper()
        if saq_type_upper not in SAQ_TYPES:
            return json.dumps({"error": f"Invalid SAQ type. Valid: {list(SAQ_TYPES.keys())}"})
    
        saq = SAQ_TYPES[saq_type_upper]
        applicable_reqs = []
        for req_id in saq["requirements"]:
            req = PCI_REQUIREMENTS[req_id]
            applicable_reqs.append({
                "requirement": req_id,
                "name": req["name"],
                "checks": req["checks"],
                "status": "NOT_ASSESSED",
            })
    
        return json.dumps({
            "document_type": f"PCI DSS SAQ {saq_type_upper}",
            "pci_dss_version": "4.0",
            "organization": organization_name,
            "generated": datetime.now().isoformat(),
            "saq_type": saq_type_upper,
            "saq_description": saq["description"],
            "applicable_requirements": applicable_reqs,
            "total_requirements": len(applicable_reqs),
            "attestation": {
                "merchant_name": organization_name,
                "date": "",
                "signature": "",
                "title": "",
            },
            "disclaimer": "TEMPLATE ONLY. Complete assessment with a Qualified Security Assessor (QSA) for validation.",
        }, indent=2)
  • server.py:516-517 (registration)
    Tool registration via @mcp.tool() decorator on the generate_saq function. Uses FastMCP framework to expose the function as an MCP tool named 'generate_saq'.
    @mcp.tool()
    def generate_saq(
  • Helper function _check_auth used by generate_saq to validate the API key against the MEOK_API_KEY environment variable.
    def _check_auth(api_key: str = "") -> str | None:
        if _MEOK_API_KEY and api_key != _MEOK_API_KEY:
            return "Invalid API key. Get one at https://meok.ai/api-keys"
        return None
  • Helper function _rl (rate limiter) used by generate_saq to enforce the free tier limit of 10 calls/day per caller.
    def _rl(caller: str = "anonymous", tier: str = "free") -> Optional[str]:
        if tier == "pro":
            return None
        now = datetime.now()
        cutoff = now - timedelta(days=1)
        _usage[caller] = [t for t in _usage[caller] if t > cutoff]
        if len(_usage[caller]) >= FREE_DAILY_LIMIT:
            return (
                f"Free tier limit ({FREE_DAILY_LIMIT}/day). "
                "Upgrade: https://meok.ai/mcp/pci-dss/pro"
            )
        _usage[caller].append(now)
        return None
  • SAQ_TYPES dictionary defining all valid SAQ types (A, A-EP, B, B-IP, C, C-VT, D, P2PE) with descriptions and required PCI requirement IDs. Used by generate_saq for validation and data lookup.
    SAQ_TYPES = {
        "A": {"description": "Card-not-present merchants, all cardholder data functions fully outsourced", "requirements": ["2", "6", "8", "9", "12"]},
        "A-EP": {"description": "E-commerce merchants with website that impacts payment security", "requirements": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]},
        "B": {"description": "Merchants using imprint machines or standalone dial-out terminals", "requirements": ["3", "4", "7", "9", "12"]},
        "B-IP": {"description": "Merchants using standalone IP-connected PTS POI terminals", "requirements": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]},
        "C": {"description": "Merchants with payment application systems connected to Internet", "requirements": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]},
        "C-VT": {"description": "Merchants using virtual terminals on isolated computers", "requirements": ["2", "3", "4", "6", "8", "9", "12"]},
        "D": {"description": "All other merchants and all service providers", "requirements": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]},
        "P2PE": {"description": "Merchants using validated P2PE solutions", "requirements": ["3", "9", "12"]},
    }
Behavior5/5

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

With no annotations provided, the description thoroughly covers behavioral traits: read-only (no side effects), authentication requirements, rate limits (10/day free), error handling, idempotency, and data privacy. All traits beyond what annotations would typically provide.

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-structured with clear sections (Behavior, When to use, Args, Behavioral Transparency) and is front-loaded with the core purpose. While slightly lengthy, each section adds value without redundancy.

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 4 parameters, no annotations, and an output schema, the description provides comprehensive coverage of behavior, limitations, and usage guidance. It could clarify the output format or template content, but the presence of an output schema mitigates this gap.

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?

Schema coverage is 0%, so description must compensate. The 'Args' section only repeats parameter names and types ('organization_name (str)') without adding meaningful constraints, examples, or descriptions of valid values. Also fails to mention the 'caller' parameter from the schema.

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 clearly states 'Generate a PCI DSS Self-Assessment Questionnaire template,' which is a specific verb and resource. It distinguishes from sibling tools like assess_pci_compliance or vulnerability_scan_check, which have different purposes.

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

Usage Guidelines5/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 when this tool is appropriate and warning against using it as legal advice. This helps the agent decide between alternatives.

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/pci-dss-mcp'

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