List all subscriptions for a user.
(user_id: int)
| 1626 | |
| 1627 | |
| 1628 | async def tool_list_subscriptions(user_id: int) -> dict: |
| 1629 | """List all subscriptions for a user.""" |
| 1630 | subs = await subscription_manager.get_user_subscriptions(user_id=user_id) |
| 1631 | |
| 1632 | if not subs: |
| 1633 | return { |
| 1634 | "success": True, |
| 1635 | "message": "📭 You don't have any active subscriptions.\n\nUse `subscribe #123` to subscribe to an issue!", |
| 1636 | } |
| 1637 | |
| 1638 | lines = ["📬 **Your Subscriptions:**\n"] |
| 1639 | for sub in subs: |
| 1640 | issue_num = sub["issue_number"] |
| 1641 | state = sub.get("last_state", "open") |
| 1642 | emoji = "🟢" if state == "open" else "🔴" |
| 1643 | lines.append(f"{emoji} **#{issue_num}** ({state})") |
| 1644 | |
| 1645 | lines.append(f"\n*{len(subs)} subscription(s) total*") |
| 1646 | return { |
| 1647 | "success": True, |
| 1648 | "message": "\n".join(lines), |
| 1649 | } |
| 1650 | |
| 1651 | |
| 1652 | # Export consolidated tool handlers |
nothing calls this directly
no test coverage detected