| 39 | * Reusable by agent hooks and background verification. |
| 40 | */ |
| 41 | export function createStructuredOutputTool(): Tool { |
| 42 | return { |
| 43 | ...SyntheticOutputTool, |
| 44 | inputSchema: hookResponseSchema(), |
| 45 | inputJSONSchema: { |
| 46 | type: 'object', |
| 47 | properties: { |
| 48 | ok: { |
| 49 | type: 'boolean', |
| 50 | description: 'Whether the condition was met', |
| 51 | }, |
| 52 | reason: { |
| 53 | type: 'string', |
| 54 | description: 'Reason, if the condition was not met', |
| 55 | }, |
| 56 | }, |
| 57 | required: ['ok'], |
| 58 | additionalProperties: false, |
| 59 | }, |
| 60 | async prompt(): Promise<string> { |
| 61 | return `Use this tool to return your verification result. You MUST call this tool exactly once at the end of your response.` |
| 62 | }, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Register a function hook that enforces structured output via SyntheticOutputTool. |