Repository navigation
AISOS-2537: support explicit tool output when Vertex native formatting is disabled - #353
JoshSalomon wants to merge 1 commit into
Conversation
| **kwargs: Any, | ||
| ) -> Any: | ||
| del strict # LangChain's binding-wide strictness is not a per-tool opt-in. | ||
| if self.tool_output_only and any(_explicitly_strict(tool) for tool in tools): |
There was a problem hiding this comment.
[P2] Preserve strict-tool metadata through MCP loading
These checks run after _load_mcp_tools(), whose _wrap_tool_with_error_handling() reconstructs each tool as a new StructuredTool without preserving extras. Consequently, a tool declaring extras["strict"] = True (or strictness in extras["provider_tool_definition"]) reaches this binding as non-strict and is silently weakened instead of rejected in explicit tool-output mode.
The new rejection test mocks _load_mcp_tools() to return the original strict tool, so it bypasses the wrapper. I reproduced this by mocking only MultiServerMCPClient.get_tools() to return a tool with extras={"strict": True}, calling the real _load_mcp_tools(), and then binding the returned tool with tool_output_only=True: binding succeeds instead of raising the expected ValueError. All 89 targeted PR tests passed; this additional regression fails.
Please preserve provider metadata when wrapping tools, or reject strict tools before wrapping, and add coverage through the real loader.
Problem
PR #351 correctly made native-output policy and authorization failures terminal, but left no explicit non-native option for deployments that disable structured output. This scoped follow-up provides an operator-selected compatibility path without restoring broad automatic fallback.
Tracking bug: AISOS-2537 (manual fix; not an automatic Forge work item).
Changes
Other backends, unstructured calls, container agents, recursion settings, and outer workflow retries are unchanged. Native mode still fails closed on policy, authorization, schema, SDK, refusal, and truncation errors; existing confirmed-unsupported fallback remains unchanged.
Verification
All provider traffic in the new tests is mocked and uses synthetic identifiers. No raw runtime logs or cloud/account configuration are attached. No live probe, worker restart, cloud-policy change, Redis migration, or ticket retry was performed. Deployment and approved recovery remain operator actions after merge.