Skip to main content
Glama

paytriage

결제 게이트웨이 오류를 읽고, 그 오류가 대체 무엇을 의미하는지, 다음에 무엇을 확인해야 하는지, 재시도가 안전한지 알려줍니다.

로그 줄, 오류 문자열, 또는 전체 로그 파일을 대상으로 지정하세요. 찾아봐야 하는 코드 대신 평이한 언어로 답합니다.

의존성 없음. Python 3.8 이상. CLI, 라이브러리, 그리고 에이전트가 호출할 수 있는 MCP 서버로 작동합니다.

왜

지원 및 구현 담당자들은 response_code="51"을 "고객 카드에 돈이 없었고, 이건 당신 버그가 아니다"로 바꾸는 데 많은 시간을 보냅니다. 그 변환은 사람들의 머릿속과 북마크된 PDF에 있습니다. 이 도구는 그것을 읽고, grep하고, 수정할 수 있는 파일에 넣습니다.

타임아웃 사례가 가장 중요합니다. 타임아웃은 거절이 아닙니다. 거래가 이미 상대편에서 승인되었을 수 있으므로, 무작정 재시도하면 이중 청구가 발생합니다. paytriage는 매번 그 점을 명확히 말합니다.

Related MCP server: ErrorLens MCP

설치

git clone https://github.com/Flyingmiata-droid/paytriage.git
cd paytriage
pip install -e .

또는 설치를 건너뛰고 python -m paytriage.cli로 제자리에서 실행하세요.

명령줄에서 사용

$ paytriage 'AUTH DECLINED response_code="51" insufficient funds'

  [low] Insufficient funds  (decline)
    cause: The issuer declined the authorization because the account did not have
           enough available balance or credit.
    check: Nothing to fix on the integration side. Ask the cardholder to use
           another card or retry later.
    matched response code: 51
    safe to retry: no

전체 파일을 요약:

$ paytriage -f examples/gateway.log --summary

lines: 11  matched: 9  unmatched: 2

by severity:
  low: 2
  medium: 3
  high: 2
  critical: 2

by signature:
  decline.insufficient_funds: 1
  transport.tls_handshake: 1
  format.signature_mismatch: 1
  ...

어떤 호출에든 --json을 추가하면 기계가 읽을 수 있는 출력을 얻을 수 있습니다.

라이브러리로 사용

from paytriage import triage_line

result = triage_line("SSLError: handshake failure tlsv1 alert protocol version")

result.severity          # "critical"
result.retryable         # True
result.findings[0].label # "TLS handshake failure"
result.findings[0].fix   # what to check

MCP 서버로 사용

서버는 stdio를 통해 JSON-RPC를 사용하며 triage_payment_error라는 하나의 도구를 노출하므로, 에이전트가 오류를 넘겨주면 구조화된 출력을 받을 수 있습니다.

python -m paytriage.mcp_server

Claude Desktop 또는 Claude Code 설정:

{
  "mcpServers": {
    "paytriage": {
      "command": "python",
      "args": ["-m", "paytriage.mcp_server"]
    }
  }
}

다루는 내용

여섯 가지 계열에 걸친 24개의 시그니처:

  • 거절: 잔액 부족, do not honor, 카드 만료, 카드 회수, 잘못된 번호

  • 검증: AVS 불일치, CVV 불일치

  • 전송: TLS 핸드셰이크, 인증서 만료 또는 신뢰할 수 없음, 타임아웃, 연결 거부 또는 재설정, DNS

  • API: 401, 403, 429, 5xx

  • 메시지 형식: XML 파싱, JSON 파싱, 서명 또는 HMAC 불일치, 필수 필드 누락

  • 비즈니스 규칙: 중복 거래, 지원되지 않는 통화, 잘못된 금액, 유효하지 않은 토큰

응답 코드가 있으면 그 코드로, 없으면 패턴으로 매칭합니다. 한 줄이 여러 시그니처와 일치할 수 있으며, 결과는 가장 심각한 것부터 반환됩니다.

