Skip to main content
Glama

Validate against scheme rulebook

validate_payment_scheme
Read-onlyIdempotent

Check payment records against SEPA and other scheme rulebooks to ensure business rule compliance, catching violations JSON-Schema validation misses.

Instructions

Validate records against a payment-scheme rulebook (e.g. SEPA).

Use this after ``validate_records`` to enforce scheme-specific business
rules (SEPA field lengths, allowed characters, currency/BIC constraints)
that JSON-Schema validation alone does not cover. ``validate_records``
checks structural shape; this checks rulebook compliance for one profile.

Delegates to :func:`pain001.validate_scheme`. Supported profiles:
``sepa-sct``, ``sepa-sdd``, ``sepa-inst``, ``xborder-ct``.

Args:
    records: Payment records as a list of flat dicts.
    profile: The scheme profile name.

Returns:
    ``{"profile", "is_valid", "violations": [...]}`` with structured
    ``violations`` (each with ``rule``, ``severity``, ``field``,
    ``message``, ``remediation`` keys), or ``{"error": ...}`` for an
    unknown profile.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
profileNoThe payment-scheme rulebook profile to enforce. One of 'sepa-sct', 'sepa-sdd', 'sepa-inst', or 'xborder-ct'. Defaults to 'sepa-sct'.sepa-sct
recordsYesPayment records as a list of flat dicts (field name → value) to check against the scheme rulebook.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNo
profileNo
is_validNo
violationsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.0.71
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$defs": {
      +    "SchemeViolation": {
      +      "description": "One rulebook violation, with the remediation the library suggests.",
      +      "properties": {
      +        "field": {
      +          "title": "Field",
      +          "type": "string"
      +        },
      +        "index": {
      +          "title": "Index",
      +          "type": "integer"
      +        },
      +        "message": {
      +          "title": "Message",
      +          "type": "string"
      +        },
      +        "remediation": {
      +          "title": "Remediation",
      +          "type": "string"
      +        },
      +        "rule": {
      +          "title": "Rule",
      +          "type": "string"
      +        },
      +        "severity": {
      +          "title": "Severity",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "rule",
      +        "field",
      +        "index",
      +        "message",
      +        "remediation",
      +        "severity"
      +      ],
      +      "title": "SchemeViolation",
      +      "type": "object"
      +    }
      +  },
      +  "description": "Verdict against a scheme rulebook profile.",
      +  "properties": {
      +    "error": {
      +      "title": "Error",
      +      "type": "string"
      +    },
      +    "is_valid": {
      +      "title": "Is Valid",
      +      "type": "boolean"
      +    },
      +    "profile": {
      +      "title": "Profile",
      +      "type": "string"
      +    },
      +    "violations": {
      +      "items": {
      +        "$ref": "#/$defs/SchemeViolation"
      +      },
      +      "title": "Violations",
      +      "type": "array"
      +    }
      +  },
      +  "title": "SchemeResult",
      +  "type": "object"
      +}
  2. Addedv0.0.60
  3. Removed
  4. Changed2 schema fields changedv0.0.56
    • addedInput schema / properties / profile / description
      Added value: +"The payment-scheme rulebook profile to enforce. One of 'sepa-sct', 'sepa-sdd', 'sepa-inst', or 'xborder-ct'. Defaults to 'sepa-sct'."
    • addedInput schema / properties / records / description
      Added value: +"Payment records as a list of flat dicts (field name → value) to check against the scheme rulebook."
  5. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already indicate read-only, idempotent, and non-destructive behavior. The description adds valuable context beyond that: it delegates to pain001.validate_scheme, supports four named profiles, returns structured violations with specific keys, and returns an error for unknown profiles. No contradictions with annotations.

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 and front-loaded with the purpose and usage guidance. The Args and Returns sections are scannable and informative, though the profile list is repeated in both the prose and the Args section, adding minor redundancy.

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?

The description fully equips an agent to invoke the tool: it names the alternative to use before it, specifies supported profiles, documents both parameters, and describes the exact return shape including error behavior. With only two parameters and strong annotations, nothing essential is missing.

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 100%, so the schema already documents both parameters. The description's Args section largely restates the schema, though it does add the clarifier that records are 'flat dicts' and that the tool validates 'for one profile' at a time. This is useful but not a major addition beyond an already rich 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 the specific action: validating records against a payment-scheme rulebook, with concrete examples (SEPA) and named profiles. It also distinguishes itself from the sibling validate_records by explaining that structural shape versus rulebook compliance is the difference.

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?

Explicitly says to use this tool after validate_records and explains the division of labor: JSON-Schema validation checks structure, while this enforces scheme-specific business rules. This gives an agent clear guidance on when to choose this tool over its sibling.

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