Skip to content

feat: add saved_list, saved_update, and saved_clear_completed tools#240

Open
jonzarecki wants to merge 3 commits intokorotovsky:masterfrom
jonzarecki:feat/saved-items
Open

feat: add saved_list, saved_update, and saved_clear_completed tools#240
jonzarecki wants to merge 3 commits intokorotovsky:masterfrom
jonzarecki:feat/saved-items

Conversation

@jonzarecki
Copy link
Copy Markdown

Summary

Three new tools for managing Slack's "Save for Later" panel:

  • saved_list — Returns saved items via Slack's saved.list API with optional message content. Supports filtering by state (saved/completed/archived), auto-pagination, and graceful fallback when message content is unavailable (e.g. channel access denied on Enterprise Grid).

  • saved_update — Updates a saved item via saved.update API: mark as completed or set a due date/reminder. Accepts item_id and ts from saved_list output.

  • saved_clear_completed — Bulk-clears all completed saved items via saved.clearCompleted API.

Motivation

Slack deprecated the stars.* APIs in March 2023 (changelog), replacing them with the "Save for Later" panel. There's currently no MCP tool to interact with saved items. This PR closes that gap — enabling workflows like reviewing saved items, marking tasks as done, and clearing completed items programmatically.

Design

All three tools require browser session tokens (xoxc/xoxd). They are not registered for OAuth (xoxp) or bot (xoxb) tokens — guarded by !IsBotToken() && !IsOAuth().

The saved_list handler includes Tier 3 rate limiting, auto-pagination, and a thread-reply fallback strategy: if a saved message can't be fetched via conversations.history (e.g. access denied), it tries conversations.replies, and ultimately falls back to a placeholder message rather than silently dropping the item.

The diff is purely additive — 648 insertions, 0 deletions. No changes to existing tools or behavior.

File Change
pkg/handler/saved.go NEW — handler with SavedListHandler, SavedUpdateHandler, SavedClearCompletedHandler
pkg/handler/saved_test.go NEW — unit tests for CSV output, field extraction, counts deserialization, nil safety
pkg/provider/edge/saved.go NEW — edge API client for saved.list, saved.update, saved.clearCompleted
pkg/provider/api.go Added 3 methods to SlackAPI interface + wrappers
pkg/server/server.go Registered all 3 tools (guarded) + 3 constants
pkg/server/server_test.go Added tool names to ValidToolNames assertions
README.md Documented all 3 tools

Token Compatibility

Token saved_list saved_update saved_clear_completed
xoxc/xoxd Tested, works Tested, works Tested, works
xoxp Not registered (guard) Not registered (guard) Not registered (guard)
xoxb Not registered (guard) Not registered (guard) Not registered (guard)

The saved.* endpoints are undocumented browser-session APIs — they reject non-xoxc tokens with not_allowed_token_type, similar to client.counts.

Status

Tested locally on Enterprise Grid workspace with xoxc/xoxd tokens. Interested in feedback on:

  1. Tool namingsaved_list / saved_update / saved_clear_completed vs alternatives
  2. Fallback strategy — the thread-reply fallback in saved_list when message fetch fails; is this the right level of resilience?
  3. Test coverage — unit tests cover CSV output, field extraction, and nil safety. Integration tests would need xoxc/xoxd tokens in CI

Made with Cursor

Add three new tools for managing Slack's "Save for Later" panel,
replacing the deprecated stars.* API (March 2023). Uses internal
saved.list, saved.update, and saved.clearCompleted endpoints.

- saved_list: List saved items with filter (saved/completed/archived),
  auto-pagination, and optional message content fetching
- saved_update: Mark items as completed and/or set due dates
- saved_clear_completed: Bulk-clear all completed items

All tools require browser session tokens (xoxc/xoxd) and are guarded
at registration time for bot/OAuth tokens.

Includes unit tests for CSV format, field extraction, timestamp
formatting, parameter validation, and response parsing.

Made-with: Cursor
When include_messages=true, items whose message content could not be
fetched (e.g. channel access denied) were silently dropped from the
output due to a `continue` that skipped the fetched counter.

Changes:
- Move fetched++ before the includeMessages block so all items count
- Let message fetch failures fall through instead of skipping the item
- Add a note to output when some items lack message content
- Fall back to metadata CSV when all message fetches fail

Fixes: 4 of 11 saved items silently dropped on enterprise Slack
Made-with: Cursor
The README had documentation for activity_unreads and activity_mark_read
which belong to the separate feat/activity-tools branch (PR korotovsky#229).
Renumber saved-items tools to 16-18.

Made-with: Cursor
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.

1 participant