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

rename() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

examples/memory/basic.py lines 171–182

    def rename(self, command: BetaMemoryTool20250818RenameCommand) -> str:
        old_full_path = self._validate_path(command.old_path)
        new_full_path = self._validate_path(command.new_path)

        if not old_full_path.exists():
            raise FileNotFoundError(f"Source path not found: {command.old_path}")
        if new_full_path.exists():
            raise ValueError(f"Destination already exists: {command.new_path}")

        new_full_path.parent.mkdir(parents=True, exist_ok=True)
        old_full_path.rename(new_full_path)
        return f"Renamed {command.old_path} to {command.new_path}"

Subdomains

Frequently Asked Questions

What does rename() do?
rename() is a function in the anthropic-sdk-python codebase, defined in examples/memory/basic.py.
Where is rename() defined?
rename() is defined in examples/memory/basic.py at line 171.
What does rename() call?
rename() 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