Back to Tools FAQs
HELP CENTER · FAQTools1 min read

How should I validate structured data returned by a tool?

Treat tool output as data that may be incomplete, stale, or shaped differently than expected. Validate required fields and types before using it, and handle missing or unexpected values explicitly instead of allowing them to produce misleading updates or failures downstream.

Tools

Check the response contract

Confirm the expected schema, including optional fields, enumerated values, identifiers, and units. A field named “time” may represent seconds, milliseconds, or a formatted date; verify the contract rather than inferring from the name.

Validate at the boundary where the output enters your workflow. Reject or quarantine malformed records with enough context to investigate, while avoiding logs that expose secrets or personal data.

Use data defensively

Apply sensible bounds and consistency checks, such as verifying that a count is nonnegative or that related identifiers refer to the same object. Do not silently replace invalid values with defaults if that could change the meaning.

When a field is absent, choose a documented fallback or mark the result incomplete. Keep validation failures distinct from tool transport errors so the right issue can be corrected.

Back to Tools FAQs