Skip to content

Sweetmantech/myc 3651 migrate tool get artist socials#32

Merged
sweetmantech merged 14 commits intomainfrom
sweetmantech/myc-3651-migrate-tool-get_artist_socials
Dec 6, 2025
Merged

Sweetmantech/myc 3651 migrate tool get artist socials#32
sweetmantech merged 14 commits intomainfrom
sweetmantech/myc-3651-migrate-tool-get_artist_socials

Conversation

@sweetmantech
Copy link
Contributor

@sweetmantech sweetmantech commented Dec 6, 2025

Summary by CodeRabbit

  • New Features

    • Added a tool to retrieve an artist’s social links with pagination and standardized responses.
  • Chores

    • Consolidated multiple tool registrations into a single centralized registration call to simplify server setup.
    • Added a new SDK dependency to support MCP tooling.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Contributor

vercel bot commented Dec 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
recoup-api Ready Ready Preview Dec 6, 2025 5:05pm

@coderabbitai
Copy link

coderabbitai bot commented Dec 6, 2025

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between cdad59e and 5c4781b.

📒 Files selected for processing (3)
  • app/mcp/route.ts (2 hunks)
  • lib/mcp/tools/index.ts (1 hunks)
  • lib/mcp/tools/registerGetArtistSocialsTool.ts (1 hunks)

Walkthrough

Centralizes MCP tool registration by replacing multiple per-tool registrar calls with a single registerAllTools(server) call in the MCP route, adds a new get_artist_socials tool registrar, and adds @modelcontextprotocol/sdk to dependencies.

Changes

