update the extract tool in v2 agent
Merged
TK
9mo ago+68+68+01234567890123456789-45-45-01234567890123456789
why
update extract handling
what changed
test plan
Summary by cubic
Switch the v2 agent extract tool to accept JSON Schema and convert it to Zod internally. This removes unsafe schema string evaluation and adds format support (url, email, uuid) for clearer, safer extraction.
-
Refactors
- Replaced Function-based Zod string evaluation with JSON Schema → Zod conversion.
- Added format handling for url, email, and uuid; supports enum and arrays via items.
- Wrapped non-object schemas into an object as { result: ... } for consistent output.
- Removed logger dependency from createExtractTool and its registration.
-
Migration
- Pass schema as a JSON object (JSON Schema), not a Zod string.
- Use format: "url" for links; use enum for string lists; use items for arrays.
- If you call createExtractTool directly, remove the logger parameter.