Skip to main content
Glama

Parse pain.002 status report file

parse_pain002
Read-onlyIdempotent

Parse a pain.002 payment-status report into structured data, extracting per-transaction accepted/rejected status and reason codes from local XML files.

Instructions

Parse a pain.002 payment-status report file on disk into structured data.

Use this to read the bank's acknowledgement of a submitted pain.001 —
the per-transaction accepted/rejected status and reason codes. Reads
``xml_file_path`` from the local filesystem. For the account statement
that later confirms booked entries, use ``parse_camt053`` instead.

Wraps :func:`pain001.parse_pain002_report`. When ``xsd_file_path`` is
provided, the document is first validated against that XSD; on a
schema or parse error the tool returns ``{"error": ...}`` rather than
raising.

Args:
    xml_file_path: Filesystem path to the pain.002 XML report.
    xsd_file_path: Optional path to a pain.002 XSD for upfront
        validation.

Returns:
    A dict with the group header and transaction statuses, or an
    ``{"error": ...}`` payload on failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xml_file_pathYesLocal filesystem path to the pain.002 payment-status report XML file to parse.
xsd_file_pathNoOptional local path to a pain.002 XSD; when given, the document is validated against it before parsing. Omit to skip schema validation.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNo
message_idNo
group_statusNo
payment_statusesNo
creation_datetimeNo
original_message_idNo
original_message_name_idNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.0.71
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "description": "A parsed pain.002 status report, as the core library reports it.",
      +  "properties": {
      +    "creation_datetime": {
      +      "title": "Creation Datetime",
      +      "type": "string"
      +    },
      +    "error": {
      +      "title": "Error",
      +      "type": "string"
      +    },
      +    "group_status": {
      +      "title": "Group Status",
      +      "type": "string"
      +    },
      +    "message_id": {
      +      "title": "Message Id",
      +      "type": "string"
      +    },
      +    "original_message_id": {
      +      "title": "Original Message Id",
      +      "type": "string"
      +    },
      +    "original_message_name_id": {
      +      "title": "Original Message Name Id",
      +      "type": "string"
      +    },
      +    "payment_statuses": {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "title": "Payment Statuses",
      +      "type": "array"
      +    }
      +  },
      +  "title": "Pain002Result",
      +  "type": "object"
      +}
  2. Changed2 schema fields changedv0.0.56
    • addedInput schema / properties / xml_file_path / description
      Added value: +"Local filesystem path to the pain.002 payment-status report XML file to parse."
    • addedInput schema / properties / xsd_file_path / description
      Added value: +"Optional local path to a pain.002 XSD; when given, the document is validated against it before parsing. Omit to skip schema validation."
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, the description discloses that the tool reads from the local filesystem, optionally validates against an XSD before parsing, and returns an {"error": ...} payload on schema or parse errors instead of raising. It also notes the wrapped function, adding useful implementation context without contradicting any annotations.

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: a clear one-sentence summary, a usage rationale, an explicit sibling alternative, technical behavior, and a compact Args/Returns section. Every sentence serves a distinct purpose, and the key differentiator is front-loaded.

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 is complete for a two-parameter parse tool with rich annotations. It covers what the tool does, when to use it, what the XSD parameter does, the error behavior, and the return shape. Nothing an agent needs to select and call this tool correctly 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 baseline is 3. The description's Args section mostly restates what the schema already documents, though it adds a small amount of contextual clarity around local filesystem access and the upfront-validation behavior. It does not meaningfully expand the semantic meaning of the parameters beyond 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 states a specific verb and resource: 'Parse a pain.002 payment-status report file on disk into structured data.' It also distinguishes itself from the sibling parse_camt053 by clarifying that this tool reads the bank's acknowledgement of a submitted pain.001, not the later account statement.

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 explicitly tells the agent when to use this tool — to read per-transaction accepted/rejected statuses and reason codes for a pain.001 — and when to use parse_camt053 instead. It also explains when to provide xsd_file_path, making the selection criteria and invocation context unambiguous.

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