redditapis-mcp 0.11.0 → 0.13.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,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0 (2026-10-20)
4
+
5
+ ### Comment, post, vote and DM as your own Reddit account, after one connect
6
+
7
+ Seven new tools. `reddit_connect` stores your Reddit session once, server-side and encrypted
8
+ (AES-256-GCM, key held only by the API), against your API key's account, after checking it with
9
+ Reddit. `reddit_comment`, `reddit_submit`, `reddit_vote` and `reddit_dm` then act as that account
10
+ with no cookies in the call, so they never sit in an agent's tool arguments or transcript.
11
+ `reddit_session_status` shows what is stored (never the cookies) and `reddit_disconnect` deletes it.
12
+
13
+ Every write is marked `readOnlyHint: false` and `openWorldHint: true`, so a client can ask before it
14
+ runs; `reddit_disconnect` is destructive. `reddit_connect` takes cookies, so a remote host built with
15
+ `inlineCredentials: false` does not list it, like the other cookie-taking tools.
16
+
17
+ Needs the API's stored-session endpoints (POST/GET /api/reddit/session, POST /api/reddit/session/delete).
18
+
19
+ ## 0.12.0 (2026-10-18)
20
+
21
+ ### The read price in the server instructions is passed in, never written
22
+
23
+ The instructions said "most $0.002", a figure written into this file. The day
24
+ read plans moved the read rate to $0.0015, every MCP client would have been told
25
+ a price the API no longer bills. The hosted server now passes the rate
26
+ its own billing charges (`createServer({ readRateUsd })`, the rate the API bills), and the local server names no figure and points at
27
+ redditapis.com/pricing. A missing, non-positive or non-finite rate falls back to
28
+ the figure-free sentence. test/read-price.test.mjs covers both modes and refuses
29
+ a price literal in src/server.js. The instructions stay under the 2048-character
30
+ budget (2044 local, 1853 hosted).
31
+
32
+ The README states the launch prices: $0.0015 per read pay as you go, monthly
33
+ read plans from $19 for 30,000 reads, and 1,000 free reads a month.
34
+
3
35
  ## 0.11.0 (2026-10-16)
4
36
 
