chore: remove dead get_social_posts tool#1694
Conversation
Cut the hardcoded https://api.recoupable.com/api/social/posts URL over to ${getClientApiBaseUrl()}/api/socials/${social_id}/posts. The social_id moves from query param to path segment. Adds Authorization: Bearer header sourced from the Privy access token threaded through getMcpTools.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 36 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDocumentation pages for the Posts API endpoint are removed entirely. The Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Smoke test — blocked-on-api-mergeStatus: pending api preview Reason: The AI SDK Plan: once api PR (row 18 of migration table) lands on
|
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 4/5
- This PR looks safe to merge overall, with a minor-to-moderate risk item rather than a clear merge blocker.
- In
lib/tools/getSocialPosts.ts, interpolatingsocial_iddirectly into a URL path can produce malformed routes when IDs include reserved characters, which may cause request failures for some inputs. - Given the issue is severity 4/10 (with high confidence), the impact appears limited and straightforward to fix by encoding the path segment.
- Pay close attention to
lib/tools/getSocialPosts.ts- ensuresocial_idis encoded before building the URL path.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/tools/getSocialPosts.ts">
<violation number="1" location="lib/tools/getSocialPosts.ts:47">
P2: Encode `social_id` before interpolating it into the URL path segment to avoid malformed routes for IDs containing reserved characters.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Canonical API reference lives in the Mintlify docs submodule (developers.recoupable.com). The chat-hosted /docs/posts page was unreferenced (no nav link, no external href) and pointed at the legacy api.recoupable.com service being retired in Capability 9.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/tools/getSocialPosts.ts (1)
33-60: Nice, clean factory + auth wiring.Higher-order-function shape cleanly closes over
accessToken, preserves the original input schema and error contract, and matches thegetTasks/getConversationsprecedent for Bearer auth — SRP intact, no duplication introduced. One small nit you can take or leave: consider a cheap guard (e.g. throw early whenaccessTokenis falsy) so a misconfigured caller fails loudly instead of sending a bareAuthorization: Bearerheader that the API will just 401 on.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/tools/getSocialPosts.ts` around lines 33 - 60, Add an early guard in the getSocialPosts factory to throw if accessToken is falsy so callers fail fast instead of sending an empty Authorization header; inside the getSocialPosts function (the outer factory that returns tool({...}) and closes over accessToken) validate accessToken at the top (before returning the tool or inside the tool factory before making the fetch) and throw a clear Error (e.g., "Missing accessToken for getSocialPosts") so the execute implementation and caller surface a loud, deterministic failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/tools/getSocialPosts.ts`:
- Around line 46-51: The URL path is built by interpolating social_id directly
into the template string in getSocialPosts (where you create new
URL(`${getClientApiBaseUrl()}/api/socials/${social_id}/posts`)), which can break
if social_id contains slashes or special chars; fix it by percent-encoding the
path segment before interpolation (use encodeURIComponent or an equivalent
path-segment encoder) so the constructed URL becomes
.../api/socials/${encodedSocialId}/posts and keep the rest of the searchParams
logic unchanged.
---
Nitpick comments:
In `@lib/tools/getSocialPosts.ts`:
- Around line 33-60: Add an early guard in the getSocialPosts factory to throw
if accessToken is falsy so callers fail fast instead of sending an empty
Authorization header; inside the getSocialPosts function (the outer factory that
returns tool({...}) and closes over accessToken) validate accessToken at the top
(before returning the tool or inside the tool factory before making the fetch)
and throw a clear Error (e.g., "Missing accessToken for getSocialPosts") so the
execute implementation and caller surface a loud, deterministic failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b486bdfb-a17d-4465-a97a-0012b4d22b0d
📒 Files selected for processing (4)
app/docs/posts/constants.tsapp/docs/posts/page.tsxlib/tools/getMcpTools.tslib/tools/getSocialPosts.ts
💤 Files with no reviewable changes (2)
- app/docs/posts/constants.ts
- app/docs/posts/page.tsx
The api now returns the canonical posts row (id == posts.id) plus a derived platform field and the owning social_id. Drop the junction post_id field; add platform and keep social_id.
The api PR converged on the single-helper selectPosts pattern with
per-post shape {id, post_url, updated_at} — same as the sibling
/api/artists/{id}/posts endpoint. Drop the platform + social_id
fields I briefly added.
The chat UI POSTs /api/chat to the api repo, which loads tools from its MCP server (lib/mcp/tools/ over there). No get_social_posts tool is registered there, and getMcpTools in this repo has no in-repo callers — so this tool definition never executes at runtime. Drop the dead file and its registration; the underscore on the unused accessToken param keeps lint happy until the function itself is cleaned up in a broader pass.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/tools/getMcpTools.ts">
<violation number="1" location="lib/tools/getMcpTools.ts:19">
P1: `getMcpTools` now ignores the access token and no longer exposes `get_social_posts`, which breaks the social-posts tool path instead of migrating it to the new authenticated endpoint.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| import getCatalogSongs from "./catalogs/getCatalogSongs"; | ||
|
|
||
| export function getMcpTools(): ToolSet { | ||
| export function getMcpTools(_accessToken: string): ToolSet { |
There was a problem hiding this comment.
P1: getMcpTools now ignores the access token and no longer exposes get_social_posts, which breaks the social-posts tool path instead of migrating it to the new authenticated endpoint.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/tools/getMcpTools.ts, line 19:
<comment>`getMcpTools` now ignores the access token and no longer exposes `get_social_posts`, which breaks the social-posts tool path instead of migrating it to the new authenticated endpoint.</comment>
<file context>
@@ -17,9 +16,8 @@ import filesTools from "./files";
import getCatalogSongs from "./catalogs/getCatalogSongs";
-export function getMcpTools(accessToken: string): ToolSet {
+export function getMcpTools(_accessToken: string): ToolSet {
const tools = {
- get_social_posts: getSocialPosts(accessToken),
</file context>
|
Closing — the chat-side |
Cut the
get_social_postsAI tool off the legacyapi.recoupable.com/api/social/postsURL and onto${getClientApiBaseUrl()}/api/socials/{social_id}/postswith a PrivyAuthorization: Bearerheader threaded throughgetMcpTools.Test plan
/api/socials/{id}/postslivetool()execute runs server-side, so the?api=<preview>override (browser-only viasessionStorage) does not reach this fetch. Smoke will run once the api PR merges totestand chat preview rebuilds againstrecoup-api.vercel.app/api/socials/{social_id}/postswithAuthorization: Bearer ...posts[].post_url,posts[].updated_at, andpagination.total_countrender unchanged via an agent prompt that chainsget_artist_socials→get_social_postsSummary by cubic
Removed the dead
get_social_poststool and the chat-hosted Posts docs so chat relies on the API MCP server for/api/socials/{id}/posts. This cleans up unused code and avoids drift with the canonical docs.lib/tools/getSocialPosts.tsand removed its registration fromgetMcpTools.getMcpToolsto accept_accessToken(unused placeholder)./docs/postspage and constants; canonical docs live in the Mintlify docs submodule.Written for commit 9961374. Summary will update on new commits.