(tool_input: dict, context: Any)
| 85 | """ |
| 86 | |
| 87 | def _call(tool_input: dict, context: Any) -> ToolResult: |
| 88 | accepted, error = collector.offer(tool_input) |
| 89 | if accepted: |
| 90 | outbox = getattr(context, "outbox", None) |
| 91 | if outbox is not None: |
| 92 | outbox.append({"tool": SYNTHETIC_OUTPUT_TOOL_NAME, "structured_output": tool_input}) |
| 93 | return ToolResult( |
| 94 | name=SYNTHETIC_OUTPUT_TOOL_NAME, |
| 95 | output={"data": "Structured output accepted.", "structured_output": tool_input}, |
| 96 | ) |
| 97 | if collector.exhausted: |
| 98 | return ToolResult( |
| 99 | name=SYNTHETIC_OUTPUT_TOOL_NAME, |
| 100 | output={"data": f"Structured output failed validation after {collector.attempts} attempts: {error}"}, |
| 101 | is_error=True, |
| 102 | ) |
| 103 | return ToolResult( |
| 104 | name=SYNTHETIC_OUTPUT_TOOL_NAME, |
| 105 | output={"data": f"Output did not match the schema: {error}. Fix the fields and call StructuredOutput again."}, |
| 106 | is_error=True, |
| 107 | ) |
| 108 | |
| 109 | from src.permissions.types import PermissionAllowDecision |
| 110 |
nothing calls this directly
no test coverage detected