Skip to content
Tools/Nodes/deduplicate_nodes

deduplicate_nodes

Find duplicate entities (same title + type) and return them grouped. `dry_run` previews; otherwise keeps one per group and redirects edges from the others.

Nodesnon-atomic. Merges are applied group-by-group; a mid-flight error leaves earlier groups merged.

Arguments

typestringoptional

Only check this entity type. Omit to check all types.

dry_runbooleanoptional

Preview duplicates without merging (default true)

keepstringoptional

Which duplicate to keep when merging: "newest" (default) or "oldest".

Returns

JSON: with dry_run: true, { duplicates, total_groups, total_duplicate_nodes, dry_run, message }.
With dry_run: false, { merged: true, groups_merged, nodes_removed, edges_redirected, strategy }.

Examples

Live call against the Notion example graph.

Output

{
  "duplicates": [
    {
      "title": "Cap AI inference cost at $0.18 / MAU / month",
      "type": "decision",
      "count": 2,
      "ids": [
        "e4078a2d-ff4f-4047-98e7-7d6556109eb0",
        "afd2234f-3c50-487d-8507-95762895c7dd"
      ]
    },
    {
      "title": "AI Q&A acceptance rate ≥ 70%",
      "type": "key_result",
      "count": 2,
      "ids": [
        "6d6991c4-36f2-46d4-bd1a-cccc87313751",
        "eee73bb6-52ac-47eb-b007-d578d17870cf"
      ]
    },
    {
      "title": "AI-native, not AI-bolted-on",
      "type": "strategic_pillar",
      "count": 2,
      "ids": [
        "620af368-90b8-4d26-8479-1359826af5e1",
        "d8665db0-5210-4354-a4ab-391ae8a843a2"
      ]
    },
    {
      "title": "Notion Calendar",
      "type": "product",
      "count": 2,
      "ids": [
        "c355f3ea-1e9f-45a1-aedc-a7adf66050e1",
        "4d5b21d6-66b1-4663-add8-2b24a10848ea"
      ]
    },
    {
      "title": "One workspace, every team",
      "type": "strategic_pillar",
      "count": 2,
      "ids": [
        "4c23a9dc-a4b3-4c80-83ee-10e35b839c26",
        "4d1b0619-b5eb-4d5d-a465-b98bc164a203"
      ]
    },
    {
      "title": "react",
      "type": "library_dependency",
      "count": 2,
      "ids": [
        "abe04949-9bc9-48e7-8ff8-8023a6c87b11",
        "4a04fd43-2451-4492-9647-c883545af3c2"
      ]
    },
    {
      "title": "AI-native vs
… (truncated)

Warnings

Default is `dry_run: true`. Pass `dry_run: false` to commit. Idempotent on retry: a second `dry_run: false` against an already-deduplicated graph reports zero merges.

See Also