Create-Collection
INPUT CONTRACT
value(required): One of:- Array of
$variables(e.g.["$note1", "$note2"]) - Array of raw resource IDs (e.g.
["Note_42", "Note_43"]) - A single
$variable(e.g."$note") - Empty array
[](creates an empty Collection)
- Array of
out(required):$variablename for resulting Collectionname(optional): Stable name for the Collection, enabling laterloadby name
REQUIREMENTS:
valuemust be provided (can be empty array)outmust be a$variable- All elements of
value(whether$variablesor raw IDs) must resolve to existing Notes
IMPORTANT: The name parameter registers a persistent name for later retrieval via load(target="my-name"). Variable names like $my_collection in out are temporary bindings during plan execution — not persistent names.
Code-block usage tip: When filtering an existing Collection in a code block, you typically end up with a list of raw Note IDs from get_items("$source_collection"). Pass that list directly as value — there is no need to round-trip each ID through a $variable. Example:
items = get_items("$titles_collection")
filtered = [tid for tid in items if not get_text(tid).startswith("[")]
tool("create-collection", value=filtered, out="$filtered_titles")
EXAMPLES
{"type": "create-collection", "value": ["$note1", "$note2"], "out": "$my_collection"}
{"type": "create-collection", "value": ["Note_42", "Note_43"], "out": "$by_id"}
{"type": "create-collection", "name": "research", "value": [], "out": "$papers"}
{"type": "create-collection", "value": "$note", "out": "$single_item"}
OUTPUT
Returns success with the created Collection's resource ID. The Collection is immediately available via the $variable bound in out.
FAILURE SEMANTICS
- Missing
valueoroutparameter - Referenced
$variablesin the array do not exist
ANTI-PATTERNS
- Confusing
name(persistent identifier) without(temporary binding) - Using
create-collectionto inspect or read existing Collections — useloadinstead