5
37
  Released to npm as 0.11.0: the changes below plus reddit_account_payments (#23), which makes this a minor release (the version-class gate refuses a patch that adds a tool).
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/redditapis-mcp)](https://www.npmjs.com/package/redditapis-mcp)
5
5
  [![license](https://img.shields.io/npm/l/redditapis-mcp)](./LICENSE)
6
6
 
7
- redditapis-mcp is the official MCP server for RedditAPIs, built for developers and AI agents that need live Reddit data in Claude, Cursor, Windsurf, VS Code or any MCP client, with no Reddit developer app. Your agent can search posts and comments, read subreddit feeds and rules, expand comment trees, look up users and communities, and set up monitors that send new matching posts to your webhook. Reads cost $0.002 per call, and new accounts get $0.50 of free credit with no card. The server only reads Reddit; posting, commenting and voting stay on the RedditAPIs REST API. Every tool maps to one endpoint at api.redditapis.com.
7
+ redditapis-mcp is the official MCP server for RedditAPIs, built for developers and AI agents that need live Reddit data in Claude, Cursor, Windsurf, VS Code or any MCP client, with no Reddit developer app. Your agent can search posts and comments, read subreddit feeds and rules, expand comment trees, look up users and communities, and set up monitors that send new matching posts to your webhook. Reads cost $0.0015 per call (or a monthly read plan from $19 for 30,000 reads), every account gets 1,000 free reads a month, and new accounts get $0.50 of free credit with no card. Connect your Reddit account once to comment, post, vote and DM as you. Every tool maps to one endpoint at api.redditapis.com.
8
8
 
9
9
  Install: `npx -y redditapis-mcp@latest` with `REDDITAPIS_KEY` from https://www.redditapis.com
10
10
 
@@ -104,7 +104,7 @@ Authentication is a Bearer token: the server sends `Authorization: Bearer <REDDI
104
104
 
105
105
  ## Tools
106
106
 
107
- 47 tools and 3 playbook resources: 30 Reddit reads, 10 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 (posting, commenting, voting, DMs) remain a separate authenticated surface and are intentionally out of scope here -- 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
+ 54 tools and 3 playbook resources: 30 Reddit reads, 7 Reddit account tools (connect, status, disconnect, comment, submit, vote, DM), 10 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
 
@@ -217,6 +217,20 @@ The bodies are documentation and name the calls they are recipes for, which is t
217
217
  { "method": "resources/read", "params": { "uri": "playbook://subreddit-audit" } }
218
218
  ```
219
219
 
220
+ ### Your Reddit account: connect once, then comment, post, vote and DM
221
+
222
+ `reddit_connect` stores your Reddit session on our side, encrypted (AES-256-GCM, the key held only by the API), against this API key's account, after checking it with Reddit. Every write after that sends no cookies, so they never sit in your agent's tool calls or transcript. Each write acts publicly as you, so it is marked as a write and your client asks before it runs. Connecting, status and disconnecting are free.
223
+
224
+ | Tool | Endpoint | What it does |
225
+ |------|----------|--------------|
226
+ | `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. |
227
+ | `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. |
228
+ | `reddit_disconnect` | `POST /api/reddit/session/delete` | Delete the stored session. Free. |
229
+ | `reddit_comment` | `POST /api/reddit/comment` | Comment on a post as you. |
230
+ | `reddit_submit` | `POST /api/reddit/submit` | Submit a text or link post to a subreddit as you. |
231
+ | `reddit_vote` | `POST /api/reddit/vote` | Upvote, downvote or clear a vote on a post or comment as you. |
232
+ | `reddit_dm` | `POST /api/reddit/dm` | Send a private chat message as you. |
233
+
220
234
  ### Feedback: tell the team what broke, after you review the draft
221
235
 
222
236
  Modelled on Claude Code's own feedback tool. When a call fails in a way that is not your key, credits or a rate limit, when you ask for something no tool covers, or when a result is plainly wrong, the model can **draft** a report into a local queue (`~/.redditapis/feedback-queue.json`, at most 10 drafts, override the directory with `REDDITAPIS_FEEDBACK_DIR`). Nothing is sent until you ask to review the queue and name the drafts to send. Each report carries the last failing call's endpoint, status and request id, your client name and this package's version, so the team can act on it without a follow-up. Use `reddit_feedback_get` with the returned server id to see whether it was triaged, shipped or declined. Both tools are free.
@@ -308,7 +322,7 @@ Later, `reddit_monitor_deliveries` with `{ id: "<monitor id from the add respons
308
322
 
309
323
  ## No session needed for reads; monitor/webhook writes need an active plan
310
324
 
311
- Reads need nothing but your API key -- no account linking, login, or cookie step. Reddit write actions (posting, commenting, voting, sending DMs) are handled by a separate authenticated surface outside this package and remain deliberately not exposed here, so an agent using this server can never post, vote, or DM as you on Reddit. Monitor/webhook management tools are a different kind of write: they configure your OWN redditapis.com account (an alerting subscription) and require an active monitoring plan for anything that creates or changes state (`reddit_monitor_add`/`update`/`remove`, `reddit_monitor_webhook_create`/`test`/`delete`); reading your own list, health, or delivery history never does.
325
+ Reads need nothing but your API key -- no account linking, login, or cookie step. Reddit write actions (commenting, posting, voting, sending DMs) need one extra step: `reddit_connect` stores your Reddit session on our side, encrypted, so later calls carry no cookies. Until you connect, no tool can post, vote or DM as you, and `reddit_disconnect` deletes the stored session at any time. Monitor/webhook management tools are a different kind of write: they configure your OWN redditapis.com account (an alerting subscription) and require an active monitoring plan for anything that creates or changes state (`reddit_monitor_add`/`update`/`remove`, `reddit_monitor_webhook_create`/`test`/`delete`); reading your own list, health, or delivery history never does.
312
326
 
313
327
  ## Troubleshooting
314
328
 
@@ -346,9 +360,9 @@ npm start # run the stdio server (needs REDDITAPIS_KEY)
346
360
 
347
361
  **Do I need a Reddit developer app?** No. One RedditAPIs key covers every read, with no Reddit developer app to register.
348
362
 
349
- **What does it cost?** $0.002 per read, with $0.50 of free credit at signup and no card. Monitors need a monitoring plan, which has no free tier.
363
+ **What does it cost?** $0.0015 per read pay as you go, or a monthly read plan from $19 for 30,000 reads; every account gets 1,000 free reads a month, plus $0.50 of free credit at signup and no card. Monitors need a monitoring plan, which has no free tier.
350
364
 
351
- **Can it post, comment or vote?** Not through this server. It reads Reddit only; writes are on the RedditAPIs REST API. All 30 Reddit-facing tools read Reddit; posting, commenting, voting, and DMs are a separate authenticated surface and are not exposed here. Of the other 17, the 10 monitor/webhook tools manage your OWN redditapis.com monitors and webhooks (a write, but never a write to Reddit itself), `reddit_set_watch` sets up a whole watch in one call, `reddit_explain` says where the rows you hold came from, the 3 feedback tools send or read a report to the redditapis.com team, and `reddit_account_me` and `reddit_account_payments` read your own balance, plan and top-up history.
365
+ **Can it post, comment or vote?** Yes, after you connect your Reddit account once with `reddit_connect` (your session is stored encrypted on our side and never travels in later calls). `reddit_comment`, `reddit_submit`, `reddit_vote` and `reddit_dm` then act as that account, and each is marked as a write so your client asks before it runs. `reddit_disconnect` deletes the stored session. Of the other tools, the 10 monitor/webhook tools manage your OWN redditapis.com monitors and webhooks (a write, but never a write to Reddit itself), `reddit_set_watch` sets up a whole watch in one call, `reddit_explain` says where the rows you hold came from, the 3 feedback tools send or read a report to the redditapis.com team, and `reddit_account_me` and `reddit_account_payments` read your own balance, plan and top-up history.
352
366
 
353
367
  **Which clients are supported?** Claude Desktop, Claude Code, Cursor, Windsurf, and VS Code (Copilot agent mode), or any Model Context Protocol client.
354
368
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redditapis-mcp",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "mcpName": "io.github.redditapis/redditapis-mcp",
5
5
  "description": "Official MCP server for redditapis.com. Search Reddit posts, comments, communities, users and media; read subreddits, comment trees, top posts and profiles; create and manage monitors and webhooks. Native tools for Claude, Cursor and any MCP client.",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "scripts": {
32
32
  "start": "node src/index.js",
33
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",
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",
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",
@@ -81,6 +81,18 @@ export const TOOL_ANNOTATIONS = {
81
81
  reddit_monitor_webhook_delete: { title: "Delete Webhook", readOnly: false, destructive: true, idempotent: true, openWorld: false },
82
82
  reddit_feedback_send: { title: "Send Feedback Report", readOnly: false, destructive: true, idempotent: false, openWorld: false },
83
83
  reddit_set_watch: { title: "Create Watch", readOnly: false, destructive: false, idempotent: false, openWorld: true },
84
+
85
+ // Writes AS the customer's own Reddit account through the stored session (#16). openWorld:
86
+ // each reaches Reddit itself. comment, submit and dm add content and are not idempotent;
87
+ // vote sets a state (idempotent); connect overwrites and disconnect deletes the stored
88
+ // credential, so both are destructive.
89
+ reddit_connect: { title: "Connect Reddit Account", readOnly: false, destructive: true, idempotent: true, openWorld: true },
90
+ reddit_session_status: { title: "Reddit Connection Status", ...READ_OWN },
91
+ reddit_disconnect: { title: "Disconnect Reddit Account", readOnly: false, destructive: true, idempotent: true, openWorld: false },
92
+ reddit_comment: { title: "Post Comment", readOnly: false, destructive: false, idempotent: false, openWorld: true },
93
+ reddit_submit: { title: "Submit Post", readOnly: false, destructive: false, idempotent: false, openWorld: true },
94
+ reddit_vote: { title: "Vote", readOnly: false, destructive: false, idempotent: true, openWorld: true },
95
+ reddit_dm: { title: "Send Direct Message", readOnly: false, destructive: false, idempotent: false, openWorld: true },
84
96
  };
85
97
 
86
98
  /**
package/src/server.js CHANGED
@@ -165,13 +165,28 @@ export function hintFor(status, path, error) {
165
165
  const SESSION_SENTENCE =
166
166
  "reddit_home_feed and reddit_user_upvoted/saved/hidden/gilded need the user's own Reddit cookies (reddit_session, loid) from POST /api/reddit/login on the REST API, not an MCP tool. ";
167
167
 
168
- export function buildInstructions({ inlineCredentials = true } = {}) {
169
- return INSTRUCTIONS_HEAD + (inlineCredentials ? SESSION_SENTENCE : "") + INSTRUCTIONS_TAIL;
168
+ // THE READ PRICE IS PASSED IN, NEVER WRITTEN HERE. The hosted server passes the
169
+ // rate its own billing charges (readRateUsd, from the API's pricing module), so
170
+ // the instructions can never name a price the API does not bill; a published
171
+ // figure in this file went stale the day read plans changed the read rate.
172
+ // Without a rate (the local stdio server) the sentence names no figure and
173
+ // points at the pricing page. A non-number or a non-positive rate is ignored.
174
+ export function readPriceSentence(readRateUsd) {
175
+ const r = Number(readRateUsd);
176
+ const priced = readRateUsd !== null && readRateUsd !== undefined && readRateUsd !== "" && Number.isFinite(r) && r > 0;
177
+ return priced
178
+ ? `Read tools bill per call (most $${r}); monitor, webhook and feedback tools are free. `
179
+ : "Read tools bill per call (prices: redditapis.com/pricing); monitor, webhook and feedback tools are free. ";
170
180
  }
171
181
 
182
+ export function buildInstructions({ inlineCredentials = true, readRateUsd = null } = {}) {
183
+ return INSTRUCTIONS_LEAD + readPriceSentence(readRateUsd) + INSTRUCTIONS_HEAD + (inlineCredentials ? SESSION_SENTENCE : "") + INSTRUCTIONS_TAIL;
184
+ }
185
+
186
+ const INSTRUCTIONS_LEAD = "redditapis.com MCP server. ";
187
+
172
188
  const INSTRUCTIONS_HEAD =
173
- "redditapis.com MCP server. Read tools cost credits per call (most $0.002); monitor, webhook and feedback tools are free. " +
174
- "reddit_account_me shows the balance for free before a large batch; on a 402, give the user the error's top-up URL. " +
189
+ "reddit_account_me shows the balance free before a big batch; on a 402, give the user the error's top-up URL. " +
175
190
  "reddit_search: sort='relevance' with a large `limit` for best matches; sort_type='score' re-orders that page; a quoted phrase or `subreddit` narrows it. " +
176
191
  "reddit_deep_comment_search returns matching comments; reddit_search_comments only their posts. " +
177
192
  "reddit_search_communities searches subreddits; reddit_subreddits_popular/new/default browse them. ";
@@ -215,6 +230,9 @@ export const INSTRUCTIONS = buildInstructions({ inlineCredentials: true });
215
230
  * proxy (takesInlineCredentials in tools.js) UNREGISTERED, and drops the
216
231
  * instructions sentence that names them. A remote host passes false so a
217
232
  * connected app is never asked to send a Reddit session through it.
233
+ * @param {number|null} [opts.readRateUsd] the read price the API bills right now.
234
+ * The hosted server passes it from its own pricing; omitted (the local
235
+ * server) the instructions name no figure (readPriceSentence).
218
236
  */
219
237
  export function createServer({
220
238
  apiKey,
@@ -227,6 +245,7 @@ export function createServer({
227
245
  nowImpl = () => Date.now(),
228
246
  retryDelaysMs = [3000, 8000],
229
247
  inlineCredentials = true,
248
+ readRateUsd = null,
230
249
  } = {}) {
231
250
  // A STRING "false" from an environment variable must not silently leave the
232
251
  // cookie tools exposed on a hosted server (review 2026-10-02): booleans only.
@@ -430,7 +449,7 @@ export function createServer({
430
449
 
431
450
  const server = new McpServer(
432
451
  { name: "redditapis", version: VERSION },
433
- { instructions: buildInstructions({ inlineCredentials: inlineCredentials !== false }) },
452
+ { instructions: buildInstructions({ inlineCredentials: inlineCredentials !== false, readRateUsd }) },
434
453
  );
435
454
 
436
455
  // Handlers for tools that carry local: "<name>" in the catalog. A name the
package/src/tools.js CHANGED
@@ -7,9 +7,8 @@
7
7
  // {name}/{id} in a tool's `path` (e.g. /api/reddit/sub/{name}/top), which are
8
8
  // interpolated into the URL and removed from the query string.
9
9
  //
10
- // WRITES: reddit writes (comment/vote/DM -- posting AS the customer to Reddit
11
- // itself) are a separate authenticated surface and remain intentionally out of
12
- // scope here, that boundary is unchanged. Monitor/webhook management (2026-08-11,
10
+ // WRITES AS THE CUSTOMER (comment/submit/vote/DM) act through the session stored
11
+ // by reddit_connect (#16, operator decision 2026-10-19). Monitor/webhook management (2026-08-11,
13
12
  // task #43) is a DIFFERENT kind of write: it configures the customer's OWN
14
13
  // redditapis.com account (an alerting subscription), the same risk class as
15
14
  // reading their own usage -- it never posts, votes, or DMs anywhere. Those tools
@@ -825,6 +824,101 @@ export const TOOLS = [
825
824
  "Returns the payment history of the account behind this API key: each top-up's amount, the credits it added, its status and when it happened, newest first. Free: not metered, and costs no credit.",
826
825
  shape: {},
827
826
  },
827
+
828
+ // ── WRITES AS THE CUSTOMER'S OWN REDDIT ACCOUNT, through a stored session (#16) ──
829
+ // Operator decision 2026-10-19: MCP write tools exist, and they reuse the REST login session
830
+ // STORED SERVER-SIDE, encrypted, against the account. reddit_connect is the one call that
831
+ // carries cookies; every write after it sends none, so cookies never sit in an agent's later
832
+ // tool arguments or transcript. Each write posts, votes or messages AS the customer on Reddit
833
+ // itself, so all of them are write: true and openWorld, and a client should confirm first.
834
+ {
835
+ name: "reddit_connect",
836
+ path: "/api/reddit/session",
837
+ method: "POST",
838
+ write: true,
839
+ destructive: true,
840
+ description:
841
+ "Stores the customer's own Reddit session once, so the comment, submit, vote and DM tools in this server act as that account without cookies in later calls. The session is kept server-side, encrypted (AES-256-GCM, key held only by the API), against this API key's account, after a check with Reddit: a logged-out session is refused with SESSION_LOGGED_OUT. Takes Reddit's session and loid cookies (from the REST login endpoint or the customer's own browser), plus the CSRF cookie for voting and messaging. Connecting again replaces the stored session. Free.",
842
+ shape: {
843
+ reddit_session: z.string().min(1).describe("Reddit's session cookie."),
844
+ loid: z.string().min(1).describe("The loid cookie."),
845
+ csrf_token: z.string().optional().describe("The CSRF cookie. Needed for voting and messaging."),
846
+ token_v2: z.string().optional().describe("The token_v2 cookie, when the session has one."),
847
+ },
848
+ },
849
+ {
850
+ name: "reddit_session_status",
851
+ path: "/api/reddit/session",
852
+ description:
853
+ "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.",
854
+ shape: {},
855
+ },
856
+ {
857
+ name: "reddit_disconnect",
858
+ path: "/api/reddit/session/delete",
859
+ method: "POST",
860
+ write: true,
861
+ destructive: true,
862
+ description:
863
+ "Deletes the stored Reddit session for this account. After this, the write tools answer with a request for cookies until a session is connected again. Idempotent: `deleted` is false when nothing was stored. Free.",
864
+ shape: {},
865
+ },
866
+ {
867
+ name: "reddit_comment",
868
+ path: "/api/reddit/comment",
869
+ method: "POST",
870
+ write: true,
871
+ description:
872
+ "Posts a comment on a Reddit post as the connected account. A public action on Reddit under the customer's name, marked as a write so a client can ask before it runs. The text is posted as Reddit markdown. Billed at the write rate. With no connected session it answers 400 asking for cookies.",
873
+ shape: {
874
+ post_url: z.string().min(1).describe("Any reddit.com post URL."),
875
+ text: z.string().min(1).describe("The comment text."),
876
+ },
877
+ },
878
+ {
879
+ name: "reddit_submit",
880
+ path: "/api/reddit/submit",
881
+ method: "POST",
882
+ write: true,
883
+ description:
884
+ "Submits a new post to a subreddit as the connected account: a text post (kind self) or a link post (kind link). A public action on Reddit under the customer's name, marked as a write so a client can ask before it runs; a subreddit's rules decide whether the post stays up. Billed at the write rate.",
885
+ shape: {
886
+ subreddit: z.string().min(1).describe("Subreddit name, without r/."),
887
+ kind: z.enum(["self", "link"]).describe("self = text post, link = URL post."),
888
+ title: z.string().min(1).describe("Post title."),
889
+ text: z.string().optional().describe("Body text, for kind self."),
890
+ url: z.string().optional().describe("Target URL, for kind link."),
891
+ flair_id: z.string().optional().describe("Post flair template id, for subreddits that require flair."),
892
+ flair_text: z.string().optional().describe("Post flair text, when the flair template allows editing it."),
893
+ nsfw: z.boolean().optional().describe("Mark the post NSFW."),
894
+ spoiler: z.boolean().optional().describe("Mark the post as a spoiler."),
895
+ },
896
+ },
897
+ {
898
+ name: "reddit_vote",
899
+ path: "/api/reddit/vote",
900
+ method: "POST",
901
+ write: true,
902
+ description:
903
+ "Upvotes, downvotes or clears the vote on a post (t3_) or comment (t1_) as the connected account. Voting needs the CSRF cookie in the stored session. Billed at the vote rate.",
904
+ shape: {
905
+ thing_id: z.string().regex(/^t[13]_[a-z0-9]+$/).describe("t3_xxx for a post, t1_xxx for a comment."),
906
+ direction: z.enum(["up", "down", "none"]).describe("up, down, or none to clear an existing vote."),
907
+ },
908
+ },
909
+ {
910
+ name: "reddit_dm",
911
+ path: "/api/reddit/dm",
912
+ method: "POST",
913
+ write: true,
914
+ description:
915
+ "Sends a private Reddit chat message as the connected account. A direct message to a real person under the customer's name, marked as a write so a client can ask before it runs. Messaging needs the CSRF cookie in the stored session. Billed at the DM rate.",
916
+ shape: {
917
+ to_username: z.string().optional().describe("Recipient username. Provide this or to_user_t2."),
918
+ to_user_t2: z.string().regex(/^t2_[a-z0-9]+$/).optional().describe("Recipient t2_ id directly, instead of to_username."),
919
+ message: z.string().min(1).describe("Plain-text message body."),
920
+ },
921
+ },
828
922
  {
829
923
  // ONE CALL INSTEAD OF THREE. Standing up a watch today means composing a
830
924
  // webhook registration, a monitor creation and a test delivery, each with