_make_tool() — langchain Function Reference
Architecture documentation for the _make_tool() function in test_return_direct_spec.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e3a12839_000f_c5f5_1ac9_6c7ccdcc57b4["_make_tool()"] c8900b43_6b5d_2599_1ca3_7e1e2f55b668["test_return_direct_spec.py"] e3a12839_000f_c5f5_1ac9_6c7ccdcc57b4 -->|defined in| c8900b43_6b5d_2599_1ca3_7e1e2f55b668 270c8d88_65c5_2f87_9bb8_56d1337ca7d2["test_return_direct_integration_matrix()"] 270c8d88_65c5_2f87_9bb8_56d1337ca7d2 -->|calls| e3a12839_000f_c5f5_1ac9_6c7ccdcc57b4 style e3a12839_000f_c5f5_1ac9_6c7ccdcc57b4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py lines 47–71
def _make_tool(*, return_direct: bool) -> dict[str, Any]:
attempts = 0
def _side_effect() -> dict[str, Any]:
nonlocal attempts
attempts += 1
return {
"status": "succeeded" if attempts >= 10 else "pending",
"attempts": attempts,
}
mock = MagicMock(side_effect=_side_effect)
@tool(
"pollJob",
description=(
"Check the status of a long-running job. "
"Returns { status: 'pending' | 'succeeded', attempts: number }."
),
return_direct=return_direct,
)
def _wrapped() -> Any:
return mock()
return {"tool": _wrapped, "mock": mock}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _make_tool() do?
_make_tool() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py.
Where is _make_tool() defined?
_make_tool() is defined in libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py at line 47.
What calls _make_tool()?
_make_tool() is called by 1 function(s): test_return_direct_integration_matrix.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free