# X12 Validator Tool Notes

Use these notes after loading `x12-validator/SKILL.md` when you need more detail about the `validate_x12` response or recovery path.

## Tool Contract

- Tool name: `validate_x12`
- Required parameter: `content` as raw X12 text with an ISA segment.
- Tool result: structured content and serialized JSON text containing `isValid`, `errors`, and `warnings`.

## Result Interpretation

- `isValid: true` means Neutron EDI validation did not find blocking X12 errors.
- `isValid: false` means validation completed and found document errors.
- `errors` contains segment-level problems. Use `segment`, `position`, `message`, and `errorCode` when present.
- `warnings` contains non-fatal issues that still matter for operational readiness.

## Response Discipline

When errors are present, do not summarize only "invalid." Include:

1. The affected segment.
2. The element position.
3. The human-readable message.
4. The machine-readable error code when present.
5. The next corrective action.

## Recovery Patterns

- If validation reports missing required elements, tell the user which segment and position need data.
- If validation reports envelope or count problems, advise checking SE01, GE01, IEA01, and control-number pairing.
- If validation reports unsupported content, state that the document may require a transaction set or version outside current support.
- If a partner rejection remains unexplained after validation passes, ask for the partner's 997, 824, or rejection text.

## Worked Triage Pattern

Use this answer structure for invalid documents:

```text
Validation failed.

Errors:
- BEG position 3: Purchase order number is required. Code: E001.

Next step: populate BEG03, keep the same ST/SE control number pairing, and run validation again.
```
