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
  63459622_9e3d_3c8b_3a8d_2d55f8abb393["_handle_delete()"]
  cc57e604_ebeb_0d7e_259e_ae26b40e03fa["_StateClaudeFileToolMiddleware"]
  63459622_9e3d_3c8b_3a8d_2d55f8abb393 -->|defined in| cc57e604_ebeb_0d7e_259e_ae26b40e03fa
  e9dbd5b2_27e4_e878_3cde_25abd3acf9b7["__init__()"]
  e9dbd5b2_27e4_e878_3cde_25abd3acf9b7 -->|calls| 63459622_9e3d_3c8b_3a8d_2d55f8abb393
  7f1c464d_8675_7e1c_5edb_485ad3e24a4b["_handle_delete()"]
  7f1c464d_8675_7e1c_5edb_485ad3e24a4b -->|calls| 63459622_9e3d_3c8b_3a8d_2d55f8abb393
  7f1c464d_8675_7e1c_5edb_485ad3e24a4b["_handle_delete()"]
  63459622_9e3d_3c8b_3a8d_2d55f8abb393 -->|calls| 7f1c464d_8675_7e1c_5edb_485ad3e24a4b
  c3b02d97_e5fe_b3c4_bc92_7f2655652ed9["_validate_path()"]
  63459622_9e3d_3c8b_3a8d_2d55f8abb393 -->|calls| c3b02d97_e5fe_b3c4_bc92_7f2655652ed9
  style 63459622_9e3d_3c8b_3a8d_2d55f8abb393 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py lines 505–527

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

        normalized_path = _validate_path(path, allowed_prefixes=self.allowed_prefixes)

        return Command(
            update={
                self.state_key: {normalized_path: None},
                "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 505.
What does _handle_delete() call?
_handle_delete() calls 2 function(s): _handle_delete, _validate_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