redditapis-mcp 0.20.5 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.22.0 (2026-11-23)
4
+
5
+ Seven new tools (registry 13417, feedback 76cd7e71 and a62b44d6) and input aliases across the catalog (feedback 85f3f21b).
6
+
7
+ - `reddit_typeahead` (`GET /api/reddit/typeahead`): search-as-you-type subreddit suggestions for a prefix, or with `sub` the posts in that subreddit whose titles match. Read rate.
8
+ - `reddit_political_ads` (`GET /api/reddit/political-ads`): Reddit's political-ad disclosures parsed into advertiser, spend band, impressions, run dates and targeting. Read rate.
9
+ - `reddit_profile_description`, `reddit_profile_display_name` and `reddit_profile_avatar` (`POST /api/reddit/profile/description`, `/display-name`, `/avatar`): change the connected account's profile through the stored session. Write rate.
10
+ - `reddit_monitor_webhook_update` (`POST /api/reddit/monitor/webhook/update`): change an email target's delivery mode, or pause and resume it. Free.
11
+ - `reddit_post_comments` also takes `url` or `post_id` (alias `id`) in place of `permalink`, as the REST route does; an existing `permalink` call is unchanged.
12
+ - More aliases beside `username`, `query` and `post_id`: `subreddit` for `name` on the `/sub/{name}` tools and for `sub` on `reddit_typeahead`, `name` for `subreddit` on `reddit_subreddit_posts` and `reddit_submit`, `comment_id` for `id` on `reddit_comment_by_id`, and `username` for `to_username` on `reddit_dm`. Each alias is moved onto the canonical name before the request and never sent; the canonical name stays the documented one.
13
+
14
+ - `reddit_session_check` asks Reddit now whether the connected session is still signed in, before a write: `valid`, the username and which writes it can make (`write_ready`). `reddit_session_status` reports only what is stored. Free; stores no cookies (a session Reddit confirms signed out is marked dead). Needs the API release that ships `POST /api/reddit/session/check`; publish only after that route is live.
15
+
16
+ ## 0.21.0 (2026-11-19)
17
+
18
+ Eight new tools for the documented REST routes (feedback a62b44d6). The live session check waits for its API route.
19
+
20
+ - `reddit_dm_threads` and `reddit_dm_messages` read the connected account's chat: conversations (paged with `limit` and `after`, with `total_threads`) and one conversation's messages (paged with `before`).
21
+ - `reddit_login` logs in with a username and password and returns the cookies `reddit_connect` stores. It takes credentials, so a host built with `inlineCredentials: false` does not list it.
22
+ - `reddit_comment_by_id`, `reddit_post_comments_expanded` (collapsed replies read in), `reddit_subreddit_can_post`, `reddit_subreddits_batch` and `reddit_users_batch` cover the remaining read routes.
23
+ - Input aliases (feedback 85f3f21b): the user tools accept `username` for `name`, every tool with a `q` input accepts `query`, and the post tools accept `post_id` for `id`. The alias is moved onto the canonical field before the call and never sent to the API; passing both with different values is an error.
24
+
3
25
  ## 0.20.5 (2026-11-19)
4
26
 
5
27
  No new tools; description updates.
