Question 99
A system extracts structured fields from messy documents, validates every output against JSON schemas, handles edge cases gracefully, and stays accurate enough to feed downstream systems.
Read the full scenario lessonYou are building a structured data extraction system using Claude. The system extracts information from unstructured documents, validates the output using JavaScript Object Notation (JSON) schemas, and maintains high accuracy. It must handle edge cases gracefully and integrate with downstream systems.
Your pipeline uses a tool called `extract_metadata` with a JSON schema for paper details. You've also defined `lookup_citations` and `verify_doi` tools for enrichment. During testing, you notice that when users include requests like "extract the metadata and tell me how cited it is," Claude sometimes calls `lookup_citations` first, which fails because it needs the DOI that `extract_metadata` would provide.
What's the most effective way to ensure structured metadata extraction happens first?