Home / Function/ _handle_tool() — langchain Function Reference

_handle_tool() — langchain Function Reference

Architecture documentation for the _handle_tool() function in test_dynamic_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  9764bb1c_a788_be3d_4231_84ae858344e3["_handle_tool()"]
  c310c442_3221_81bd_b756_9ed477f53ca8["MultipleDynamicToolsMiddleware"]
  9764bb1c_a788_be3d_4231_84ae858344e3 -->|defined in| c310c442_3221_81bd_b756_9ed477f53ca8
  f226e306_9a63_e254_49cc_cc9aa8840bf1["wrap_tool_call()"]
  f226e306_9a63_e254_49cc_cc9aa8840bf1 -->|calls| 9764bb1c_a788_be3d_4231_84ae858344e3
  402fb484_ccef_17bf_7538_0bdd1700e6ab["awrap_tool_call()"]
  402fb484_ccef_17bf_7538_0bdd1700e6ab -->|calls| 9764bb1c_a788_be3d_4231_84ae858344e3
  style 9764bb1c_a788_be3d_4231_84ae858344e3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_dynamic_tools.py lines 108–115

    def _handle_tool(self, request: ToolCallRequest) -> ToolCallRequest | None:
        """Return updated request if this is a dynamic tool, else None."""
        tool_name = request.tool_call["name"]
        if tool_name == "dynamic_tool":
            return request.override(tool=dynamic_tool)
        if tool_name == "another_dynamic_tool":
            return request.override(tool=another_dynamic_tool)
        return None

Domain

Subdomains

Frequently Asked Questions

What does _handle_tool() do?
_handle_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 _handle_tool() defined?
_handle_tool() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_dynamic_tools.py at line 108.
What calls _handle_tool()?
_handle_tool() is called by 2 function(s): awrap_tool_call, wrap_tool_call.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free