Skip to main content
Glama

Sanitise text to ISO 20022 charset

sanitize_to_iso20022_charset
Read-onlyIdempotent

Transliterate accented characters and replace unsupported symbols in one text field to meet the ISO 20022 SWIFT character set, returning original, sanitized value, and change flags.

Instructions

Sanitise one free-text field to a SWIFT / ISO 20022 character set.

Use this on a single free-text value (name, remittance info) to
transliterate accents and drop unsupported symbols before placing it in
a record, and to see whether the value changed. Operates on one string;
to check a whole batch's rulebook compliance use ``validate_payment_scheme``.

Two character sets are supported via ``charset``:

* ``"SWIFT_X"`` (default, backward-compatible) - the basic set used in
  most ISO 20022 / pain.001 fields. Delegates to
  :func:`pain001.sanitize_to_charset`.
* ``"SWIFT_Z"`` - the SWIFT extended set, a strict superset of X that also
  permits ``= ! " % & * < > ; { @ # _`` (used in narrative / envelope
  fields). It does not permit ``|`` or ``}``.

In both cases accents are transliterated (``é`` -> ``e``) and any remaining
out-of-set character is replaced with a space. The result includes flags
for whether the original was already valid and whether it changed - useful
for surfacing the change to the user before writing it back to a record.

Args:
    value: The text to sanitise.
    charset: ``"SWIFT_X"`` (default) or ``"SWIFT_Z"``.

Returns:
    ``{"value": str, "sanitised": str, "was_valid": bool, "changed": bool}``.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYesA single free-text field value (e.g. a name or remittance line) to transliterate to the ISO 20022 Latin character set.
charsetNoWhich SWIFT character set to sanitise against. 'SWIFT_X' (default) is the basic set permitted in most ISO 20022 / pain.001 fields: letters, digits, space and the punctuation / - ? : ( ) . , ' + . 'SWIFT_Z' is the extended superset that additionally allows = ! " % & * < > ; { @ # _ (used in narrative / envelope fields); it does NOT allow | or }. Pick SWIFT_Z only when the target field is documented as Z-set.SWIFT_X
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds valuable behavioral context: it explains that accents are transliterated, out-of-set characters are replaced with spaces, and the result includes flags (was_valid, changed) for surfacing changes. This goes beyond the annotations by describing the transformation behavior and return flags.

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

Conciseness5/5

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

The description is well-structured and front-loaded: it starts with the core purpose, then usage context, then charset details, then behavior, then parameters and return. Every sentence earns its place, and the use of bullet points for charsets improves readability. It is detailed but not bloated.

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 moderate complexity (2 params, 1 enum, no output schema), the description is complete. It covers what the tool does, when to use it, how the charsets differ, the transformation behavior, and the return structure. An agent has everything needed to call it correctly without additional context.

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

Parameters4/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 well. The description adds value by explaining the practical implications of each charset (e.g., SWIFT_Z is a strict superset, does not permit | or }), and by clarifying the purpose of the value parameter (single free-text field). It also explains the return structure, which is not in 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 the tool's purpose: sanitize a single free-text field to a SWIFT/ISO 20022 character set, with specific actions (transliterate accents, drop unsupported symbols) and a clear resource (one string). It distinguishes itself from sibling tools like validate_payment_scheme by explicitly noting it operates on one string versus a whole batch.

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 provides explicit guidance on when to use this tool: on a single free-text value before placing it in a record, and to check if the value changed. It also names the alternative (validate_payment_scheme) for batch compliance checks, and explains the two charset options with their use cases (SWIFT_X default, SWIFT_Z for narrative/envelope fields).

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/sebastienrousseau/pain001-mcp'

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