Home / Function/ _handle_delete() — langchain Function Reference

_handle_delete() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7f1c464d_8675_7e1c_5edb_485ad3e24a4b["_handle_delete()"]
  87c73dc6_9eac_4f37_3263_c6a4d3764b6e["_FilesystemClaudeFileToolMiddleware"]
  7f1c464d_8675_7e1c_5edb_485ad3e24a4b -->|defined in| 87c73dc6_9eac_4f37_3263_c6a4d3764b6e
  63459622_9e3d_3c8b_3a8d_2d55f8abb393["_handle_delete()"]
  63459622_9e3d_3c8b_3a8d_2d55f8abb393 -->|calls| 7f1c464d_8675_7e1c_5edb_485ad3e24a4b
  32d77b79_4a98_2de5_3e92_7514829faaa3["__init__()"]
  32d77b79_4a98_2de5_3e92_7514829faaa3 -->|calls| 7f1c464d_8675_7e1c_5edb_485ad3e24a4b
  f268378f_de49_cc43_eb3b_bb6313c21433["_validate_and_resolve_path()"]
  7f1c464d_8675_7e1c_5edb_485ad3e24a4b -->|calls| f268378f_de49_cc43_eb3b_bb6313c21433
  63459622_9e3d_3c8b_3a8d_2d55f8abb393["_handle_delete()"]
  7f1c464d_8675_7e1c_5edb_485ad3e24a4b -->|calls| 63459622_9e3d_3c8b_3a8d_2d55f8abb393
  style 7f1c464d_8675_7e1c_5edb_485ad3e24a4b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py lines 1010–1031

    def _handle_delete(self, args: dict, tool_call_id: str | None) -> Command:
        """Handle delete command."""
        path = args["path"]
        full_path = self._validate_and_resolve_path(path)

        if full_path.is_file():
            full_path.unlink()
        elif full_path.is_dir():
            shutil.rmtree(full_path)
        # If doesn't exist, silently succeed

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

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free