Home / Function/ tool() — langchain Function Reference

tool() — langchain Function Reference

Architecture documentation for the tool() function in convert.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f695e142_0489_2f02_e083_1d0ce7798077["tool()"]
  1f697f5b_f8d2_0b74_7ca1_23dcfcfa02e2["convert.py"]
  f695e142_0489_2f02_e083_1d0ce7798077 -->|defined in| 1f697f5b_f8d2_0b74_7ca1_23dcfcfa02e2
  style f695e142_0489_2f02_e083_1d0ce7798077 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/convert.py lines 17–27

def tool(
    *,
    description: str | None = None,
    return_direct: bool = False,
    args_schema: ArgsSchema | None = None,
    infer_schema: bool = True,
    response_format: Literal["content", "content_and_artifact"] = "content",
    parse_docstring: bool = False,
    error_on_invalid_docstring: bool = True,
    extras: dict[str, Any] | None = None,
) -> Callable[[Callable | Runnable], BaseTool]: ...

Subdomains

Frequently Asked Questions

What does tool() do?
tool() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/convert.py.
Where is tool() defined?
tool() is defined in libs/core/langchain_core/tools/convert.py at line 17.

Analyze Your Own Codebase

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

Try Supermodel Free