Home / Function/ _handle_create() — langchain Function Reference

_handle_create() — langchain Function Reference

Architecture documentation for the _handle_create() function in anthropic_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  08a8e224_c9ef_ff31_d248_ad37bce62ba4["_handle_create()"]
  87c73dc6_9eac_4f37_3263_c6a4d3764b6e["_FilesystemClaudeFileToolMiddleware"]
  08a8e224_c9ef_ff31_d248_ad37bce62ba4 -->|defined in| 87c73dc6_9eac_4f37_3263_c6a4d3764b6e
  cccfcdcd_b72a_d23f_92ed_37c67cf37874["_handle_create()"]
  cccfcdcd_b72a_d23f_92ed_37c67cf37874 -->|calls| 08a8e224_c9ef_ff31_d248_ad37bce62ba4
  32d77b79_4a98_2de5_3e92_7514829faaa3["__init__()"]
  32d77b79_4a98_2de5_3e92_7514829faaa3 -->|calls| 08a8e224_c9ef_ff31_d248_ad37bce62ba4
  f268378f_de49_cc43_eb3b_bb6313c21433["_validate_and_resolve_path()"]
  08a8e224_c9ef_ff31_d248_ad37bce62ba4 -->|calls| f268378f_de49_cc43_eb3b_bb6313c21433
  cccfcdcd_b72a_d23f_92ed_37c67cf37874["_handle_create()"]
  08a8e224_c9ef_ff31_d248_ad37bce62ba4 -->|calls| cccfcdcd_b72a_d23f_92ed_37c67cf37874
  style 08a8e224_c9ef_ff31_d248_ad37bce62ba4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py lines 903–926

    def _handle_create(self, args: dict, tool_call_id: str | None) -> Command:
        """Handle create command."""
        path = args["path"]
        file_text = args["file_text"]

        full_path = self._validate_and_resolve_path(path)

        # Create parent directories
        full_path.parent.mkdir(parents=True, exist_ok=True)

        # Write file
        full_path.write_text(file_text + "\n")

        return Command(
            update={
                "messages": [
                    ToolMessage(
                        content=f"File created: {path}",
                        tool_call_id=tool_call_id,
                        name=self.tool_name,
                    )
                ]
            }
        )

Domain

Subdomains

Frequently Asked Questions

What does _handle_create() do?
_handle_create() is a function in the langchain codebase, defined in libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py.
Where is _handle_create() defined?
_handle_create() is defined in libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py at line 903.
What does _handle_create() call?
_handle_create() calls 2 function(s): _handle_create, _validate_and_resolve_path.
What calls _handle_create()?
_handle_create() is called by 2 function(s): __init__, _handle_create.

Analyze Your Own Codebase

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

Try Supermodel Free