이것은 아닙니다

  • 사기 점수 산정도, 리스크 엔진도 아닙니다.

  • 어떤 게이트웨이에도 연결되지 않습니다. 이미 가지고 있는 텍스트를 읽을 뿐이며 네트워크 호출을 하지 않습니다.

  • 완전하지 않습니다. 1차 분류 도우미입니다. 특정 코드에 대한 최종 권위는 발급사 문서입니다.

  • 결정을 내리지 않습니다. 여기 있는 어떤 것도 스스로 결제를 자동 재시도해서는 안 됩니다.

시그니처 추가

모든 것은 paytriage/signatures.py의 한 테이블에 있습니다. 시그니처는 패턴 또는 코드 집합과 원인, 해결책, 심각도로 구성됩니다. 항목을 추가하고, 테스트를 추가하고, 풀 리퀘스트를 여세요. 기존 문구에 대한 수정도 새 항목만큼 환영합니다.

테스트

python -m unittest discover -s tests -t .

23개의 테스트, 네트워크 없음, 다운로드할 픽스처 없음.

라이선스

MIT. LICENSE 참조.

Available Tools

1 tool
triage_payment_errorA

Triage a payment gateway error string or log excerpt. Returns the likely cause, what to check next, a severity, and whether a retry is safe.

NameRequiredDescriptionDefault
textYesThe error message, response body, or log excerpt.
multilineNoTreat the input as many log lines instead of one.

TDQS

A4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full transparency burden. It does disclose the core behavioral trait well by enumerating return values (cause, next steps, severity, retry safety). However, it never explicitly states the operation is non-destructive/read-only (only implied by 'triage') and says nothing about edge cases such as empty input, unrecognized formats, or whether triage is heuristic versus calling an external service.

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?

Two tight sentences with zero filler. The purpose is front-loaded first, then the return contract is enumerated. Every clause earns its place, and the length is proportionate to the tool's simplicity.

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?

Since there is no output schema, the description correctly takes on the job of explaining return content, which it does thoroughly. Both parameters are covered by the schema, and complexity is low. The only minor gap: it could note the format expectation for text (e.g., an excerpt length limit or what 'multiline' affects) to further reduce ambiguity.

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% — both 'text' and 'multiline' are fully documented with type, requirement, and a description. The tool description's 'error string or log excerpt' roughly mirrors what the schema already says, adding only marginal enrichment (framing 'text' as an excerpt) rather than genuinely new meaning. Baseline 3 is appropriate.

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 ('Triage') and resource ('payment gateway error string or log excerpt'), and enumerates exactly what it returns: likely cause, what to check next, severity, and retry safety. Though there are no siblings to distinguish from, the purpose is unambiguous and concrete.

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 domain is clearly scoped to payment gateway error strings or log excerpts, which effectively conveys when to use it. With no sibling tools, there are no alternatives to exclude, but the 'when' is implicit rather than explicitly framed — no explicit statement like 'use when a payment fails with an unknown downstream reason'.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.0
    • First observedtriage_payment_error

TDQS

A4.1/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap. The tool's purpose is clearly singular and distinct.

Naming Consistency5/5

The single tool 'triage_payment_error' follows a clear verb_noun pattern, consistent with best practices. No inconsistency exists in a one-tool set.

Tool Count3/5

The tool count is at the thin end of the spectrum (1 tool), which feels minimal for a server, but the narrow scope of payment error triage makes it borderline acceptable.

Completeness5/5

The single tool fully addresses the stated purpose of triaging payment errors, providing cause, next steps, severity, and retry safety—no obvious gaps for this focused domain.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Classifies agent errors and provides clear recovery actions (retry, escalate) with configurable categories and strategies, plus MCP tools for direct agent use.
    8 npm
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI agents to scan payment endpoints for safety, returning a letter grade (A–F) and verdict before authorizing payments.
    2
    109 npm
    MIT