package/README.md CHANGED
@@ -104,11 +104,12 @@ Authentication is a Bearer token: the server sends `Authorization: Bearer <REDDI
104
104
 
105
105
  ## Tools
106
106
 
107
- 61 tools and 3 playbook resources: 33 Reddit reads, 10 Reddit account tools (connect, status, disconnect, comment, submit, vote, DM, and schedule, list or cancel a post or comment for later), 11 monitor/webhook management tools, `reddit_set_watch` (one call that stands up a whole watch), `reddit_explain` (where the rows you are holding came from), 3 feedback tools, and 2 account tools (`reddit_account_me`, which is also where the credit balance lives, and `reddit_account_payments`, the top-up history). Reddit writes (commenting, posting, voting, DMs) act as YOUR Reddit account and only after you connect it with `reddit_connect`; each is marked as a write so your client asks before it runs. Monitor/webhook tools configure your OWN redditapis.com account (an alerting subscription), never Reddit itself, and the feedback tools send a report to the redditapis.com team, never to Reddit. Every read works with just your API key; the 6 monitor/webhook writes additionally need an active monitoring plan (see Monitoring below). The feedback tools are free and need only your key.
107
+ 76 tools and 3 playbook resources: 40 Reddit reads, 17 Reddit account tools (log in, connect, status, a live session check, disconnect, comment, submit, vote, DM, read DM threads and messages, set the profile description, display name or avatar, and schedule, list or cancel a post or comment for later), 12 monitor/webhook management tools, `reddit_set_watch` (one call that stands up a whole watch), `reddit_explain` (where the rows you are holding came from), 3 feedback tools, and 2 account tools (`reddit_account_me`, which is also where the credit balance lives, and `reddit_account_payments`, the top-up history). Reddit writes (commenting, posting, voting, DMs) act as YOUR Reddit account and only after you connect it with `reddit_connect`; each is marked as a write so your client asks before it runs. Monitor/webhook tools configure your OWN redditapis.com account (an alerting subscription), never Reddit itself, and the feedback tools send a report to the redditapis.com team, never to Reddit. Every read works with just your API key; the 6 monitor/webhook writes additionally need an active monitoring plan (see Monitoring below). The feedback tools are free and need only your key.
108
108
 
109
109
  A few conventions across the catalog:
110
110
 
111
111
  - Subreddit names go in **without** the `r/` prefix, and usernames **without** the `u/` prefix. `reddit_subreddit_posts` takes its community as `subreddit`; the `/sub/{name}/...` tools take it as `name`.
112
+ - Each input has one canonical name in the schema, and the common alternative is accepted as an alias on every tool where it means the same thing: `username` for `name` on the user tools (and for `to_username` on `reddit_dm`), `query` for `q`, `post_id` for `id` on the post tools (and `id` for `post_id` on `reddit_post_comments`), `subreddit` for `name` on the `/sub/{name}` tools (and for `sub` on `reddit_typeahead`), `name` for `subreddit` on `reddit_subreddit_posts` and `reddit_submit`, and `comment_id` for `id` on `reddit_comment_by_id`. The alias is moved onto the canonical name before the request; sending both with different values is refused.
112
113
  - Listing and search tools return an `after` cursor. Pass it back as `after` to fetch the next page, exactly as it was returned. `limit` accepts 1 to 100 (the API clamps out-of-range values).
113
114
  - When `after` comes back `null` there is no next page to ask for. That does not always mean you have every item: Reddit often stops serving a busy listing long before it runs out. The final response also carries `listing_status`, which reads `complete`, `truncated` or `unknown`. Only `complete` means nothing is missing. Treat the other two as a partial answer and widen across sorts, timeframes or search terms rather than paging deeper.
114
115
  - `t` (`hour`, `day`, `week`, `month`, `year`, `all`) sets the time window; on subreddit listings it applies to the `top` and `controversial` sorts, and on search it bounds the whole result set.
@@ -124,6 +125,8 @@ A few conventions across the catalog:
124
125
  | `reddit_search_communities` | `GET /api/reddit/search/communities` | Find subreddits by name or topic (title, subscribers, description, NSFW flag). |
125
126
  | `reddit_search_users` | `GET /api/reddit/search/users` | Find redditors by name or keyword (username, karma, account age). `include_details: true` fills `link_karma`, `comment_karma` and `created` on up to the first 10 users. |
126
127
  | `reddit_ads_search` | `GET /api/reddit/ads/search` | Search the Reddit ads library: promoted posts with advertiser, title, landing page, call to action, media, every subreddit each ad appeared in, first and last seen dates and sightings. Filter by `q`, `advertiser`, `domain`, `subreddit`, `campaign_id`, `since` and `until`. Reddit's own house ads are excluded. Newest first; page with `cursor` (the previous response's `after`). Returns `ads`, `count`, `after` and `has_more`. Billed at the read rate, the same as `reddit_search`. |
128
+ | `reddit_typeahead` | `GET /api/reddit/typeahead` | Search-as-you-type: subreddits whose names match a prefix, or with `sub` the posts in that subreddit whose titles match (default 8, max 20). No Reddit login. |
129
+ | `reddit_political_ads` | `GET /api/reddit/political-ads` | Reddit's political-ad disclosures (r/RedditPoliticalAds) parsed into advertiser, spend band, impressions, run dates and targeting; `sort` new, top or hot. |
127
130
 
128
131
  ### Subreddits
129
132
 
@@ -136,6 +139,8 @@ A few conventions across the catalog:
136
139
  | `reddit_subreddit_top` | `GET /api/reddit/sub/{name}/top` | Top posts of a subreddit for a time window (`t`). |
137
140
  | `reddit_subreddit_comments` | `GET /api/reddit/sub/{name}/comments` | Stream the newest comments across an entire subreddit (not one post's thread). |
138
141
  | `reddit_subreddit_about` | `GET /api/reddit/sub/{name}/about` | A subreddit's public metadata: title, description, subscriber and active-user counts, type, NSFW flag. |
142
+ | `reddit_subreddit_can_post` | `GET /api/reddit/sub/{name}/can-post` | Before posting: whether a post here can go through (`allowed` true, false or unknown), with a reason code per block, the posting requirements and the post rules. |
143
+ | `reddit_subreddits_batch` | `GET /api/reddit/subreddits/batch` | Up to 100 subreddits in one call by name, with the names Reddit did not return in `missing`. |
139
144
  | `reddit_subreddit_rules` | `GET /api/reddit/sub/{name}/rules` | A subreddit's posting rules plus Reddit's site-wide rules. |
140
145
  | `reddit_subreddit_moderators` | `GET /api/reddit/sub/{name}/moderators` | A subreddit's moderator team, each with permissions, flair, and when they joined. |
141
146
  | `reddit_subreddit_flairs` | `GET /api/reddit/sub/{name}/flairs` | A subreddit's post flair templates (`id`, `text`, `editable`, colours, `mod_only`), so a post can carry the `flair_id` the community requires. Reddit lists flairs only to signed-in accounts, so it reads as your connected Reddit session; with none connected it answers 503 `SESSION_REQUIRED` and is not charged. |
@@ -147,7 +152,9 @@ A few conventions across the catalog:
147
152
  |---|---|---|
148
153
  | `reddit_post_visibility` | `GET /api/reddit/post/{id}/visibility` | Is a post still publicly visible, or did it quietly stop being so? Fetches the post and one page of its author's listing and compares. Returns `live`, `not_visible` or `undecidable` with a reason, plus `removed` (boolean) and `removal_marker` (string or null). Alert on `removed`: it is true only when Reddit itself marks the post as taken down. `not_visible` from listing absence alone is `confident: false`, `removed: false`, not a removal. Beyond Reddit's marker it never claims to know WHY. Two upstream calls, $0.004. |
149
154
  | `reddit_post` | `GET /api/reddit/post/{id}` | A single post by its base-36 `id` (no `t3_` prefix): title, author, score, text, permalink, subreddit, url. |
150
- | `reddit_post_comments` | `GET /api/reddit/comments` | A post plus its full threaded comment tree, fetched by `permalink`. `format: "normalized"` returns flat comments instead of Reddit's raw tree. |
155
+ | `reddit_post_comments` | `GET /api/reddit/comments` | A post plus its full threaded comment tree, fetched by `permalink`, `url` or `post_id`. `format: "normalized"` returns flat comments instead of Reddit's raw tree. |
156
+ | `reddit_post_comments_expanded` | `GET /api/reddit/post/{id}/comments/expanded` | The comment tree with Reddit's collapsed replies ("load more comments", "continue this thread") read in and put back in place. A flat $0.02 per call. |
157
+ | `reddit_comment_by_id` | `GET /api/reddit/comment/{id}` | One comment by its id. |
151
158
  | `reddit_post_duplicates` | `GET /api/reddit/post/{id}/duplicates` | Every other post that shares this post's link, across subreddits (Reddit's "other discussions"). |
152
159
  | `reddit_by_id` | `GET /api/reddit/by_id/{fullnames}` | Bulk-hydrate up to 100 posts in one call from a comma-separated list of `t3_` fullnames. |
153
160
 
@@ -156,6 +163,7 @@ A few conventions across the catalog:
156
163
  | Tool | Endpoint | What it does |
157
164
  |---|---|---|
158
165
  | `reddit_user_profile` | `GET /api/reddit/user/{name}` | A user's public profile: karma, account age, verified/employee flags, avatar. |
166
+ | `reddit_users_batch` | `GET /api/reddit/users/batch` | Up to 100 accounts in one call by `t2_` fullname, with the ids Reddit did not return in `missing`. |
159
167
  | `reddit_user_comments` | `GET /api/reddit/user/{name}/comments` | A user's recent comments (body, score, subreddit, parent link, timestamp). |
160
168
  | `reddit_user_submitted` | `GET /api/reddit/user/{name}/submitted` | A user's submitted posts (the sibling of `reddit_user_comments`). |
161
169
  | `reddit_user_achievements` | `GET /api/reddit/user/{name}/achievements` | A user's public achievements (the trophies on their profile): name, description, granted timestamp, icons. An account with none returns an empty list. |
@@ -187,6 +195,7 @@ Monitors watch **named subreddits or all of Reddit**, for **posts or comments**
187
195
  | `reddit_monitor_webhook_list` | `GET /api/reddit/monitor/webhook/list` | List your webhooks. Never returns the secret; a Slack or Discord URL comes back masked (`url_masked: true`). |
188
196
  | `reddit_monitor_webhook_test` | `POST /api/reddit/monitor/webhook/test` | Send a one-off test delivery to confirm a webhook is wired up correctly. |
189
197
  | `reddit_monitor_webhook_redrive` | `POST /api/reddit/monitor/webhook/redrive` | Re-send a webhook's dead-lettered deliveries once the endpoint is fixed (`dry_run` lists them first). Free. |
198
+ | `reddit_monitor_webhook_update` | `POST /api/reddit/monitor/webhook/update` | Change an email target's `delivery_mode` (instant, hourly, daily or digest) or pause and resume it (`active`). Email targets only. Free. |
190
199
  | `reddit_monitor_webhook_delete` | `POST /api/reddit/monitor/webhook/delete` | Permanently delete a webhook. Does not cascade-pause monitors still pointing at it. |
191
200
 
192
201
  #### `reddit_set_watch` refuses rather than guesses
@@ -229,11 +238,18 @@ The bodies are documentation and name the calls they are recipes for, which is t
229
238
  |------|----------|--------------|
230
239
  | `reddit_connect` | `POST /api/reddit/session` | Store your Reddit session once (reddit_session and loid cookies; add csrf_token for votes and DMs). A logged-out session is refused. Free. |
231
240
  | `reddit_session_status` | `GET /api/reddit/session` | Whether a session is connected, its username, and when it was last used. Never returns the cookies. Free. |
241
+ | `reddit_session_check` | `POST /api/reddit/session/check` | Ask Reddit now whether the connected session is still signed in, before a write: `valid`, the username and which writes it can make. Stores no cookies; a session Reddit confirms signed out is marked dead. Free. |
232
242
  | `reddit_disconnect` | `POST /api/reddit/session/delete` | Delete the stored session. Free. |
243
+ | `reddit_login` | `POST /api/reddit/login` | Log in with a username and password (and TOTP secret for 2FA) to get the cookies `reddit_connect` takes. The cookies come back in the result. Not listed by a host that never takes Reddit credentials. |
233
244
  | `reddit_comment` | `POST /api/reddit/comment` | Comment on a post as you. |
234
245
  | `reddit_submit` | `POST /api/reddit/submit` | Submit a text or link post to a subreddit as you. |
235
246
  | `reddit_vote` | `POST /api/reddit/vote` | Upvote, downvote or clear a vote on a post or comment as you. |
236
247
  | `reddit_dm` | `POST /api/reddit/dm` | Send a private chat message as you. |
248
+ | `reddit_dm_threads` | `POST /api/reddit/dm/threads` | Your chat conversations, newest activity first, paged with `limit` and `after`. |
249
+ | `reddit_dm_messages` | `POST /api/reddit/dm/messages` | The messages of one conversation, paged with `before`. |
250
+ | `reddit_profile_description` | `POST /api/reddit/profile/description` | Set your profile description (up to 200 characters; empty clears it). |
251
+ | `reddit_profile_display_name` | `POST /api/reddit/profile/display-name` | Set your display name (up to 90 characters). The username does not change. |
252
+ | `reddit_profile_avatar` | `POST /api/reddit/profile/avatar` | Upload a new avatar, or a banner with `kind: "banner"`, from `image_url` or `image_base64`. |
237
253
  | `reddit_scheduled_create` | `POST /api/reddit/schedule` | Schedule a post or a comment for later (`run_at` 60 seconds to 30 days ahead). It runs as your connected session at that time. Free to schedule; billed at the write rate only when the run succeeds. |
238
254
  | `reddit_scheduled_list` | `GET /api/reddit/schedule` | Your scheduled posts and comments, newest first, with each one's `status`, `result` or `error`, and whether it was `billed`. Free. |
239
255
  | `reddit_scheduled_cancel` | `POST /api/reddit/schedule/cancel` | Cancel a scheduled post or comment that has not run yet. A cancelled action never runs and is not charged. Free. |
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "redditapis-mcp",
3
- "version": "0.20.5",
3
+ "version": "0.22.0",
4
4
  "mcpName": "io.github.redditapis/redditapis-mcp",
5
- "description": "Reddit API as 61 MCP tools for Claude, Cursor and any MCP client: search, subreddits, posts, comments, users, media, monitors with webhooks, account writes (post, comment, vote, DM) and feedback. Hosted server at api.redditapis.com/mcp.",
5
+ "description": "Reddit API as 76 MCP tools for Claude, Cursor and any MCP client: search, subreddits, posts, comments, users, media, monitors with webhooks, account writes (post, comment, vote, DM) and feedback. Hosted server at api.redditapis.com/mcp.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/redditapis/redditapis-mcp.git"
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "scripts": {
32
32
  "start": "node src/index.js",
33
- "check": "node --check src/index.js && node --check src/tools.js && node --check src/feedback.js && node --check src/server.js && node --check src/watch.js && node --check src/watch-text.js && node --check src/provenance.js && node --check src/playbooks.js && node --check src/annotations.js",
34
- "test": "node test/tools.test.mjs && node test/watch.test.mjs && node test/watch-invariants.test.mjs && node test/provenance.test.mjs && node test/playbooks.test.mjs && node test/description-compliance.test.mjs && node test/inline-credentials.test.mjs && node test/feedback.test.mjs && node test/index-lasterror.test.mjs && node test/scannable-without-key.test.mjs && node test/per-caller-state.test.mjs && node test/paywall.test.mjs && node test/remote-host.test.mjs && node test/hub-parity.test.mjs && node test/version-parity.test.mjs && node test/readme-opening.test.mjs && node test/annotations.test.mjs && node test/read-price.test.mjs && node test/flairs-schedule.test.mjs && node test/ads-search.test.mjs && node test/format-details.test.mjs && node test/server-json-limits.test.mjs",
33
+ "check": "node --check src/index.js && node --check src/tools.js && node --check src/feedback.js && node --check src/server.js && node --check src/watch.js && node --check src/watch-text.js && node --check src/provenance.js && node --check src/playbooks.js && node --check src/annotations.js && node --check src/input-aliases.js",
34
+ "test": "node test/tools.test.mjs && node test/watch.test.mjs && node test/watch-invariants.test.mjs && node test/provenance.test.mjs && node test/playbooks.test.mjs && node test/description-compliance.test.mjs && node test/inline-credentials.test.mjs && node test/feedback.test.mjs && node test/index-lasterror.test.mjs && node test/scannable-without-key.test.mjs && node test/per-caller-state.test.mjs && node test/paywall.test.mjs && node test/remote-host.test.mjs && node test/hub-parity.test.mjs && node test/version-parity.test.mjs && node test/readme-opening.test.mjs && node test/annotations.test.mjs && node test/read-price.test.mjs && node test/flairs-schedule.test.mjs && node test/ads-search.test.mjs && node test/format-details.test.mjs && node test/server-json-limits.test.mjs && node test/rest-coverage.test.mjs && node test/input-aliases.test.mjs && node test/request-shape.test.mjs",
35
35
  "prepublishOnly": "node scripts/prepublish-tenant-check.mjs",
36
36
  "postpublish": "node scripts/postpublish.mjs",
37
37
  "check:registry-drift": "node scripts/registry-drift.mjs",
@@ -43,6 +43,8 @@ export const TOOL_ANNOTATIONS = {
43
43
  reddit_search_media: { title: "Search Media Posts", ...READ_REDDIT },
44
44
  reddit_search_users: { title: "Search Users", ...READ_REDDIT },
45
45
  reddit_ads_search: { title: "Search Reddit Ads", ...READ_REDDIT },
46
+ reddit_typeahead: { title: "Typeahead Suggestions", ...READ_REDDIT },
47
+ reddit_political_ads: { title: "List Political Ad Disclosures", ...READ_REDDIT },
46
48
  reddit_subreddit_top: { title: "Top Subreddit Posts", ...READ_REDDIT },
47
49
  reddit_post: { title: "Get Post", ...READ_REDDIT },
48
50
  reddit_user_profile: { title: "Get User Profile", ...READ_REDDIT },
@@ -60,6 +62,14 @@ export const TOOL_ANNOTATIONS = {
60
62
  reddit_subreddit_flairs: { title: "List Subreddit Post Flairs", ...READ_REDDIT },
61
63
  reddit_subreddit_wiki: { title: "Subreddit Wiki Page", ...READ_REDDIT },
62
64
  reddit_by_id: { title: "Get Posts by ID", ...READ_REDDIT },
65
+ reddit_comment_by_id: { title: "Get Comment by ID", ...READ_REDDIT },
66
+ reddit_post_comments_expanded: { title: "Get Expanded Comment Tree", ...READ_REDDIT },
67
+ reddit_subreddit_can_post: { title: "Subreddit Posting Eligibility", ...READ_REDDIT },
68
+ reddit_subreddits_batch: { title: "Get Subreddits by Name", ...READ_REDDIT },
69
+ reddit_users_batch: { title: "Get Users by ID", ...READ_REDDIT },
70
+ // The connected account's own chat, read from Reddit as that account.
71
+ reddit_dm_threads: { title: "List DM Threads", ...READ_REDDIT },
72
+ reddit_dm_messages: { title: "DM Thread Messages", ...READ_REDDIT },
63
73
  reddit_subreddits_popular: { title: "List Popular Subreddits", ...READ_REDDIT },
64
74
  reddit_subreddits_new: { title: "List New Subreddits", ...READ_REDDIT },
65
75
  reddit_subreddits_default: { title: "List Default Subreddits", ...READ_REDDIT },
@@ -82,6 +92,8 @@ export const TOOL_ANNOTATIONS = {
82
92
  reddit_monitor_webhook_create: { title: "Create Webhook", readOnly: false, destructive: false, idempotent: false, openWorld: false },
83
93
  reddit_monitor_webhook_test: { title: "Send Webhook Test", readOnly: false, destructive: false, idempotent: false, openWorld: true },
84
94
  reddit_monitor_webhook_redrive: { title: "Redrive Dead Webhook Deliveries", readOnly: false, destructive: false, idempotent: false, openWorld: true },
95
+ // Changes only the fields sent on an email target (mode, paused): not destructive, idempotent, this service only.
96
+ reddit_monitor_webhook_update: { title: "Update Email Target", readOnly: false, destructive: false, idempotent: true, openWorld: false },
85
97
  reddit_monitor_webhook_delete: { title: "Delete Webhook", readOnly: false, destructive: true, idempotent: true, openWorld: false },
86
98
  reddit_feedback_send: { title: "Send Feedback Report", readOnly: false, destructive: true, idempotent: false, openWorld: false },
87
99
  reddit_set_watch: { title: "Create Watch", readOnly: false, destructive: false, idempotent: false, openWorld: true },
@@ -92,11 +104,21 @@ export const TOOL_ANNOTATIONS = {
92
104
  // credential, so both are destructive.
93
105
  reddit_connect: { title: "Connect Reddit Account", readOnly: false, destructive: true, idempotent: true, openWorld: true },
94
106
  reddit_session_status: { title: "Reddit Connection Status", ...READ_OWN },
107
+ // Asks Reddit (openWorld). Not read-only: a confirmed signed-out answer marks the stored session dead.
108
+ // Idempotent (a second call finds the same state) and not destructive (nothing the user owns is removed).
109
+ reddit_session_check: { title: "Reddit Session Validity", readOnly: false, destructive: false, idempotent: true, openWorld: true },
110
+ // A real login at Reddit: not idempotent (each call is a new login), not destructive.
111
+ reddit_login: { title: "Reddit Account Login", readOnly: false, destructive: false, idempotent: false, openWorld: true },
95
112
  reddit_disconnect: { title: "Disconnect Reddit Account", readOnly: false, destructive: true, idempotent: true, openWorld: false },
96
113
  reddit_comment: { title: "Post Comment", readOnly: false, destructive: false, idempotent: false, openWorld: true },
97
114
  reddit_submit: { title: "Submit Post", readOnly: false, destructive: false, idempotent: false, openWorld: true },
98
115
  reddit_vote: { title: "Vote", readOnly: false, destructive: false, idempotent: true, openWorld: true },
99
116
  reddit_dm: { title: "Send Direct Message", readOnly: false, destructive: false, idempotent: false, openWorld: true },
117
+ // Profile writes replace the current value (destructive: Reddit keeps no history). Setting the same text twice
118
+ // changes nothing more (idempotent); each avatar call is a new upload (not idempotent).
119
+ reddit_profile_description: { title: "Profile Description Update", readOnly: false, destructive: true, idempotent: true, openWorld: true },
120
+ reddit_profile_display_name: { title: "Profile Display Name Update", readOnly: false, destructive: true, idempotent: true, openWorld: true },
121
+ reddit_profile_avatar: { title: "Profile Avatar Upload", readOnly: false, destructive: true, idempotent: false, openWorld: true },
100
122
 
101
123
  // Scheduled posts and comments. create is openWorld: the call itself only stores the action,
102
124
  // but its effect is a post or comment on Reddit at run_at, so a client weighs it like submit.
@@ -0,0 +1,79 @@
1
+ // Input-name aliases (feedback 85f3f21b, 2026-11-19).
2
+ //
3
+ // The tools take one canonical name per input: `name` for a user (and a
4
+ // subreddit), `q` for a search query, `id` for a post. Callers reasonably send
5
+ // `username`, `query` or `post_id` instead, and a strict schema refused those
6
+ // calls with a validation error naming a field the caller never used. Each
7
+ // alias below is accepted on exactly the tools where it means the canonical
8
+ // input, is moved onto the canonical name before the request is built, and is
9
+ // never sent to the API. The canonical name stays the documented one.
10
+ //
11
+ // Sending both with different values is refused (it is ambiguous); sending
12
+ // neither for a required input is refused with both names in the message,
13
+ // because the canonical input becomes optional in the published schema so the
14
+ // alias alone can satisfy it.
15
+
16
+ // alias -> canonical, and where the alias applies. 0.22.0 widened the set to the rest of the catalog: a subreddit
17
+ // is `name` on the /sub/{name} tools and `subreddit` elsewhere, so each accepts the other; a comment id, a post id on
18
+ // the comment-tree tool, a DM recipient and the typeahead's subreddit take the name callers send for them.
19
+ const pathHas = (tool, part) => typeof tool.path === "string" && tool.path.includes(part);
20
+ const shapeHas = (tool, key) => Boolean(tool.shape && tool.shape[key]);
21
+ // zod 3 names the kind in _def.typeName ("ZodArray"), zod 4 in _def.type ("array"); the package accepts both.
22
+ export const isArraySchema = (s) => Boolean(s && s._def && (s._def.typeName === "ZodArray" || s._def.type === "array"));
23
+ export const INPUT_ALIASES = [
24
+ { alias: "username", canonical: "name", applies: (tool) => pathHas(tool, "/user/{name}") },
25
+ { alias: "query", canonical: "q", applies: (tool) => shapeHas(tool, "q") },
26
+ { alias: "post_id", canonical: "id", applies: (tool) => pathHas(tool, "/post/{id}") },
27
+ { alias: "subreddit", canonical: "name", applies: (tool) => pathHas(tool, "/sub/{name}") },
28
+ // Only where `subreddit` is the one required subreddit (a listing or a submit), never an optional search filter.
29
+ { alias: "name", canonical: "subreddit", applies: (tool) => shapeHas(tool, "subreddit") && !tool.shape.subreddit.isOptional() && !isArraySchema(tool.shape.subreddit) },
30
+ { alias: "comment_id", canonical: "id", applies: (tool) => pathHas(tool, "/comment/{id}") },
31
+ { alias: "id", canonical: "post_id", applies: (tool) => shapeHas(tool, "post_id") },
32
+ { alias: "username", canonical: "to_username", applies: (tool) => shapeHas(tool, "to_username") },
33
+ { alias: "subreddit", canonical: "sub", applies: (tool) => shapeHas(tool, "sub") },
34
+ ];
35
+
36
+ /** The aliases one tool accepts: [{ alias, canonical, required }]. */
37
+ export function aliasesFor(tool) {
38
+ const shape = (tool && tool.shape) || {};
39
+ return INPUT_ALIASES.filter((a) => shape[a.canonical] && !shape[a.alias] && a.applies(tool)).map((a) => ({
40
+ alias: a.alias,
41
+ canonical: a.canonical,
42
+ required: !shape[a.canonical].isOptional(),
43
+ }));
44
+ }
45
+
46
+ /** The schema to publish: the tool's own, plus each alias (same type), with an aliased canonical input made optional. */
47
+ export function aliasedShape(tool) {
48
+ const list = aliasesFor(tool);
49
+ if (!list.length) return tool.shape;
50
+ const shape = { ...tool.shape };
51
+ for (const { alias, canonical, required } of list) {
52
+ const base = tool.shape[canonical];
53
+ if (required) shape[canonical] = base.optional().describe(`${base.description || ""} Required: send \`${canonical}\` or its alias \`${alias}\`.`.trim());
54
+ shape[alias] = base.optional().describe(`Alias of \`${canonical}\`; send one of them. \`${canonical}\` is the canonical name.`);
55
+ }
56
+ return shape;
57
+ }
58
+
59
+ /**
60
+ * Move each alias onto its canonical name. Returns { args } or { error } (a message for the caller).
61
+ * A tool with no aliases gets its args back untouched.
62
+ */
63
+ export function normalizeArgs(tool, args) {
64
+ const list = aliasesFor(tool);
65
+ if (!list.length || !args || typeof args !== "object") return { args };
66
+ const out = { ...args };
67
+ for (const { alias, canonical, required } of list) {
68
+ const has = (k) => out[k] !== undefined && out[k] !== null && out[k] !== "";
69
+ if (has(alias)) {
70
+ if (has(canonical) && out[canonical] !== out[alias]) {
71
+ return { error: `${tool.name}: \`${canonical}\` and its alias \`${alias}\` were both sent with different values; send only \`${canonical}\`.` };
72
+ }
73
+ out[canonical] = out[alias];
74
+ }
75
+ delete out[alias];
76
+ if (required && !has(canonical)) return { error: `${tool.name}: \`${canonical}\` is required (or its alias \`${alias}\`).` };
77
+ }
78
+ return { args: out };
79
+ }
package/src/server.js CHANGED
@@ -18,6 +18,7 @@ import { createSetWatchHandler } from "./watch.js";
18
18
  import { createReadLedger, createExplainHandler } from "./provenance.js";
