_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 cccfcdcd_b72a_d23f_92ed_37c67cf37874["_handle_create()"] cc57e604_ebeb_0d7e_259e_ae26b40e03fa["_StateClaudeFileToolMiddleware"] cccfcdcd_b72a_d23f_92ed_37c67cf37874 -->|defined in| cc57e604_ebeb_0d7e_259e_ae26b40e03fa e9dbd5b2_27e4_e878_3cde_25abd3acf9b7["__init__()"] e9dbd5b2_27e4_e878_3cde_25abd3acf9b7 -->|calls| cccfcdcd_b72a_d23f_92ed_37c67cf37874 08a8e224_c9ef_ff31_d248_ad37bce62ba4["_handle_create()"] 08a8e224_c9ef_ff31_d248_ad37bce62ba4 -->|calls| cccfcdcd_b72a_d23f_92ed_37c67cf37874 32d77b79_4a98_2de5_3e92_7514829faaa3["__init__()"] 32d77b79_4a98_2de5_3e92_7514829faaa3 -->|calls| cccfcdcd_b72a_d23f_92ed_37c67cf37874 08a8e224_c9ef_ff31_d248_ad37bce62ba4["_handle_create()"] cccfcdcd_b72a_d23f_92ed_37c67cf37874 -->|calls| 08a8e224_c9ef_ff31_d248_ad37bce62ba4 c3b02d97_e5fe_b3c4_bc92_7f2655652ed9["_validate_path()"] cccfcdcd_b72a_d23f_92ed_37c67cf37874 -->|calls| c3b02d97_e5fe_b3c4_bc92_7f2655652ed9 style cccfcdcd_b72a_d23f_92ed_37c67cf37874 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py lines 370–406
def _handle_create(
self, args: dict, state: AnthropicToolsState, tool_call_id: str | None
) -> Command:
"""Handle create command."""
path = args["path"]
file_text = args["file_text"]
normalized_path = _validate_path(path, allowed_prefixes=self.allowed_prefixes)
# Get existing files
files = cast("dict[str, Any]", state.get(self.state_key, {}))
existing = files.get(normalized_path)
# Create file data
now = datetime.now(timezone.utc).isoformat()
created_at = existing["created_at"] if existing else now
content_lines = file_text.split("\n")
return Command(
update={
self.state_key: {
normalized_path: {
"content": content_lines,
"created_at": created_at,
"modified_at": now,
}
},
"messages": [
ToolMessage(
content=f"File created: {path}",
tool_call_id=tool_call_id,
name=self.tool_name,
)
],
}
)
Domain
Subdomains
Called By
Source
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 370.
What does _handle_create() call?
_handle_create() calls 2 function(s): _handle_create, _validate_path.
What calls _handle_create()?
_handle_create() is called by 3 function(s): __init__, __init__, _handle_create.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free