Skip to content

rust(feat): make the MCP update, archive and unarchive tools bulk - #885

Merged
liam-sift merged 20 commits into
mainfrom
mcp-bulk-update-archive-tools
Nov 16, 2026
Merged

liam-sift merged 20 commits into
mainfrom
mcp-bulk-update-archive-tools

Conversation

@liam-sift

@liam-sift liam-sift commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Bulk update archive tool functionality
  • update_annotation mask, per-id writes
  • some minor not-found fixes
  • This PR should get bundled into the 0.9.0 release since it requires a minor version bump because of the interface updates

What changes for callers (breaking)

  • The 16 update, archive and unarchive tools for rules, artifacts, runs, assets, calculated
    channels, user-defined functions, reports and report templates now take an items array of 1 to
    100 objects, the same as the create tools. The old flat parameters are rejected. Pass a
    one-element list for a single resource.
  • Results report each item under successes, failures, not_attempted and not_selected.
  • Item results no longer carry their own next_step; the call-level next_step covers the batch.
    An item has a warning only when it needs attention, such as a calculated channel that will not
    evaluate on some assets. create_artifact and update_artifact items keep a one-line
    next_step, because the Sift chat host finds artifacts by matching Created artifact <id>.
  • update_annotation keeps its input shape and gains selected_indices over annotation_ids.
    Its result moves to the same per-item body, with a compact annotation_id, name, state,
    is_archived and url per success, so batch_archive_error and archive_skipped are gone. Under an approval host (sift-cli mcp --chat) it takes at most 100 ids per call.

Where to look

  • tool/common/bulk.rs holds item parsing, the selection mask, the stop rule and the result body
    for every bulk write. Most tools call self.bulk_write(op, params, resource, validate, target, write) and supply only the per-item validation and write. create_artifact, create_report,
    update_artifact and update_report use bulk_write_partial, because one item takes several
    RPCs and a failure can follow a committed change.
  • Archive and unarchive share one function per resource, keyed by Op. require_non_empty and
    exactly_one in tool/common replace the repeated id and one-of checks.
  • Tool descriptions no longer repeat the selected_indices and items bounds text; the
    BulkItems schema documents them.
  • Every item calls the existing single-item RPC. The batch RPCs are all-or-nothing, so they cannot
    report per-item results.
  • One item's failure (invalid input, not found, permission denied, conflict) does not stop the
    others. Auth, availability and rate-limit errors stop the remaining items.
  • archive_rule and unarchive_rule now read the rule first. A missing rule used to report
    success; it is now a per-item not found.

Verification

  • cargo test -p sift_mcp: 732 passed. cargo test -p sift_cli: 280 passed.
  • cargo clippy -p sift_mcp --all-targets --all-features and cargo fmt --check: clean.
  • Ran end to end through the Sift chat host on a local stack, before the shared-helper refactor in
    e60aacb:
    • Archive 10 rules with 1 deselected and 1 unknown id: 8 archived, 1 not selected, 1 not found.
    • update_annotation over 10 ids with 1 deselected: 9 updated, 1 untouched.

@liam-sift
liam-sift marked this pull request as ready for review November 13, 2026 00:43
@liam-sift
liam-sift merged commit cc419ec into main Nov 16, 2026
22 checks passed
@liam-sift
liam-sift deleted the mcp-bulk-update-archive-tools branch November 16, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants