Home / Function/ tool_call_schema() — langchain Function Reference

tool_call_schema() — langchain Function Reference

Architecture documentation for the tool_call_schema() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b7b0f260_6a90_b70a_e9d8_029e942e59a1["tool_call_schema()"]
  5ebe56ae_0ac8_cb13_b5a9_ee567b924009["BaseTool"]
  b7b0f260_6a90_b70a_e9d8_029e942e59a1 -->|defined in| 5ebe56ae_0ac8_cb13_b5a9_ee567b924009
  ecf72290_45d2_5efc_567a_33bf808fcd4e["get_input_schema()"]
  b7b0f260_6a90_b70a_e9d8_029e942e59a1 -->|calls| ecf72290_45d2_5efc_567a_33bf808fcd4e
  967c88a4_f24b_828c_a121_3b72c0a58b0b["get_all_basemodel_annotations()"]
  b7b0f260_6a90_b70a_e9d8_029e942e59a1 -->|calls| 967c88a4_f24b_828c_a121_3b72c0a58b0b
  5c55c769_8605_2bfb_879c_38c645ebb4f8["_is_injected_arg_type()"]
  b7b0f260_6a90_b70a_e9d8_029e942e59a1 -->|calls| 5c55c769_8605_2bfb_879c_38c645ebb4f8
  style b7b0f260_6a90_b70a_e9d8_029e942e59a1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/base.py lines 587–609

    def tool_call_schema(self) -> ArgsSchema:
        """Get the schema for tool calls, excluding injected arguments.

        Returns:
            The schema that should be used for tool calls from language models.
        """
        if isinstance(self.args_schema, dict):
            if self.description:
                return {
                    **self.args_schema,
                    "description": self.description,
                }

            return self.args_schema

        full_schema = self.get_input_schema()
        fields = []
        for name, type_ in get_all_basemodel_annotations(full_schema).items():
            if not _is_injected_arg_type(type_):
                fields.append(name)
        return _create_subset_model(
            self.name, full_schema, fields, fn_description=self.description
        )

Subdomains

Frequently Asked Questions

What does tool_call_schema() do?
tool_call_schema() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is tool_call_schema() defined?
tool_call_schema() is defined in libs/core/langchain_core/tools/base.py at line 587.
What does tool_call_schema() call?
tool_call_schema() calls 3 function(s): _is_injected_arg_type, get_all_basemodel_annotations, get_input_schema.

Analyze Your Own Codebase

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

Try Supermodel Free