You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(reddit): add optional chaining, pagination wiring, and trim safety
- Add optional chaining on children?.[0] in get_posts, get_controversial,
search, and get_comments to prevent TypeError on unexpected API responses
- Wire after/before pagination params to get_messages block operation
- Use ?? instead of || for get_comments limit to handle 0 correctly
- Add .trim() on postId in get_comments URL path
Copy file name to clipboardExpand all lines: apps/docs/content/docs/en/tools/reddit.mdx
+171-7Lines changed: 171 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ These operations let your agents access and analyze Reddit content as part of yo
24
24
25
25
## Usage Instructions
26
26
27
-
Integrate Reddit into workflows. Read posts, comments, and search content. Submit posts, vote, reply, edit, and manage your Reddit account.
27
+
Integrate Reddit into workflows. Read posts, comments, and search content. Submit posts, vote, reply, edit, manage messages, and access user and subreddit info.
28
28
29
29
30
30
@@ -39,14 +39,15 @@ Fetch posts from a subreddit with different sorting options
39
39
| Parameter | Type | Required | Description |
40
40
| --------- | ---- | -------- | ----------- |
41
41
|`subreddit`| string | Yes | The subreddit to fetch posts from \(e.g., "technology", "news"\)|
42
-
|`sort`| string | No | Sort method for posts \(e.g., "hot", "new", "top", "rising"\). Default: "hot" |
42
+
|`sort`| string | No | Sort method for posts \(e.g., "hot", "new", "top", "rising", "controversial"\). Default: "hot" |
43
43
|`limit`| number | No | Maximum number of posts to return \(e.g., 25\). Default: 10, max: 100 |
44
-
|`time`| string | No | Time filter for "top" sorted posts: "day", "week", "month", "year", or "all" \(default: "day"\)|
44
+
|`time`| string | No | Time filter for "top" sorted posts: "day", "week", "month", "year", or "all" \(default: "all"\)|
45
45
|`after`| string | No | Fullname of a thing to fetch items after \(for pagination\)|
46
46
|`before`| string | No | Fullname of a thing to fetch items before \(for pagination\)|
47
47
|`count`| number | No | A count of items already seen in the listing \(used for numbering\)|
48
48
|`show`| string | No | Show items that would normally be filtered \(e.g., "all"\)|
49
49
|`sr_detail`| boolean | No | Expand subreddit details in the response |
50
+
|`g`| string | No | Geo filter for posts \(e.g., "GLOBAL", "US", "AR", etc.\)|
50
51
51
52
#### Output
52
53
@@ -55,6 +56,7 @@ Fetch posts from a subreddit with different sorting options
55
56
|`subreddit`| string | Name of the subreddit where posts were fetched from |
56
57
|`posts`| array | Array of posts with title, author, URL, score, comments count, and metadata |
57
58
| ↳ `id`| string | Post ID |
59
+
| ↳ `name`| string | Thing fullname \(t3_xxxxx\)|
58
60
| ↳ `title`| string | Post title |
59
61
| ↳ `author`| string | Author username |
60
62
| ↳ `url`| string | Post URL |
@@ -66,6 +68,8 @@ Fetch posts from a subreddit with different sorting options
66
68
| ↳ `selftext`| string | Text content for self posts |
67
69
| ↳ `thumbnail`| string | Thumbnail URL |
68
70
| ↳ `subreddit`| string | Subreddit name |
71
+
|`after`| string | Fullname of the last item for forward pagination |
72
+
|`before`| string | Fullname of the first item for backward pagination |
69
73
70
74
### `reddit_get_comments`
71
75
@@ -83,19 +87,17 @@ Fetch comments from a specific Reddit post
83
87
|`context`| number | No | Number of parent comments to include |
84
88
|`showedits`| boolean | No | Show edit information for comments |
85
89
|`showmore`| boolean | No | Include "load more comments" elements in the response |
86
-
|`showtitle`| boolean | No | Include submission title in the response |
87
90
|`threaded`| boolean | No | Return comments in threaded/nested format |
88
91
|`truncate`| number | No | Integer to truncate comment depth |
89
-
|`after`| string | No | Fullname of a thing to fetch items after \(for pagination\)|
90
-
|`before`| string | No | Fullname of a thing to fetch items before \(for pagination\)|
91
-
|`count`| number | No | A count of items already seen in the listing \(used for numbering\)|
92
+
|`comment`| string | No | ID36 of a comment to focus on \(returns that comment thread\)|
92
93
93
94
#### Output
94
95
95
96
| Parameter | Type | Description |
96
97
| --------- | ---- | ----------- |
97
98
|`post`| object | Post information including ID, title, author, content, and metadata |
98
99
| ↳ `id`| string | Post ID |
100
+
| ↳ `name`| string | Thing fullname \(t3_xxxxx\)|
99
101
| ↳ `title`| string | Post title |
100
102
| ↳ `author`| string | Post author |
101
103
| ↳ `selftext`| string | Post text content |
@@ -104,6 +106,7 @@ Fetch comments from a specific Reddit post
104
106
| ↳ `permalink`| string | Reddit permalink |
105
107
|`comments`| array | Nested comments with author, body, score, timestamps, and replies |
106
108
| ↳ `id`| string | Comment ID |
109
+
| ↳ `name`| string | Thing fullname \(t1_xxxxx\)|
107
110
| ↳ `author`| string | Comment author |
108
111
| ↳ `body`| string | Comment text |
109
112
| ↳ `score`| number | Comment score |
@@ -135,6 +138,7 @@ Fetch controversial posts from a subreddit
135
138
|`subreddit`| string | Name of the subreddit where posts were fetched from |
136
139
|`posts`| array | Array of controversial posts with title, author, URL, score, comments count, and metadata |
137
140
| ↳ `id`| string | Post ID |
141
+
| ↳ `name`| string | Thing fullname \(t3_xxxxx\)|
138
142
| ↳ `title`| string | Post title |
139
143
| ↳ `author`| string | Author username |
140
144
| ↳ `url`| string | Post URL |
@@ -146,6 +150,8 @@ Fetch controversial posts from a subreddit
146
150
| ↳ `selftext`| string | Text content for self posts |
147
151
| ↳ `thumbnail`| string | Thumbnail URL |
148
152
| ↳ `subreddit`| string | Subreddit name |
153
+
|`after`| string | Fullname of the last item for forward pagination |
154
+
|`before`| string | Fullname of the first item for backward pagination |
149
155
150
156
### `reddit_search`
151
157
@@ -165,6 +171,8 @@ Search for posts within a subreddit
165
171
|`before`| string | No | Fullname of a thing to fetch items before \(for pagination\)|
166
172
|`count`| number | No | A count of items already seen in the listing \(used for numbering\)|
167
173
|`show`| string | No | Show items that would normally be filtered \(e.g., "all"\)|
174
+
|`type`| string | No | Type of search results: "link" \(posts\), "sr" \(subreddits\), or "user" \(users\). Default: "link" |
175
+
|`sr_detail`| boolean | No | Expand subreddit details in the response |
168
176
169
177
#### Output
170
178
@@ -173,6 +181,7 @@ Search for posts within a subreddit
173
181
|`subreddit`| string | Name of the subreddit where search was performed |
174
182
|`posts`| array | Array of search result posts with title, author, URL, score, comments count, and metadata |
175
183
| ↳ `id`| string | Post ID |
184
+
| ↳ `name`| string | Thing fullname \(t3_xxxxx\)|
176
185
| ↳ `title`| string | Post title |
177
186
| ↳ `author`| string | Author username |
178
187
| ↳ `url`| string | Post URL |
@@ -184,6 +193,8 @@ Search for posts within a subreddit
184
193
| ↳ `selftext`| string | Text content for self posts |
185
194
| ↳ `thumbnail`| string | Thumbnail URL |
186
195
| ↳ `subreddit`| string | Subreddit name |
196
+
|`after`| string | Fullname of the last item for forward pagination |
197
+
|`before`| string | Fullname of the first item for backward pagination |
187
198
188
199
### `reddit_submit_post`
189
200
@@ -200,6 +211,9 @@ Submit a new post to a subreddit (text or link)
200
211
|`nsfw`| boolean | No | Mark post as NSFW |
201
212
|`spoiler`| boolean | No | Mark post as spoiler |
202
213
|`send_replies`| boolean | No | Send reply notifications to inbox \(default: true\)|
214
+
|`flair_id`| string | No | Flair template UUID for the post \(max 36 characters\)|
215
+
|`flair_text`| string | No | Flair text to display on the post \(max 64 characters\)|
216
+
|`collection_id`| string | No | Collection UUID to add the post to |
203
217
204
218
#### Output
205
219
@@ -264,6 +278,21 @@ Save a Reddit post or comment to your saved items
0 commit comments