19
19
  import { registerPlaybooks } from "./playbooks.js";
20
20
  import { toolAnnotations } from "./annotations.js";
21
+ import { aliasedShape, normalizeArgs } from "./input-aliases.js";
21
22
 
22
23
  // Read from package.json rather than a hand-maintained literal -- this drifted
23
24
  // silently to "0.1.0" while the published package reached 0.1.12, so every
@@ -505,10 +506,20 @@ export function createServer({
505
506
  return result;
506
507
  };
507
508
  }
509
+ // username/query/post_id are accepted as aliases of name/q/id (85f3f21b, src/input-aliases.js): moved onto the
510
+ // canonical name before the handler runs, never sent to the API.
511
+ const inner = handler;
508
512
  server.registerTool(
509
513
  tool.name,
510
- { title, description: tool.description, inputSchema: tool.shape, annotations },
511
- handler,
514
+ { title, description: tool.description, inputSchema: aliasedShape(tool), annotations },
515
+ async (args, extra) => {
516
+ const n = normalizeArgs(tool, args);
517
+ if (n.error) return { isError: true, content: [{ type: "text", text: n.error }] };
518
+ // A catalog `validate` refuses inputs the schema cannot express (one-of, cross-field), before any request.
519
+ const invalid = typeof tool.validate === "function" ? tool.validate(n.args || {}) : null;
520
+ if (invalid) return { isError: true, content: [{ type: "text", text: `${tool.name}: ${invalid}` }] };
521
+ return inner(n.args, extra);
522
+ },
512
523
  );
