Repository navigation
Conversation
DB2VectorSearchTool lists DB2_CONNECTION_STRING in env_vars and its README documents it, but connection_string is a required field and no code reads the variable, so setting it and constructing the tool as documented raises a pydantic ValidationError. Fill connection_string from the environment in a before-validator; an explicitly passed connection_string still wins.
Strix Security Review✅ No open security findings. PR summary: `DB2VectorSearchTool` now falls back to the `DB2_CONNECTION_STRING` environment variable when `connection_string` is not passed, matching what its `env_vars` declaration and README already advertised; explicit arguments still take precedence. Review summaryThe PR adds a before-validator to Ruled out (3)
Review 1 on this PR · Reviewed by Strix |
Fixes #9759
Summary
DB2VectorSearchTooldeclaresDB2_CONNECTION_STRINGinenv_varsand documents it in its README, butconnection_stringis a required pydantic field with no default and nothing in the tool reads the environment. Following the README (export DB2_CONNECTION_STRING=...and construct the tool without the argument) therefore fails withValidationError: connection_string Field required, although the tool advertises the variable as supported.Changes
lib/crewai-tools/src/crewai_tools/tools/db2_search_tool/db2_search_tool.pymodel_validator(mode="before")that fillsconnection_stringfromDB2_CONNECTION_STRINGwhen the argument is missing or empty. An explicitly passedconnection_stringis left untouched, and a missing variable still leaves the field required.lib/crewai-tools/tests/tools/test_db2_search_tool.pyTestConnectionStringFromEnv:test_uses_env_var_when_connection_string_omittedconstructs the tool from the documented environment variable only.test_explicit_connection_string_wins_over_env_varpins precedence.Verification
pytest lib/crewai-tools/tests/tools/test_db2_search_tool.py->72 passed.db2_search_tool.py(new tests kept):test_uses_env_var_when_connection_string_omittedfails withValidationError: connection_string Field required; the explicit-argument test still passes.connection_stringis unchanged.AI assistance
I used an AI coding agent to investigate, implement, and test this change, and reviewed its results. Per CONTRIBUTING.md, please apply the
llm-generatedlabel; external contributors cannot add it with my current permissions.