feat: add polls, deep-dive, ticket messages, and mod API key tools
CI / Build & Test (push) Successful in 17s

- New polls.ts: 13 tools covering full poll lifecycle (create/list/get/
  update/delete/vote/like/dislike/review) and poll comments
- news.ts: get_deep_dive and regenerate_deep_dive for AI analysis
- tickets.ts: create_ticket_message with internal-note and attachment support
- moderation.ts: list/update/revoke mod-managed user API keys
- user.ts: list_my_polls and list_my_poll_votes
- Bump server version to 1.2.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Space-Banane
2026-07-01 22:31:48 +02:00
parent 8083b0b8a8
commit bc42508849
7 changed files with 348 additions and 5 deletions
+31 -4
View File
@@ -12,16 +12,17 @@ Auth: `BETTERNEWS_API_KEY` env var, sent as `Authorization: Bearer` on every req
| `src/index.ts` | Entry point. Imports all register functions and calls them against `server` and `client`. |
| `src/client.ts` | `BetterNewsClient``get/post/patch/delete` wrappers with auth header and error handling. |
| `src/utils.ts` | `handleTool(fn)` — wraps a handler, catches errors, returns `{ content: [{ type:"text", text }] }`. |
| `src/tools/news.ts` | 22 news tools |
| `src/tools/news.ts` | 24 news tools |
| `src/tools/comments.ts` | 6 comment tools |
| `src/tools/sources.ts` | 7 source tools |
| `src/tools/user.ts` | 7 user/profile tools |
| `src/tools/moderation.ts` | 11 moderation tools |
| `src/tools/tickets.ts` | 5 support ticket tools |
| `src/tools/user.ts` | 9 user/profile tools |
| `src/tools/moderation.ts` | 14 moderation tools |
| `src/tools/tickets.ts` | 6 support ticket tools |
| `src/tools/blog.ts` | 7 blog tools |
| `src/tools/api-keys.ts` | 4 API key tools |
| `src/tools/sessions.ts` | 3 session tools |
| `src/tools/discussions.ts` | 13 discussion channel tools |
| `src/tools/polls.ts` | 13 poll tools |
---
@@ -55,6 +56,8 @@ Format: `tool_name` → file → `METHOD /api/route` → minimum auth
| `archive_news_item` | `POST /api/news/{id}/archive` | `news:moderate` (owner) |
| `direct_publish_news_item` | `POST /api/news/{id}/direct-publish` | `news:moderate` |
| `direct_create_publish_news_item` | `POST /api/news/direct` | `news:moderate` |
| `get_deep_dive` | `GET /api/news/{id}/deep-dive` | optional |
| `regenerate_deep_dive` | `POST /api/news/{id}/deep-dive/regenerate` | `news:moderate` Mod/Admin |
### Comments — `tools/comments.ts`
@@ -90,6 +93,8 @@ Format: `tool_name` → file → `METHOD /api/route` → minimum auth
| `list_bookmarks` | `GET /api/user/bookmarks` | `bookmarks:write` |
| `update_profile` | `PATCH /api/user/profile` | `user:profile` |
| `update_privacy_settings` | `PATCH /api/user/privacy` | `user:profile` |
| `list_my_polls` | `GET /api/user/polls` | `user:profile` |
| `list_my_poll_votes` | `GET /api/user/poll-votes` | `user:profile` |
### Moderation — `tools/moderation.ts`
@@ -106,6 +111,9 @@ Format: `tool_name` → file → `METHOD /api/route` → minimum auth
| `create_mod_user` | `POST /api/mod/users` | `mod:users` Admin |
| `list_all_tickets` | `GET /api/mod/tickets` | `mod:queue` Mod/Admin |
| `list_mod_comments` | `GET /api/mod/comments` | `mod:queue` Mod/Admin |
| `list_mod_user_api_keys` | `GET /api/mod/users/{userId}/api-keys` | `mod:users` Admin |
| `update_mod_user_api_key` | `PATCH /api/mod/users/{userId}/api-keys/{keyId}` | `mod:users` Admin |
| `revoke_mod_user_api_key` | `DELETE /api/mod/users/{userId}/api-keys/{keyId}` | `mod:users` Admin |
### Tickets — `tools/tickets.ts`
@@ -115,6 +123,7 @@ Format: `tool_name` → file → `METHOD /api/route` → minimum auth
| `get_ticket` | `GET /api/tickets/{id}` | `tickets:read` owner or Mod/Admin |
| `create_ticket` | `POST /api/tickets` | `tickets:write` |
| `reply_to_ticket` | `POST /api/tickets/{id}/reply` | `tickets:write` |
| `create_ticket_message` | `POST /api/tickets/{id}/messages` | `tickets:write` / `tickets:moderate` |
| `update_ticket_status` | `PATCH /api/tickets/{id}/status` | `tickets:moderate` Mod/Admin |
### Blog — `tools/blog.ts`
@@ -164,6 +173,24 @@ Format: `tool_name` → file → `METHOD /api/route` → minimum auth
| `list_mod_discussions` | `GET /api/mod/discussions` | Mod/Admin |
| `review_discussion` | `POST /api/mod/discussions/{id}/review` | Mod/Admin |
### Polls — `tools/polls.ts`
| Tool | Route | Auth |
| ---- | ----- | ---- |
| `list_polls` | `GET /api/polls` | optional; non-published statuses require Mod/Admin |
| `create_poll` | `POST /api/polls` | `polls:write` + email verified |
| `get_poll` | `GET /api/polls/{id}` | optional; non-published only for author or Mod/Admin |
| `update_poll` | `PATCH /api/polls/{id}` | `polls:write` (owner) or `polls:moderate` (Mod/Admin) |
| `delete_poll` | `DELETE /api/polls/{id}` | `polls:write` (owner pending_review only) or Mod/Admin |
| `vote_poll` | `POST /api/polls/{id}/vote` | `polls:write` |
| `like_poll` | `POST /api/polls/{id}/like` | `polls:write` |
| `dislike_poll` | `POST /api/polls/{id}/dislike` | `polls:write` |
| `review_poll` | `POST /api/polls/{id}/review` | `polls:moderate` Mod/Admin |
| `list_poll_comments` | `GET /api/polls/{id}/comments` | optional |
| `create_poll_comment` | `POST /api/polls/{id}/comments` | `polls:comment` + email verified |
| `hide_poll_comment` | `PATCH /api/polls/{id}/comments/{commentId}` | `polls:moderate` Mod/Admin |
| `delete_poll_comment` | `DELETE /api/polls/{id}/comments/{commentId}` | owner or `polls:comment` Mod/Admin |
---
## Adding a New Tool