_should_add_tool() — langchain Function Reference
Architecture documentation for the _should_add_tool() function in test_dynamic_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 580b624c_f1c8_b0f3_bc1b_a923c5510c83["_should_add_tool()"] de073c97_ee50_abbe_e9db_be6c9383a57d["ConditionalDynamicToolMiddleware"] 580b624c_f1c8_b0f3_bc1b_a923c5510c83 -->|defined in| de073c97_ee50_abbe_e9db_be6c9383a57d 27e57f6e_279a_bc2d_2c0c_af66d9891168["wrap_model_call()"] 27e57f6e_279a_bc2d_2c0c_af66d9891168 -->|calls| 580b624c_f1c8_b0f3_bc1b_a923c5510c83 58e61ad0_ff9b_5db1_c2d4_c574eabfbb5a["awrap_model_call()"] 58e61ad0_ff9b_5db1_c2d4_c574eabfbb5a -->|calls| 580b624c_f1c8_b0f3_bc1b_a923c5510c83 style 580b624c_f1c8_b0f3_bc1b_a923c5510c83 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_dynamic_tools.py lines 157–159
def _should_add_tool(self, request: ModelRequest) -> bool:
messages = request.state.get("messages", [])
return messages and "calculator" in str(messages[-1].content).lower()
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _should_add_tool() do?
_should_add_tool() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_dynamic_tools.py.
Where is _should_add_tool() defined?
_should_add_tool() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_dynamic_tools.py at line 157.
What calls _should_add_tool()?
_should_add_tool() is called by 2 function(s): awrap_model_call, wrap_model_call.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free