-
Notifications
You must be signed in to change notification settings - Fork 9
MCP - spotify_deep_research #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sweetmantech
merged 1 commit into
test
from
sweetmantech/myc-3735-mcp-spotify_deep_research
Dec 13, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
lib/mcp/tools/spotify/registerGetSpotifyDeepResearchTool.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; | ||
| import { z } from "zod"; | ||
| import { getArtistSocials } from "@/lib/artist/getArtistSocials"; | ||
| import { getToolResultSuccess } from "@/lib/mcp/getToolResultSuccess"; | ||
| import { getToolResultError } from "@/lib/mcp/getToolResultError"; | ||
|
|
||
| const SPOTIFY_DEEP_RESEARCH_REQUIREMENTS = ` | ||
| - popularity info (MANDATORY): | ||
| * Track popularity scores (0-100) for all tracks | ||
| * Average popularity across all tracks | ||
| * Most popular tracks ranked by popularity | ||
| * Popularity trends over time (if available) | ||
| - Spotify follower metrics (MANDATORY): | ||
| * Current total follower count for the artist on Spotify | ||
| - engagement info | ||
| - tracklist | ||
| - collaborators | ||
| - album art | ||
| - album name | ||
| `; | ||
|
|
||
| // Zod schema for the MCP tool - matches the original tool interface | ||
| const getSpotifyDeepResearchSchema = z.object({ | ||
| artist_account_id: z.string().min(1, "Artist account ID is required"), | ||
| }); | ||
|
|
||
| type GetSpotifyDeepResearchArgs = z.infer<typeof getSpotifyDeepResearchSchema>; | ||
|
|
||
| /** | ||
| * Registers the "spotify_deep_research" tool on the MCP server. | ||
| * Performs deep research on an artist using a Spotify ID. | ||
| * | ||
| * @param server - The MCP server instance to register the tool on. | ||
| */ | ||
| export function registerGetSpotifyDeepResearchTool(server: McpServer): void { | ||
| server.registerTool( | ||
| "spotify_deep_research", | ||
| { | ||
| description: `Performs deep research on an artist using a Spotify ID. | ||
|
|
||
| Required items in deep research document: | ||
| ${SPOTIFY_DEEP_RESEARCH_REQUIREMENTS}`, | ||
| inputSchema: getSpotifyDeepResearchSchema, | ||
| }, | ||
| async (args: GetSpotifyDeepResearchArgs) => { | ||
| try { | ||
| // Call getArtistSocials with default pagination (page 1, limit 20) | ||
| const result = await getArtistSocials({ | ||
| artist_account_id: args.artist_account_id, | ||
| page: 1, | ||
| limit: 20, | ||
| }); | ||
|
|
||
| if (result.status === "error") { | ||
| return getToolResultError(result.message || "Failed to fetch artist socials"); | ||
| } | ||
|
|
||
| // Format response to match the original tool's expected structure | ||
| const response = { | ||
| success: true, | ||
| artistSocials: { | ||
| socials: result.socials, | ||
| }, | ||
| artist_account_id: args.artist_account_id, | ||
| pagination: result.pagination, | ||
| }; | ||
|
|
||
| return getToolResultSuccess(response); | ||
| } catch (error) { | ||
| console.error("Error performing Spotify deep research:", error); | ||
| return getToolResultError( | ||
| error instanceof Error ? error.message : "Failed to perform Spotify deep research", | ||
| ); | ||
| } | ||
| }, | ||
| ); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.