Conversation
waleedlatif1
commented
Mar 6, 2026
- feat(reddit): add 5 new tools, fix bugs, and audit all endpoints against API docs (feat(reddit): add 5 new tools, fix bugs, and audit all endpoints against API docs #3434)
- feat(slack): add views.open, views.update, views.push, views.publish tools (feat(slack): add views.open, views.update, views.push, views.publish tools #3436)
…nst API docs (#3434) * feat(reddit): add 5 new tools, fix bugs, and audit all endpoints against API docs * 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 * chore(reddit): remove unused output property constants from types.ts * fix(reddit): add HTTP error handling to GET tools Add !response.ok guards to get_me, get_user, get_subreddit_info, and get_messages to return success: false on non-2xx responses instead of silently returning empty data with success: true. * fix(reddit): add input validation and HTTP error guards - Add validateEnum/validatePathSegment to prevent URL path traversal - Add !response.ok guards to send_message and reply tools - Centralize subreddit validation in normalizeSubreddit
…tools (#3436) * feat(slack): add views.open, views.update, views.push, views.publish tools * feat(slack): wire view tools into slack block definition
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Adds Slack view/modals APIs. Introduces Written by Cursor Bugbot for commit 127968d. Configure here. |
Greptile SummaryThis PR adds 5 new Reddit tools ( Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant RedditBlock
participant SlackBlock
participant RedditAPI as Reddit OAuth API
participant SlackAPI as Slack API
Note over RedditBlock: New Reddit tools
User->>RedditBlock: get_me
RedditBlock->>RedditAPI: GET /api/v1/me
RedditAPI-->>RedditBlock: user profile
RedditBlock-->>User: id, name, karma, etc.
User->>RedditBlock: get_user (username)
RedditBlock->>RedditAPI: GET /user/{username}/about
RedditAPI-->>RedditBlock: public profile
RedditBlock-->>User: id, name, karma, etc.
User->>RedditBlock: send_message (to, subject, text)
RedditBlock->>RedditAPI: POST /api/compose
RedditAPI-->>RedditBlock: success/errors
RedditBlock-->>User: success, message
User->>RedditBlock: get_messages (where, limit)
RedditBlock->>RedditAPI: GET /message/{where}
RedditAPI-->>RedditBlock: listing
RedditBlock-->>User: messages[], after, before
User->>RedditBlock: get_subreddit_info (subreddit)
RedditBlock->>RedditAPI: GET /r/{subreddit}/about
RedditAPI-->>RedditBlock: subreddit data
RedditBlock-->>User: subscribers, description, etc.
Note over SlackBlock: New Slack view tools
User->>SlackBlock: open_view (triggerId, view)
SlackBlock->>SlackAPI: POST views.open
SlackAPI-->>SlackBlock: view object
SlackBlock-->>User: view { id, hash, blocks, ... }
User->>SlackBlock: update_view (viewId/externalId, view)
SlackBlock->>SlackAPI: POST views.update
SlackAPI-->>SlackBlock: updated view object
SlackBlock-->>User: view { id, hash, blocks, ... }
User->>SlackBlock: push_view (triggerId, view)
SlackBlock->>SlackAPI: POST views.push
SlackAPI-->>SlackBlock: pushed view object
SlackBlock-->>User: view { id, hash, blocks, ... }
User->>SlackBlock: publish_view (userId, view)
SlackBlock->>SlackAPI: POST views.publish
SlackAPI-->>SlackBlock: home tab view
SlackBlock-->>User: view { id, hash, blocks, ... }
|
| body: (params: SlackUpdateViewParams) => { | ||
| const body: Record<string, unknown> = { | ||
| view: typeof params.view === 'string' ? JSON.parse(params.view) : params.view, | ||
| } | ||
|
|
||
| if (params.viewId) { | ||
| body.view_id = params.viewId.trim() | ||
| } | ||
|
|
||
| if (params.externalId) { | ||
| body.external_id = params.externalId.trim() | ||
| } | ||
|
|
||
| if (params.hash) { | ||
| body.hash = params.hash.trim() | ||
| } | ||
|
|
||
| return body | ||
| }, |
There was a problem hiding this comment.
Missing runtime validation: both viewId and externalId are optional
Both viewId and externalId are declared required: false, but the Slack views.update API requires at least one of them. There is no guard to throw before sending the request. A call with neither field populated will reach Slack and return an invalid_arguments error — this could be caught earlier with a clear error message.
| body: (params: SlackUpdateViewParams) => { | |
| const body: Record<string, unknown> = { | |
| view: typeof params.view === 'string' ? JSON.parse(params.view) : params.view, | |
| } | |
| if (params.viewId) { | |
| body.view_id = params.viewId.trim() | |
| } | |
| if (params.externalId) { | |
| body.external_id = params.externalId.trim() | |
| } | |
| if (params.hash) { | |
| body.hash = params.hash.trim() | |
| } | |
| return body | |
| }, | |
| body: (params: SlackUpdateViewParams) => { | |
| if (!params.viewId && !params.externalId) { | |
| throw new Error('Either viewId or externalId is required to update a view.') | |
| } | |
| const body: Record<string, unknown> = { | |
| view: typeof params.view === 'string' ? JSON.parse(params.view) : params.view, | |
| } | |
| if (params.viewId) { | |
| body.view_id = params.viewId.trim() | |
| } | |
| if (params.externalId) { | |
| body.external_id = params.externalId.trim() | |
| } | |
| if (params.hash) { | |
| body.hash = params.hash.trim() | |
| } | |
| return body | |
| }, |