batch_import
Import datasets by bulk-creating nodes and edges from JSON arrays in a single call.
Instructions
Bulk-create nodes and edges from JSON arrays in a single call.
Use this tool when: you need to import many nodes and edges at once, e.g. loading a dataset, building a graph from structured data, or ingesting extracted entities in bulk. Do NOT use for: creating a single node or edge (use create_node / create_edge), or updating existing data (use update_node / update_edge).
Nodes are created first, then edges. Edges can reference nodes created in this batch using "@index" notation (e.g. "@0" refers to the first node in the nodes array).
Note: this operation is not atomic. If an error occurs partway through, already-created nodes/edges remain in the graph.
Args: nodes: List of node objects, each with: - labels: list of strings (required) - properties: dict of key-value pairs (optional) edges: List of edge objects, each with: - source_ref: int (existing node ID) or str ("@0", "@1", ...) referencing a node by its index in the nodes array - target_ref: int (existing node ID) or str ("@0", "@1", ...) - edge_type: str (required) - properties: dict of key-value pairs (optional)
Returns: JSON with created_nodes count, created_edges count, and a node_id_map from batch index to actual node ID.
Examples: batch_import( nodes=[ {"labels": ["Person"], "properties": {"name": "Alice"}}, {"labels": ["Person"], "properties": {"name": "Bob"}}, ], edges=[ {"source_ref": "@0", "target_ref": "@1", "edge_type": "KNOWS"}, ], )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodes | Yes | ||
| edges | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |