Skip to content

Sweetmantech/myc 3741 mcp create segments#57

Merged
sweetmantech merged 1 commit intotestfrom
sweetmantech/myc-3741-mcp-create_segments
Dec 13, 2025
Merged

Sweetmantech/myc 3741 mcp create segments#57
sweetmantech merged 1 commit intotestfrom
sweetmantech/myc-3741-mcp-create_segments

Conversation

@sweetmantech
Copy link
Contributor

@sweetmantech sweetmantech commented Dec 13, 2025

Summary by CodeRabbit

Release Notes

  • New Features
    • Artist profile management: update artist details, including images, names, instructions, labels, and knowledge bases
    • Artist social media integration: manage and retrieve social profiles across multiple platforms
    • AI-powered fan segmentation for artists based on engagement data
    • Web search functionality powered by Perplexity
    • File storage to decentralized network with metadata support
    • Expanded Spotify tools: search, retrieve artist albums and top tracks, deep research capabilities
    • Video generation and retrieval tools
    • Enhanced task management system
    • Standardized tool response formatting for improved consistency

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

@vercel
Copy link
Contributor

vercel bot commented Dec 13, 2025

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

Project Deployment Review Updated (UTC)
recoup-api Ready Ready Preview Dec 13, 2025 8:59pm

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Caution

Review failed

Failed to post review comments

Walkthrough

This PR introduces comprehensive artist management capabilities and AI-powered features including artist profile and socials updates, knowledge base uploads, segment generation from fan data, Spotify integration, web search via Perplexity, TXT file generation with Arweave storage, and standardized MCP tool response formatting across multiple new tool registrations.

Changes

Cohort / File(s) Summary
AI Array Generation
lib/ai/generateArray.ts
New module exporting generateArray function that uses generateObject with a Zod schema to produce arrays of GenerateArrayResult objects containing segment names and fan lists.
Arweave Upload Utilities
lib/arweave/uploadTextToArweave.ts
New utility to upload text strings to Arweave as UTF-8 with MIME type "text/plain" and return ar:// prefixed URLs.
File Generation & Storage
lib/files/generateAndStoreTxtFile.ts
New module exporting GeneratedTxtResponse type and generateAndStoreTxtFile function that generates TXT files, uploads content and metadata to Arweave with non-fatal error handling, and returns base64-encoded data plus optional Arweave URLs.
Artist Profile & Socials Management
lib/artist/updateArtistProfile.ts, lib/artist/updateArtistSocials.ts, lib/artist/createKnowledgeBase.ts
New modules for updating artist profiles (name, image, instruction, label, knowledges with deduplication), managing social platform URLs (create/delete account-social associations), and uploading knowledge base text to Arweave with knowledge entry creation.
Artist Segments Retrieval
lib/artist/getArtistSegments.ts, lib/artist/mapArtistSegments.ts
Updated to import and use selectArtistSegmentsWithDetails instead of selectArtistSegments for retrieving segments with additional joined data.
MCP Tool Result Helpers
lib/mcp/getCallToolResult.ts, lib/mcp/getToolResultSuccess.ts, lib/mcp/getToolResultError.ts
New utility modules providing standardized MCP tool result formatting: CallToolResult type, getCallToolResult wrapper, and success/error response helpers.
Artist Socials MCP Tools
lib/mcp/tools/artistSocials/index.ts, lib/mcp/tools/artistSocials/registerGetArtistSocialsTool.ts, lib/mcp/tools/artistSocials/registerUpdateArtistSocialsTool.ts
New MCP tool registrations for getting and updating artist socials with platform mapping and error handling.
File Tools (Knowledge Base & TXT)
lib/mcp/tools/files/index.ts, lib/mcp/tools/files/registerCreateKnowledgeBaseTool.ts, lib/mcp/tools/files/registerGenerateTxtFileTool.ts
New MCP tool registrations for creating knowledge bases and generating TXT files with Arweave storage and user-friendly error messages.
Spotify MCP Tools
lib/mcp/tools/spotify/index.ts, lib/mcp/tools/spotify/registerGetSpotifySearchTool.ts, lib/mcp/tools/spotify/registerGetSpotifyArtistTopTracksTool.ts, lib/mcp/tools/spotify/registerGetSpotifyArtistAlbumsTool.ts, lib/mcp/tools/spotify/registerGetSpotifyAlbumTool.ts, lib/mcp/tools/spotify/registerGetSpotifyDeepResearchTool.ts
New module consolidating five Spotify API integration tools for search, artist top tracks, artist albums, album details, and deep artist research with access token generation and error handling.
Web Search MCP Tool
lib/mcp/tools/registerSearchWebTool.ts
New MCP tool registration for Perplexity-based web search with query, result limits, and country/domain filtering.
Segment Creation MCP Tool
lib/mcp/tools/registerCreateSegmentsTool.ts
New MCP tool registration for creating artist segments via orchestrated workflow including fan data retrieval and AI-powered naming.
Account Info & Local Time MCP Tools
lib/mcp/tools/registerUpdateAccountInfoTool.ts, lib/mcp/tools/registerGetLocalTimeTool.ts
New/updated MCP tools for updating artist profile info and retrieving local time with standardized result formatting.
Task Management MCP Tools
lib/mcp/tools/tasks/registerCreateTaskTool.ts, lib/mcp/tools/tasks/registerDeleteTaskTool.ts, lib/mcp/tools/tasks/registerGetTasksTool.ts, lib/mcp/tools/tasks/registerUpdateTaskTool.ts
Updated task tools to use standardized getToolResultSuccess helper for result formatting.
Catalog & Image MCP Tools
lib/mcp/tools/catalogs/registerGetCatalogsTool.ts, lib/mcp/tools/catalogs/registerGetCatalogSongsTool.ts, lib/mcp/tools/catalogs/registerInsertCatalogSongsTool.ts, lib/mcp/tools/images/registerEditImageTool.ts, lib/mcp/tools/images/registerGenerateImageTool.ts
Updated multiple tool registrations to use getToolResultSuccess for consistent response formatting.
Sora Video & Contact MCP Tools
lib/mcp/tools/sora2/registerGenerateVideoTool.ts, lib/mcp/tools/sora2/registerRetrieveVideoTool.ts, lib/mcp/tools/sora2/registerRetrieveVideoContentTool.ts, lib/mcp/tools/registerContactTeamTool.ts
Updated Sora video generation/retrieval and contact tools to use standardized result helpers.
MCP Tool Registration Index
lib/mcp/tools/index.ts
Refactored to use grouped tool registrations (registerAllSpotifyTools, registerAllFileTools, registerAllArtistSocialsTools) and add new registrations for search, segments, and account info tools.
Perplexity API Integration
lib/perplexity/config.ts, lib/perplexity/searchPerplexity.ts, lib/perplexity/formatSearchResultsAsMarkdown.ts
New modules providing Perplexity API configuration, web search functionality with typed params/results, and Markdown formatting utilities.
Segment Generation Workflow
lib/segments/consts.ts, lib/segments/generateSegments.ts, lib/segments/createSegments.ts, lib/segments/getAnalysisPrompt.ts, lib/segments/createSegmentResponses.ts, lib/segments/getFanSegmentsToInsert.ts
New modules implementing end-to-end segment creation pipeline: system/fan prompts, AI-powered segment generation, orchestrated creation flow with validation/error handling, prompt assembly, response formatting, and fan-segment association building.
Supabase Account Data Layer
lib/supabase/accounts/selectAccounts.ts, lib/supabase/accounts/updateAccount.ts, lib/supabase/account_info/selectAccountInfo.ts, lib/supabase/account_info/updateAccountInfo.ts, lib/supabase/account_socials/insertAccountSocial.ts, lib/supabase/account_socials/deleteAccountSocial.ts
New utilities for querying/updating accounts and account_info; inserting/deleting account-social associations.
Supabase Segments Data Layer
lib/supabase/segments/insertSegments.ts, lib/supabase/segments/deleteSegments.ts, lib/supabase/artist_segments/insertArtistSegments.ts, lib/supabase/artist_segments/selectArtistSegments.ts, lib/supabase/artist_segments/selectArtistSegmentsWithDetails.ts, lib/supabase/fan_segments/insertFanSegments.ts
New and updated segment-related data access layer: insert/delete segments, manage artist-segment and fan-segment associations, simplified/enhanced segment selection with optional detail joins.
Supabase Social Data Layer
lib/supabase/socials/insertSocials.ts, lib/supabase/socials/selectSocials.ts, lib/supabase/social_fans/selectSocialFans.ts
New utilities for inserting social records, querying socials with optional profile_url filtering, and selecting social-fan relationships with joined artist/fan social data and engagement comments.

Sequence Diagram

sequenceDiagram
    participant User as User/Client
    participant createSegs as createSegments()
    participant DB as Supabase
    participant AI as generateSegments()
    participant Model as LLM

    User->>createSegs: artistId, prompt
    createSegs->>DB: selectAccounts(artistId)
    DB-->>createSegs: account data
    alt artist not found
        createSegs-->>User: error response
    end
    
    createSegs->>DB: selectAccountSocials(artistId)
    DB-->>createSegs: social accounts
    alt no socials found
        createSegs-->>User: error + Instagram setup guidance
    end
    
    createSegs->>DB: selectSocialFans(socialIds)
    DB-->>createSegs: fan data
    alt no fans found
        createSegs-->>User: error + scraping guidance
    end
    
    createSegs->>AI: generateSegments(fans, prompt)
    AI->>Model: generateArray(system, analysisPrompt)
    Model-->>AI: segment names & fan lists
    AI-->>createSegs: GenerateArrayResult[]
    
    createSegs->>DB: deleteSegments(artistId)
    createSegs->>DB: insertSegments(segments)
    DB-->>createSegs: inserted segments
    createSegs->>DB: insertArtistSegments(associations)
    createSegs->>DB: insertFanSegments(fan-segment links)
    
    createSegs-->>User: success response + segments, mappings, details
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Multiple subsystems affected: New features span AI generation, artist management, Perplexity integration, segment workflows, MCP tools, and Supabase data layer
  • Heterogeneous changes: Mix of simple utility wrappers (upload helpers, result formatters), moderate orchestration logic (updateArtistProfile, createKnowledgeBase), and complex workflows (createSegments with multi-step validation and DB operations)
  • Large file count: 60+ files across disparate modules require context switching during review
  • Pattern repetition in MCP tools: Multiple similar tool registrations reduce per-file review burden but add overall volume
  • Error handling complexity: Many functions implement fallback behavior (non-fatal Arweave upload failures, detailed validation errors) requiring careful verification

Areas requiring extra attention:

  • lib/segments/createSegments.ts - complex orchestration with multiple DB operations, validation steps, and error paths
  • lib/mcp/tools/spotify/registerGetSpotifyDeepResearchTool.ts - flagged as High effort; verify artist social integration and error handling
  • lib/artist/updateArtistProfile.ts - knowledge deduplication logic and null/empty string handling for label field
  • lib/supabase/artist_segments/selectArtistSegments.ts vs selectArtistSegmentsWithDetails.ts - ensure the simplified version doesn't break existing callers expecting detailed data
  • Arweave upload error handling in lib/files/generateAndStoreTxtFile.ts - verify non-fatal failures are appropriate and metadata uploads don't silently fail

Possibly related PRs

  • PR #49: Adds and wires Spotify MCP tool registration (registerAllSpotifyTools and related modules), directly overlapping with Spotify integration in this PR
  • PR #32: Introduces registerGetArtistSocialsTool and tool registration orchestration patterns, related to artist-socials and MCP registration refactoring
  • PR #17: Modifies artist-segments retrieval (getArtistSegments, selectArtistSegmentsWithDetails), directly related to segment selection pattern changes

Poem

🐰 A rabbit hops through code so grand,
New segments spring from fan-built land,
With Spotify tunes and Arweave's grace,
Profile updates find their place.
AI whispers segment names so fine,
Web search weaves the digital line! 🌟

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title references a feature branch identifier (sweetmantech/myc-3741-mcp-create_segments) rather than clearly describing the primary change; it is vague about what was implemented. Consider renaming to a more descriptive title that highlights the main change, such as 'Add MCP tools for artist segment creation and management' or 'Implement segment generation workflow for artists'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sweetmantech/myc-3741-mcp-create_segments

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.

@sweetmantech sweetmantech changed the base branch from main to test December 13, 2025 20:59
@sweetmantech sweetmantech merged commit 96f1ed1 into test Dec 13, 2025
3 checks passed
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