Home / Function/ delete() — anthropic-sdk-python Function Reference

delete() — anthropic-sdk-python Function Reference

Architecture documentation for the delete() function in basic.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  9953ad4e_3ee1_dc26_47f7_ab01c3e451fc["delete()"]
  c2730250_7059_6f44_aa62_71ce88c5a804["LocalFilesystemMemoryTool"]
  9953ad4e_3ee1_dc26_47f7_ab01c3e451fc -->|defined in| c2730250_7059_6f44_aa62_71ce88c5a804
  42a84966_de9f_298e_a98d_c527baf8aa0e["_validate_path()"]
  9953ad4e_3ee1_dc26_47f7_ab01c3e451fc -->|calls| 42a84966_de9f_298e_a98d_c527baf8aa0e
  style 9953ad4e_3ee1_dc26_47f7_ab01c3e451fc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

examples/memory/basic.py lines 155–168

    def delete(self, command: BetaMemoryTool20250818DeleteCommand) -> str:
        full_path = self._validate_path(command.path)

        if command.path == "/memories":
            raise ValueError("Cannot delete the /memories directory itself")

        if full_path.is_file():
            full_path.unlink()
            return f"File deleted: {command.path}"
        elif full_path.is_dir():
            shutil.rmtree(full_path)
            return f"Directory deleted: {command.path}"
        else:
            raise FileNotFoundError(f"Path not found: {command.path}")

Subdomains

Frequently Asked Questions

What does delete() do?
delete() is a function in the anthropic-sdk-python codebase, defined in examples/memory/basic.py.
Where is delete() defined?
delete() is defined in examples/memory/basic.py at line 155.
What does delete() call?
delete() calls 1 function(s): _validate_path.

Analyze Your Own Codebase

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

Try Supermodel Free