513
524
  }
514
525
 
package/src/tools.js CHANGED
@@ -222,6 +222,14 @@ const WEBHOOK_ID = {
222
222
  id: z.string().min(1).describe("The webhook's id, as returned when the webhook was created or listed."),
223
223
  };
224
224
 
225
+ // The base-36 post id in a permalink, post URL or bare/t3_ id, lowercased; null when none can be read.
226
+ export function postIdOf(v) {
227
+ const s = String(v).trim();
228
+ const m = /\/(?:comments|gallery)\/([A-Za-z0-9]{1,16})(?:[/?#]|$)/.exec(s) || /^https?:\/\/redd\.it\/([A-Za-z0-9]{1,16})/i.exec(s) ||
229
+ /^(?:t3_)?([A-Za-z0-9]{1,16})$/.exec(s);
230
+ return m ? m[1].toLowerCase() : null;
231
+ }
232
+
225
233
  // The tool catalog. Path params are {name}/{id} placeholders. Monitor/webhook
226
234
  // tools additionally carry `write`/`destructive` and, for POST tools whose
227
235
  // body nests a filter_spec, `filterSpecFields` (see buildBody below).
@@ -316,11 +324,25 @@ export const TOOLS = [
316
324
  {
317
325
  name: "reddit_post_comments",
318
326
  path: "/api/reddit/comments",
327
+ // Two inputs naming different posts are refused here, before a request (the API would read the permalink).
328
+ validate: (args) => {
329
+ const ids = ["permalink", "url", "post_id"].filter((k) => typeof args[k] === "string" && args[k] !== "")
330
+ .map((k) => [k, postIdOf(args[k])]);
331
+ const known = ids.filter(([, id]) => id);
332
+ const clash = known.find(([, id]) => id !== known[0][1]);
333
+ return clash ? `\`${known[0][0]}\` and \`${clash[0]}\` name different posts; send one of them.` : null;
334
+ },
319
335
  description:
320
- "Fetches a single post and its comment tree by permalink. Returns the post plus threaded comments (author, body, score, replies) and an `after` cursor. The `permalink` is the one carried by any post result. Size a big thread with the three knobs: `limit` caps top-level comments (1-500, default 100), `depth` caps reply depth (1-10; `depth=1` is top-level only; absent is the full tree) and `sort` orders them (confidence = Reddit's best, top, new, controversial, old, qa). `limit=20, depth=1, sort='top'` reads the twenty best top-level comments and nothing below them, which keeps a 2,700-comment thread readable. `meta` echoes limit_used, depth_used and sort_used; with no `sort` sent, sort_used names the sort Reddit applied and sort_defaulted is true. `format='normalized'` returns flat comments instead of Reddit's raw tree.",
336
+ "Fetches a single post and its comment tree by permalink, post URL or post id (send one). Returns the post plus threaded comments (author, body, score, replies) and an `after` cursor. The `permalink` is the one carried by any post result. Size a big thread with the three knobs: `limit` caps top-level comments (1-500, default 100), `depth` caps reply depth (1-10; `depth=1` is top-level only; absent is the full tree) and `sort` orders them (confidence = Reddit's best, top, new, controversial, old, qa). `limit=20, depth=1, sort='top'` reads the twenty best top-level comments and nothing below them, which keeps a 2,700-comment thread readable. `meta` echoes limit_used, depth_used and sort_used; with no `sort` sent, sort_used names the sort Reddit applied and sort_defaulted is true. `format='normalized'` returns flat comments instead of Reddit's raw tree.",
321
337
  shape: {
322
- permalink: z.string().min(1).describe(
323
- "The post permalink path from a prior post result, e.g. '/r/programming/comments/abc123/some_title/'. Required.",
338
+ permalink: z.string().min(1).optional().describe(
339
+ "The post permalink path from a prior post result, e.g. '/r/programming/comments/abc123/some_title/'. Send this, `url` or `post_id`.",
340
+ ),
341
+ url: z.string().min(1).optional().describe(
342
+ "Any reddit.com, old.reddit.com or redd.it post URL, in place of `permalink`.",
343
+ ),
344
+ post_id: z.string().min(1).optional().describe(
345
+ "The post id (t3_ prefix optional), in place of `permalink` (alias `id`). Sent with a `permalink` or `url` naming a different post, the call is refused.",
324
346
  ),
325
347
  limit: z.number().int().min(1).max(500).optional().describe(
326
348
  "Maximum top-level comments, 1-500 (default 100). A small value with depth=1 gives a readable summary of a large thread.",
@@ -433,6 +455,33 @@ export const TOOLS = [
433
455
  ),
434
456
  },
435
457
  },
458
+ {
459
+ // Search-as-you-type (feedback a62b44d6): subreddit suggestions for a prefix, or with `sub` the posts in
460
+ // that subreddit whose titles match. Read rate, no Reddit login.
461
+ name: "reddit_typeahead",
462
+ path: "/api/reddit/typeahead",
463
+ description:
464
+ "Typeahead (autocomplete) suggestions for a typed prefix. Without `sub` it returns subreddits whose names match the prefix (a leading r/ is ignored); with `sub` it returns posts in that subreddit whose titles match. Default 8 suggestions, at most 20. Needs no Reddit login. Billed at the read rate per call. Example: q='pyth' returns r/Python first.",
465
+ shape: {
466
+ q: z.string().min(1).max(100).describe("The typed prefix, e.g. 'pyth'. Required (alias `query`)."),
467
+ sub: z.string().optional().describe("Subreddit name without r/ (alias `subreddit`). When present, the suggestions are posts in that subreddit whose titles match `q` instead of subreddits."),
468
+ limit: z.number().int().min(1).max(20).optional().describe("Suggestions to return, 1 to 20 (default 8)."),
469
+ ...NSFW,
470
+ },
471
+ },
472
+ {
473
+ // Reddit's political-ad disclosures (r/RedditPoliticalAds), parsed (feedback a62b44d6). Read rate.
474
+ name: "reddit_political_ads",
475
+ path: "/api/reddit/political-ads",
476
+ description:
477
+ "Lists Reddit's political-ad disclosures (the r/RedditPoliticalAds posts), each parsed into advertiser, spend band, impressions, run dates and targeting, plus an `after` cursor. Newest first by default. Billed at the read rate per page.",
478
+ shape: {
479
+ sort: z.enum(["new", "top", "hot"]).optional().describe("'new' = most recent disclosure (default), 'top' = highest score in the `t` window, 'hot' = trending."),
480
+ t: z.enum(["hour", "day", "week", "month", "year", "all"]).optional().describe("Time window, applied only when sort is 'top'."),
481
+ ...LIMIT,
482
+ ...AFTER,
483
+ },
484
+ },
436
485
  {
437
486
  name: "reddit_subreddit_top",
438
487
  path: "/api/reddit/sub/{name}/top",
@@ -665,6 +714,59 @@ export const TOOLS = [
665
714
  ),
666
715
  },
667
716
  },
717
+ {
718
+ name: "reddit_comment_by_id",
719
+ path: "/api/reddit/comment/{id}",
720
+ description:
721
+ "Fetches one comment by its id: Reddit's native t1 comment node (body, author, score, parent, permalink). A comment that does not exist is a 404. Standard read price. Example: id='abc123'.",
722
+ shape: {
723
+ id: z.string().min(1).describe("The comment id, the part after t1_ (e.g. 'abc123'). Required (path parameter)."),
724
+ },
725
+ },
726
+ {
727
+ name: "reddit_post_comments_expanded",
728
+ path: "/api/reddit/post/{id}/comments/expanded",
729
+ description:
730
+ "A post and its comment tree with Reddit's collapsed replies read in. On a big thread Reddit hides part of the tree behind 'load more comments' and 'continue this thread' stubs; this reads those stubs (up to 100 hidden comments per expansion read) and puts the comments back where the stubs were, in the same tree shape as the permalink comment read. `expansion` reports what was read and what is still collapsed (`complete`, `remaining_more_comments`, `stopped_reason`); the returned `after` cursor reads the rest. A flat $0.02 per call; when an expansion read fails, the partial tree comes back and the call is not billed.",
731
+ shape: {
732
+ id: z.string().min(1).describe("Reddit post id, e.g. '1sgjld3'. A t3_ prefix is optional. Required (path parameter)."),
733
+ limit: z.number().int().min(1).max(500).optional().describe("Maximum top-level comments, 1-500 (default 100)."),
734
+ sort: z.enum(["confidence", "top", "new", "controversial", "old", "qa"]).optional().describe(
735
+ "Comment ordering: confidence (Reddit's best), top, new, controversial, old or qa. Absent, Reddit's default for the thread.",
736
+ ),
737
+ max_expansions: z.number().int().min(1).max(9).optional().describe("Most expansion reads this call may make, 1-9 (default 9)."),
738
+ after: z.string().optional().describe(
739
+ "The `after` cursor from a previous answer for the same post, exactly as returned: reads only the comments still collapsed. Absent, the whole thread is read.",
740
+ ),
741
+ },
742
+ },
743
+ {
744
+ name: "reddit_subreddit_can_post",
745
+ path: "/api/reddit/sub/{name}/can-post",
746
+ description:
747
+ "Checks before posting whether a post in this subreddit can go through. Returns `allowed` (true, false or 'unknown'), `reasons` (each with a `code` such as banned, private, restricted_approved_only, archived, flair_required, title_rule, domain_blocked, low_karma_hint, new_account_hint, and a readable `detail`), the subreddit's posting `requirements` and post `rules`. A read that failed answers 'unknown', not true; karma and account age only produce hints, because subreddits keep their AutoModerator thresholds private. Standard read price. Example: name='SaaS'.",
748
+ shape: {
749
+ name: z.string().min(1).describe("Subreddit name, without r/ (1 to 21 letters, digits or underscores). Required (path parameter)."),
750
+ },
751
+ },
752
+ {
753
+ name: "reddit_subreddits_batch",
754
+ path: "/api/reddit/subreddits/batch",
755
+ description:
756
+ "Up to 100 subreddits in one call, by name: a `subreddits` list (the same per-item shape as the single-subreddit about read), `requested`, `returned`, and `missing` (names Reddit did not return because the subreddit does not exist, is banned or is private). One read at the standard read price. Example: names='SaaS,startups,webdev'.",
757
+ shape: {
758
+ names: z.string().min(1).describe("Comma-separated subreddit names without r/, up to 100. Duplicates are ignored. Required."),
759
+ },
760
+ },
761
+ {
762
+ name: "reddit_users_batch",
763
+ path: "/api/reddit/users/batch",
764
+ description:
765
+ "Up to 100 Reddit accounts in one call, by t2_ fullname (the `author_info.fullname` every post and comment result carries): a `users` list (name, created, link, comment and total karma, profile image, NSFW profile flag), `requested`, `returned`, and `missing` (deleted, suspended or nonexistent accounts). Reddit has no batch read by username, so this takes ids only. One read at the standard read price. Example: ids='t2_16b0vi,t2_abc12'.",
766
+ shape: {
767
+ ids: z.string().min(1).describe("Comma-separated t2_ account fullnames, up to 100. The t2_ prefix is required."),
768
+ },
769
+ },
668
770
  {
669
771
  name: "reddit_subreddits_popular",
670
772
  path: "/api/reddit/subreddits/popular",
@@ -811,6 +913,20 @@ export const TOOLS = [
811
913
  dry_run: z.boolean().optional().describe("true lists what would be re-sent and changes nothing."),
812
914
  },
813
915
  },
916
+ {
917
+ // Email targets only, as the API serves it (feedback a62b44d6): delivery mode, or pause/resume. Free.
918
+ name: "reddit_monitor_webhook_update",
919
+ path: "/api/reddit/monitor/webhook/update",
920
+ method: "POST",
921
+ write: true,
922
+ description:
923
+ "Changes an EMAIL delivery target: how often it emails (`delivery_mode` instant, hourly, daily or digest) or whether it is paused (`active`). Only the fields sent change; send at least one. A webhook, Slack or Discord target cannot be updated (400 webhook_not_updatable): delete it and create it again. Resuming a target clears its failure count. Free.",
924
+ shape: {
925
+ ...WEBHOOK_ID,
926
+ delivery_mode: z.enum(["instant", "hourly", "daily", "digest"]).optional().describe("instant = one email per match, hourly or daily = a batched email, digest = the default digest cadence."),
927
+ active: z.boolean().optional().describe("false pauses the target, true resumes it."),
928
+ },
929
+ },
814
930
  {
815
931
  name: "reddit_monitor_webhook_delete",
816
932
  path: "/api/reddit/monitor/webhook/delete",
@@ -939,6 +1055,33 @@ export const TOOLS = [
939
1055
  "Whether a Reddit session is connected for this account: `connected`, the Reddit username, `status` (active, or dead after Reddit rejected it), and when it was first stored, last updated and last used. The cookies are not returned. Free.",
940
1056
  shape: {},
941
1057
  },
1058
+ {
1059
+ name: "reddit_session_check",
1060
+ path: "/api/reddit/session/check",
1061
+ method: "POST",
1062
+ // Not read-only (79c72ae): a confirmed signed-out answer marks the stored session dead.
1063
+ write: true,
1064
+ description:
1065
+ "Asks Reddit now whether the connected Reddit session is still signed in, before a write. The connection status reports what is stored and learns a session died only after a write failed on it; this checks it live and stores no cookies. Returns `valid`; when true, the account's username, `write_ready` (comment, submit, vote, dm: voting and messaging also need the CSRF cookie) and `missing_cookies`; when false, `code` SESSION_LOGGED_OUT (log in again and reconnect) or NO_SESSION (nothing connected). A logged-out stored session is marked dead. 502 SESSION_CHECK_FAILED means Reddit could not be reached, which says nothing about the session. Free.",
1066
+ shape: {},
1067
+ },
1068
+ {
1069
+ name: "reddit_login",
1070
+ path: "/api/reddit/login",
1071
+ method: "POST",
1072
+ write: true,
1073
+ description:
1074
+ "Logs in to a Reddit account with its username and password (plus the TOTP secret when the account has two-factor auth) and returns that account's session cookies (the session cookie, loid, the CSRF cookie and others), the input the connect tool stores server-side. The cookies come back in this tool's result, so they sit in the conversation until they are connected. Reddit sees a real login, which can send the account a login alert. Billed at the login rate. A host built without inline credentials does not list this tool.",
1075
+ shape: {
1076
+ username: z.string().min(1).describe("Reddit username or email."),
1077
+ password: z.string().min(1).describe("The account password."),
1078
+ totp_secret: z.string().optional().describe("Base32 TOTP secret, for an account with two-factor auth. Absent when it is off."),
1079
+ method: z.enum(["http", "browser"]).optional().describe("http (default) or browser. browser gives the most compatible write-session cookies."),
1080
+ proxy: z.string().optional().describe(
1081
+ "Sticky IP for this account, http://user:pass@host:port or host:port. The same one belongs on every later call as this account.",
1082
+ ),
1083
+ },
1084
+ },
942
1085
  {
943
1086
  name: "reddit_disconnect",
944
1087
  path: "/api/reddit/session/delete",
@@ -1005,6 +1148,70 @@ export const TOOLS = [
1005
1148
  message: z.string().min(1).describe("Plain-text message body."),
1006
1149
  },
1007
1150
  },
1151
+ {
1152
+ name: "reddit_dm_threads",
1153
+ path: "/api/reddit/dm/threads",
1154
+ method: "POST",
1155
+ description:
1156
+ "Lists the connected account's private chat conversations, newest activity first: one entry per thread with `room_id`, the other party (`with_user_t2`, `with_username`, `with_membership`), the latest message preview and `unread_count`. Paged: up to `limit` threads per call and an `after` cursor (null on the last page); `total_threads` counts every conversation. `listing_status` is complete, or unknown when Reddit would not list them all. Reads as the connected (stored) session. Billed at the DM read rate per page.",
1157
+ shape: {
1158
+ limit: z.number().int().min(1).max(100).optional().describe("Threads per page, 1 to 100 (default 50)."),
1159
+ after: z.string().optional().describe("The previous response's `after` cursor, exactly as returned. Absent on the first page."),
1160
+ },
1161
+ },
1162
+ {
1163
+ name: "reddit_dm_messages",
1164
+ path: "/api/reddit/dm/messages",
1165
+ method: "POST",
1166
+ description:
1167
+ "Reads the messages of one private chat thread, newest first, as the connected (stored) session. Takes a thread's `room_id` from the thread list. Paged: the previous response's `next_cursor`, sent as `before`, reads older messages. Billed at the DM read rate per page.",
1168
+ shape: {
1169
+ room_id: z.string().min(1).describe("The thread's room_id from the DM thread list (e.g. '!abc...:reddit.com'). Required."),
1170
+ limit: z.number().int().min(1).max(100).optional().describe("Messages per page, 1 to 100 (default 50)."),
1171
+ before: z.string().optional().describe("The previous response's `next_cursor`, for the next older page. Absent for the latest page."),
1172
+ },
1173
+ },
1174
+
1175
+ // ── PROFILE WRITES (POST /api/reddit/profile/*, feedback a62b44d6) ──
1176
+ // Change the connected account's own Reddit profile through the stored session, like the writes above.
1177
+ {
1178
+ name: "reddit_profile_description",
1179
+ path: "/api/reddit/profile/description",
1180
+ method: "POST",
1181
+ write: true,
1182
+ description:
1183
+ "Sets the connected Reddit account's profile description (the 'about' text on its profile), replacing the current one. A public change under the customer's name, marked as a write so a client can ask before it runs. An empty string clears it. Billed at the write rate. With no connected session it answers 400 asking for cookies.",
1184
+ shape: {
1185
+ description: z.string().max(200).describe("The new profile description, up to 200 characters. Required; an empty string clears it."),
1186
+ },
1187
+ },
1188
+ {
1189
+ name: "reddit_profile_display_name",
1190
+ path: "/api/reddit/profile/display-name",
1191
+ method: "POST",
1192
+ write: true,
1193
+ description:
1194
+ "Sets the connected Reddit account's display name (the name shown above the username on its profile), replacing the current one. The username itself stays the same. A public change under the customer's name, marked as a write so a client can ask before it runs. Billed at the write rate. With no connected session it answers 400 asking for cookies.",
1195
+ shape: {
1196
+ display_name: z.string().max(90).describe("The new display name, up to 90 characters. Required."),
1197
+ },
1198
+ },
1199
+ {
1200
+ name: "reddit_profile_avatar",
1201
+ path: "/api/reddit/profile/avatar",
1202
+ validate: (args) => ((args.image_url ? 1 : 0) + (args.image_base64 ? 1 : 0) === 1 ? null : "send exactly one of `image_url` or `image_base64`."),
1203
+ method: "POST",
1204
+ write: true,
1205
+ description:
1206
+ "Uploads a new avatar (or, with kind 'banner', profile banner) for the connected Reddit account, replacing the current image. Reddit keeps no history of the old one, so save it first if it matters. PNG or JPEG only. Send exactly one of `image_url` or `image_base64`; both or neither is refused before any request. A public change under the customer's name, marked as a write so a client can ask before it runs. Billed at the write rate. With no connected session it answers 400 asking for cookies.",
1207
+ shape: {
1208
+ image_url: z.string().url().optional().describe("Public https URL of a PNG or JPEG image. Send this or image_base64, not both."),
1209
+ image_base64: z.string().min(1).optional().describe("PNG or JPEG bytes, base64-encoded. Send this or image_url, not both."),
1210
+ kind: z.enum(["avatar", "banner"]).optional().describe("avatar (default) or banner."),
1211
+ mimetype: z.string().optional().describe("image/png or image/jpeg. Optional; when omitted, the API detects it from the image bytes."),
1212
+ filename: z.string().optional().describe("File name to upload under, e.g. 'avatar.png'. Optional."),
1213
+ },
1214
+ },
1008
1215
 
1009
1216
  // ── SCHEDULED POSTS AND COMMENTS (POST/GET /api/reddit/schedule, POST /api/reddit/schedule/cancel) ──
1010
1217
  // An action is the body the live submit or comment route takes, stored and replayed through