Cohort / File(s) Summary
Route handler refactoring
app/mcp/route.ts
Replaced individual tool registration calls with a single registerAllTools(server) call; updated imports to remove specific registrar imports and import registerAllTools.
Tool registration centralization
lib/mcp/tools/*, lib/mcp/tools/index.ts
Added registerAllTools(server: PaymentMcpServer) which invokes specific registrar helpers (e.g., registerGetRandomNumberTool, registerGetArtistSocialsTool) to register tools on the MCP server; exported publicly.
New artist socials tool
lib/mcp/tools/registerGetArtistSocialsTool.ts
Added registerGetArtistSocialsTool registering get_artist_socials with a zod input schema (artist_account_id, page, limit), defaults pagination (page=1, limit=20), calls getArtistSocials, and returns JSON-formatted success or error payloads.
Dependency update
package.json
Added dependency @modelcontextprotocol/sdk version ^1.24.3.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify app/mcp/route.ts imports/usage of registerAllTools and that no registrar was accidentally omitted.
  • Confirm lib/mcp/tools/index.ts calls the intended registrar functions and exports are correct.
  • Review registerGetArtistSocialsTool.ts for input schema correctness, default pagination, type assertions, and error handling.

Possibly related PRs

Poem

🐇 I hopped through lines of code tonight,
Gathered tools and made them tight.
I fetch artist socials, nice and neat,
One call to rule them — tidy and sweet.
🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: migrating the get_artist_socials tool by refactoring tool registration into a centralized registerAllTools function.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
lib/mcp/tools/registerGetArtistSocialsTool.ts (1)

30-34: Remove redundant default value handling.

The Zod schema already defines .default(1) for page and .default(20) for limit. The nullish coalescing operators on lines 32-33 are redundant since Zod will automatically apply these defaults when the values are undefined.

Apply this diff to simplify:

 const result = await getArtistSocials({
   artist_account_id: args.artist_account_id,
-  page: args.page ?? 1,
-  limit: args.limit ?? 20,
+  page: args.page,
+  limit: args.limit,
 });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 421e15d and 1dd8569.

📒 Files selected for processing (3)
  • app/mcp/route.ts (2 hunks)
  • lib/mcp/tools/index.ts (1 hunks)
  • lib/mcp/tools/registerGetArtistSocialsTool.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
lib/mcp/tools/index.ts (4)
lib/mcp/tools/registerGetRandomNumberTool.ts (1)
  • registerGetRandomNumberTool (10-28)
lib/mcp/tools/registerAddTool.ts (1)
  • registerAddTool (10-26)
lib/mcp/tools/registerHelloRemoteTool.ts (1)
  • registerHelloRemoteTool (10-24)
lib/mcp/tools/registerGetArtistSocialsTool.ts (1)
  • registerGetArtistSocialsTool (11-68)
lib/mcp/tools/registerGetArtistSocialsTool.ts (1)
lib/artist/getArtistSocials.ts (1)
  • getArtistSocials (27-87)
app/mcp/route.ts (1)
lib/mcp/tools/index.ts (1)
  • registerAllTools (13-18)
🔇 Additional comments (4)
lib/mcp/tools/registerGetArtistSocialsTool.ts (2)

1-10: LGTM! Clear documentation and appropriate imports.

The JSDoc clearly describes the tool's purpose and the imports are correct for the functionality.


19-28: The type annotations and parameter handling are correct as-is.

The code intentionally reflects actual runtime behavior due to x402-mcp type mismatches. Even though Zod 4 would make .optional().default() return non-optional values, the x402-mcp integration doesn't guarantee this applies. The developer correctly:

  • Cast types as z.ZodType<number | undefined> to match actual runtime possibility of undefined
  • Defined args parameters as optional (page?: number; limit?: number)
  • Used defensive nullish coalescing (args.page ?? 1, args.limit ?? 20) to handle both cases

The @ts-expect-error comments acknowledge these version mismatches. Changing the type annotations to suggest non-optional values would misrepresent runtime behavior and could mask bugs.

Likely an incorrect or invalid review comment.

lib/mcp/tools/index.ts (1)

1-18: LGTM! Excellent centralization pattern.

This centralized registration approach improves maintainability by providing a single entry point for all MCP tools. The structure is clean, well-documented, and makes it easy to add new tools in the future.

app/mcp/route.ts (1)

4-17: LGTM! Clean refactoring that improves maintainability.

The change from individual tool registrations to a centralized registerAllTools call simplifies this file and reduces coupling. The route handler no longer needs to know about each specific tool registration, which makes it easier to add or remove tools in the future.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
lib/mcp/tools/index.ts (1)

1-14: Centralized MCP tool registration is clean and extensible

This module does a good job of giving you a single, typed entrypoint (registerAllTools) with clear JSDoc and straightforward wiring to the individual tool registrars. It matches the PR goal of centralizing MCP tool registration and should make future additions easy (just add another call here).

If you expect this list to grow substantially, you could optionally switch to a small array of registrar functions and loop over them to avoid repetitive calls, but that’s not necessary at the current size.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1dd8569 and 5e89435.

📒 Files selected for processing (1)
  • lib/mcp/tools/index.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Vercel Agent Review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
lib/mcp/tools/registerGetArtistSocialsTool.ts (2)

21-24: Type assertions are incorrect for fields with defaults.

The type assertions as z.ZodType<number | undefined> contradict the runtime behavior. With .optional().default(), Zod guarantees these fields always have a value, so they should be typed as as z.ZodType<number>.

This issue was already flagged by vercel[bot] in previous review comments.


36-47: Remove extraneous success field.

The success: false field doesn't exist in the response structure from getArtistSocials. Error responses only include status: "error" and message.

This issue was already flagged by coderabbitai[bot] in previous review comments.

🧹 Nitpick comments (3)
lib/mcp/tools/registerGetArtistSocialsTool.ts (3)

31-31: Consider more descriptive content text.

The content field returns a generic "success" string. Consider making it more descriptive, such as including a summary of the results (e.g., "Retrieved X social profiles").


34-56: Redundant error handling.

The getArtistSocials function already has comprehensive internal error handling (as shown in the relevant code snippets) and never throws exceptions—it always returns a structured response with either status: "success" or status: "error". The outer try-catch is redundant and creates unnecessary error-handling layers.

Consider simplifying to:

-    try {
-      const result = await getArtistSocials(args);
-      return {
-        content: [{ type: "text", text: "success" }],
-        structuredContent: [{ type: "text", text: JSON.stringify(result) }],
-      };
-    } catch (error) {
-      console.error("Error fetching artist socials:", error);
-      const errorResult = {
-        success: false,
-        status: "error",
-        message: error instanceof Error ? error.message : "Failed to fetch artist socials",
-        socials: [],
-        pagination: {
-          total_count: 0,
-          page: 1,
-          limit: 20,
-          total_pages: 0,
-        },
-      };
-      return {
-        content: [
-          {
-            type: "text" as const,
-            text: JSON.stringify(errorResult),
-          },
-        ],
-      };
-    }
+    const result = await getArtistSocials(args);
+    return {
+      content: [{ type: "text", text: result.status === "success" ? "success" : "error" }],
+      structuredContent: [{ type: "text", text: JSON.stringify(result) }],
+    };

57-57: Address Biome syntax error on type assertion.

Biome's parser flags the type assertion as ToolCallback at the end of the async function as a syntax error. While TypeScript may accept this, it's clearer to avoid type assertions on function expressions in this position.

Consider one of these approaches:

Option 1: Remove the type assertion (if type inference works):

-    } as ToolCallback,
+    },

Option 2: Define the callback separately (if explicit typing is needed):

+  const callback: ToolCallback = async (args: ArtistSocialsQuery) => {
+    const result = await getArtistSocials(args);
+    return {
+      content: [{ type: "text", text: result.status === "success" ? "success" : "error" }],
+      structuredContent: [{ type: "text", text: JSON.stringify(result) }],
+    };
+  };
+
   server.registerTool(
     "get_artist_socials",
     { ... } as RegisteredTool,
-    async (args: ArtistSocialsQuery) => { ... } as ToolCallback,
+    callback,
   );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e89435 and fcc88df.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • lib/mcp/tools/registerGetArtistSocialsTool.ts (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
lib/mcp/tools/registerGetArtistSocialsTool.ts (2)
lib/artist/validateArtistSocialsQuery.ts (1)
  • ArtistSocialsQuery (21-21)
lib/artist/getArtistSocials.ts (1)
  • getArtistSocials (27-87)
🪛 Biome (2.1.2)
lib/mcp/tools/registerGetArtistSocialsTool.ts

[error] 57-57: expected , but instead found as

Remove as

(parse)


[error] 57-57: expected , but instead found ToolCallback

Remove ToolCallback

(parse)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Vercel Agent Review

@sweetmantech sweetmantech merged commit 710a6c4 into main Dec 6, 2025
3 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments