### Get Startup Advice from Multiple Perspectives Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md Use this example to query AI personas for advice on startup-related topics, simulating discussions between prominent figures. ```text "What's the most important thing for a first-time founder?" → Party Mode: Paul Graham + Sam Altman + Brian Chesky discuss ``` -------------------------------- ### JavaScript Example Template for Legends MCP Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md A template for creating executable JavaScript examples for the Legends MCP project. It includes a shebang, JSDoc for description and key concepts, and necessary imports for the SDK client. ```javascript #!/usr/bin/env node /** * Example: [Brief description] * * This example demonstrates: * 1. [Key concept 1] * 2. [Key concept 2] * 3. [Key concept 3] */ import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; // ... your implementation ... ``` -------------------------------- ### Combine Get Legend Context and Insight Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Demonstrates the optimal workflow for gathering both quick insights and comprehensive context using `get_legend_insight` and `get_legend_context`. Use this when starting new projects or initiatives requiring both speed and thoroughness. ```javascript // Phase 1: Quick insights (takes ~1-2 seconds) const insights = await getQuickInsights(legendId); // Phase 2: Comprehensive context (takes ~2-3 seconds) const context = await getComprehensiveContext(legendId); // Synthesize into action plan synthesizeActionPlan(insights, context); ``` -------------------------------- ### Optional SQLite Database Setup for Persona Indexing Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Sets up an optional SQLite database to index custom personas for advanced search capabilities when managing over 1000 personas. The database is stored locally and not synced externally. ```typescript // Optional: src/legends/db.ts import Database from 'better-sqlite3'; import { homedir } from 'os'; const db = new Database(join(homedir(), '.legends-mcp', 'cache.db')); // Index personas for fast search db.exec(` CREATE TABLE IF NOT EXISTS persona_index ( id TEXT PRIMARY KEY, name TEXT, tags TEXT, path TEXT ) `); ``` -------------------------------- ### Shared Persona Directory Structure for Multi-Tenancy Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Example of an extended directory structure for multi-user scenarios, allowing for shared team personas alongside private custom personas. Users can symlink shared directories to version-controlled locations. ```tree ~/.legends-mcp/ ├── custom/ # Personal personas (private) └── team/ # Shared personas (version controlled) └── company-values/ └── skill.yaml ``` -------------------------------- ### Get Legend Insight Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Use `get_legend_insight` for initial exploration before making deeper calls like `get_legend_context`. This approach helps in understanding the legend's capabilities efficiently. ```javascript // ✅ Good: Explore first const insight = await client.callTool({ name: 'get_legend_insight', arguments: { legend_id: 'paul-graham', topic: 'MVP' } }); // Then deep dive if relevant const context = await client.callTool({ name: 'get_legend_context', arguments: { legend_id: 'paul-graham', topic: 'MVP' } }); ``` -------------------------------- ### Summon a Specific Legend's Persona Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Use `summon_legend` to load a specific legend's full persona, which includes identity, voice, principles, patterns, anti-patterns, mental models, and examples. This is useful for adopting a legend's complete mindset. ```javascript const persona = await client.callTool({ name: 'summon_legend', arguments: { legend_id: 'paul-graham', }, }); ``` -------------------------------- ### Get Legend Context for a Topic Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Use `get_legend_context` to obtain comprehensive frameworks and mental models for a specific topic related to a legend. This is best for implementation planning and understanding complex decision patterns. ```javascript const context = await client.callTool({ name: 'get_legend_context', arguments: { legend_id: 'steve-jobs', topic: 'product design', }, }); ``` -------------------------------- ### Get Legend Insight for a Topic Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Use `get_legend_insight` to get quick, actionable advice and memorable quotes from a legend on a specific topic. This is ideal for brainstorming, rapid decisions, and communication. ```javascript const insight = await client.callTool({ name: 'get_legend_insight', arguments: { legend_id: 'elon-musk', topic: 'product-market fit', }, }); ``` -------------------------------- ### summon_legend Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Summons a specific legend's full persona for Claude to adopt. Returns complete persona data including identity, voice, principles, patterns, anti-patterns, mental models, and examples. ```APIDOC ## summon_legend ### Description Summons a specific legend's full persona for Claude to adopt. ### Method `client.callTool` ### Parameters #### Arguments - `name` (string) - Required - The name of the tool to call, which is 'summon_legend'. - `arguments` (object) - Required - An object containing the legend's ID. - `legend_id` (string) - Required - The unique identifier of the legend to summon. ### Response #### Success Response - `persona` (object) - Complete persona data including: - `identity` (object): `name`, `role`, `era` - `voice` (object): `tone`, `style`, `vocabulary` - `principles` (array of strings) - `patterns` (array of objects) - `anti-patterns` (array of objects) - `mental_models` (array of objects) - `examples` (object): `quotes`, `analogies`, `heuristics` ### Request Example ```javascript const persona = await client.callTool({ name: 'summon_legend', arguments: { legend_id: 'paul-graham', }, }); ``` ### Response Example ```json { "persona": { "identity": {"name": "Paul Graham", "role": "Entrepreneur", "era": "21st Century"}, "voice": {"tone": "Direct", "style": "Concise", "vocabulary": "Technical"}, "principles": ["Focus on making things", "Startups should be small"], "patterns": [{"name": "Lean Startup", "description": "Iterate quickly"}], "anti-patterns": [{"name": "Analysis Paralysis", "description": "Overthinking"}], "mental_models": [{"name": "Compounding", "description": "Small gains add up"}], "examples": {"quotes": ["Make something people want."], "analogies": [], "heuristics": []} } } ``` ``` -------------------------------- ### Smart Suggest Tool Usage Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md The `suggest()` tool analyzes user questions to provide ready-to-execute actions, including a primary action and a list of suggested actions. Claude then selects the best option for execution. ```javascript User: "How do I build a crypto exchange?" suggest() returns: ┌─────────────────────────────────────────────────┐ │ primary_action: { tool: "party_mode", params: { question: "How do I build a crypto exchange" legends: ["cz-binance", "brian-armstrong"] } } suggested_actions: [ { tool: "party_mode", ... }, { tool: "summon_legend", id: "cz-binance" }, { tool: "summon_legend", id: "brian-armstrong" { tool: "auto_match", ... } ] └─────────────────────────────────────────────────┘ Claude picks the best option and executes it! ``` -------------------------------- ### Persona CRUD Operations using File System Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Demonstrates basic Create, Read, Update, and Delete operations for custom personas using file system commands. Personas are stored as YAML files in the ~/.legends-mcp/custom directory. ```bash # Create mkdir -p ~/.legends-mcp/custom/my-mentor vi ~/.legends-mcp/custom/my-mentor/skill.yaml # Read (automatic via MCP tools) # list_legends includes all custom personas # Update vi ~/.legends-mcp/custom/my-mentor/skill.yaml # Delete rm -rf ~/.legends-mcp/custom/my-mentor ``` -------------------------------- ### Integrate and Test Custom Persona Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Demonstrates the end-to-end testing of a custom persona by creating a persona file and running the legends-mcp CLI to ensure it loads correctly. ```bash # Test custom persona end-to-end mkdir -p ~/.legends-mcp/custom/test-persona cat > ~/.legends-mcp/custom/test-persona/skill.yaml << EOF name: "Test Persona" tagline: "Test" category: custom EOF npx legends-mcp # Should load without errors ``` -------------------------------- ### Conflicting Advice Resolution with Decision Matrix Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Shows how to use an `AdviceComparison` class to handle conflicting advice from multiple legends by analyzing agreements, identifying conflicts, and building a decision matrix. Useful for strategic decisions where legends might disagree. ```javascript class AdviceComparison { analyze() { this.findConflicts(themes); // Where legends disagree this.findAgreements(themes); // Universal consensus this.buildDecisionMatrix(); // Weighted scoring } synthesizeRecommendation() { // Consensus → proceed with confidence // Disagreement → deeper analysis needed // Mixed signals → phased approach } } ``` -------------------------------- ### Handle Errors with Try-Catch Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Implement try-catch blocks to gracefully handle potential errors during tool calls. Includes specific recovery logic for common issues like 'not found' or 'context' errors. ```javascript try { const result = await client.callTool({ ... }); } catch (error) { console.error('❌ Error:', error.message); // Specific error recovery if (error.message.includes('not found')) { console.log('💡 Tip: Run list_legends to see available legends'); } else if (error.message.includes('context')) { console.log('💡 Recovery: Re-summon legend to restore persona'); } } ``` -------------------------------- ### Brainstorming Session Manager Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Illustrates a `BrainstormingSession` class for managing rapid iteration through multiple legend insights and synthesizing diverse viewpoints. Useful for tackling complex challenges that benefit from multiple perspectives. ```javascript class BrainstormingSession { constructor(topic) { this.topic = topic; this.rounds = []; this.insights = []; } addRound(legendId, legendName, insight) { // Tracks each legend's contribution } synthesizeIdeas() { // Groups insights by theme } } ``` -------------------------------- ### JavaScript Calls for Blockchain Discussions Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md This snippet shows how to initiate discussions on various blockchain topics using pre-defined crypto builder personas. It covers exchange architecture, DeFi security, and L1 performance. ```javascript // Exchange architecture with CZ await discussExchangeArchitecture(); // DeFi security with Andre Cronje await discussDeFiProtocol(); // L1 performance with Anatoly await discussL1Performance(); // Compare all approaches await compareBlockchainApproaches(); ``` -------------------------------- ### Environment Variables Configuration Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md Configuration options for Legends MCP using environment variables. Customize legend directory, current directory loading, and debug logging. ```bash LEGENDS_MCP_LEGENDS_DIR LEGENDS_MCP_ALLOW_CWD LEGENDS_MCP_DEBUG ``` -------------------------------- ### Compare Legends in Parallel Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Utilize `Promise.all` for parallel API calls when comparing multiple legends. This is significantly faster than sequential calls. ```javascript // ✅ Good: Parallel comparison (fast) const promises = ['elon-musk', 'steve-jobs', 'jeff-bezos'].map(id => client.callTool({ name: 'summon_legend', arguments: { legend_id: id } }) ); const legends = await Promise.all(promises); // ❌ Bad: Sequential (slow) for (const id of ['elon-musk', 'steve-jobs', 'jeff-bezos']) { const legend = await client.callTool({ ... }); } ``` -------------------------------- ### Deep Dive on Investing Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md This snippet demonstrates how to engage AI personas in debates on investment topics, presenting contrasting viewpoints. ```text "Should I invest in Bitcoin?" → Warren Buffett (skeptic) vs Balaji (bull) debate ``` -------------------------------- ### Parallel Tool Calls with summon_legend Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Use Promise.all to summon multiple legends simultaneously for improved performance. This is useful when you need to load several personas at once. ```javascript const promises = legends.map(id => client.callTool({ name: 'summon_legend', arguments: { legend_id: id } }) ); const results = await Promise.all(promises); ``` -------------------------------- ### Legends MCP Architecture Overview Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md Visual representation of the Legends MCP architecture, showing how user questions are processed through various legend tools and persona files to generate a response. ```text ┌─────────────────────────────────────────────────────────────┐ │ ARCHITECTURE │ ├─────────────────────────────────────────────────────────────┤ │ │ User Question │ │ │ ▼ │ ┌──────────────────┐ │ │ suggest() │ ← Analyzes question │ │ "Who can help?" │ │ └────────┬─────────┘ │ │ │ ▼ │ ┌──────────────────┐ ┌──────────────────┐ │ │ party_mode() │ OR │ summon_legend() │ │ │ (multi-legend) │ │ (single legend) │ │ └────────┬─────────┘ └────────┬─────────┘ │ │ │ │ ▼ ▼ │ ┌──────────────────────────────────────────────┐ │ │ legends/*.yaml │ │ │ (36 bundled persona files - NO API calls!) │ │ └──────────────────────────────────────────────┘ │ │ │ ▼ │ Claude adopts persona(s) and responds in character! │ └─────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Configure Legends MCP in Claude Code Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md This JSON configuration snippet is used to set up the 'legends-mcp' server within Claude Code's settings. It specifies the command and arguments needed to run the tool. ```json { "mcpServers": { "legends": { "command": "npx", "args": ["legends-mcp"] } } } ``` -------------------------------- ### List All Available Legends Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Use `list_legends` to retrieve an array of all available legends along with their metadata such as id, name, tagline, category, and tags. This tool requires no arguments. ```javascript const legends = await client.callTool({ name: 'list_legends', arguments: {}, }); ``` -------------------------------- ### Parallel Legend Summoning Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Demonstrates using `Promise.all` to efficiently summon multiple legends in parallel for comparison. This is a key component for the conflicting advice resolution use case. ```javascript const summonPromises = legendPerspectives.map(legend => client.callTool({ name: 'summon_legend', arguments: { legend_id: legend.id }, }) ); const results = await Promise.all(summonPromises); ``` -------------------------------- ### Persona Discovery and Loading Logic Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md TypeScript code snippet demonstrating how to modify the persona loader to scan both built-in and user-defined persona directories. It uses Node.js 'os' and 'path' modules to construct directory paths. ```typescript import { homedir } from 'os'; import { join } from 'path'; const BUILTIN_DIR = './legends'; const USER_DIR = join(homedir(), '.legends-mcp', 'custom'); export function loadAllLegends(): LegendSkill[] { const builtin = loadFromDirectory(BUILTIN_DIR); const custom = loadFromDirectory(USER_DIR); return [...builtin, ...custom]; } ``` -------------------------------- ### Persona Index File Structure Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Shows the structure of a JSON index file used for caching persona metadata. This file is built on first load to optimize subsequent access. ```json // ~/.legends-mcp/index.json { "my-mentor": { "name": "...", "path": "custom/my-mentor" } } ``` -------------------------------- ### Custom Persona Directory Structure Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Illustrates the recommended directory structure for organizing built-in and user-defined custom personas within Legends MCP. User personas are stored locally in the user's home directory to ensure privacy. ```tree legends-mcp/ ├── legends/ # Built-in personas (shipped with package) │ ├── elon-musk/ │ ├── warren-buffett/ │ └── ... └── ~/.legends-mcp/ # User's custom personas (local only) └── custom/ ├── my-mentor/ │ └── skill.yaml ├── company-founder/ │ └── skill.yaml └── ... ``` -------------------------------- ### Local-Only Data Flow Diagram Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Illustrates the local-only data flow within the Claude Code environment, emphasizing that no network boundaries are crossed and user data remains on the local machine. ```text ┌─────────────────────────────────────────────────┐ │ Claude Code (User's Machine) │ │ │ │ ┌──────────────┐ stdio ┌──────────┐ │ │ │ Claude AI │ ◄──────────────► │ legends │ │ │ │ │ │ -mcp │ │ │ └──────────────┘ └────┬─────┘ │ │ │ │ │ ▼ │ │ ┌────────────────┐ │ │ │ legends/ │ │ │ │ ~/.legends-mcp/│ │ │ └────────────────┘ │ └─────────────────────────────────────────────────┘ No network boundaries crossed ✓ No external APIs called ✓ User data stays local ✓ ``` -------------------------------- ### Maintain Session State Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Implement a `Session` class to track conversation history for multi-turn interactions, ensuring context is maintained across queries. ```javascript // ✅ Good: Track conversation history class Session { constructor(legend) { this.history = []; } addTurn(user, assistant) { this.history.push({ user, assistant }); } } // ❌ Bad: Stateless queries (loses context) await askQuestion1(); await askQuestion2(); // No memory of question 1 ``` -------------------------------- ### Unit Tests for Custom Persona Loading Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Tests the functionality of loading custom personas from the user directory and verifies that built-in personas take precedence over custom ones in case of conflicts. ```typescript describe('Custom Persona Loading', () => { it('loads custom personas from user directory', () => { const legends = loadAllLegends(); const custom = legends.filter(l => l.category === 'custom'); expect(custom.length).toBeGreaterThan(0); }); it('prioritizes built-in over custom for conflicts', () => { // If user has 'elon-musk' custom, built-in wins const elon = getLegend('elon-musk'); expect(elon.category).toBe('legends'); }); }); ``` -------------------------------- ### Technical Decisions Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md Simulate expert consultation for technical decisions by summoning AI personas with relevant expertise. ```text "How do I scale my database?" → Summon Jeff Bezos for Day 1 / SOA thinking ``` -------------------------------- ### Custom Fields in Persona YAML Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Illustrates how to include user-specific fields within a persona's YAML file. These fields, such as 'user_notes' and 'reminders', are preserved but ignored by built-in MCP tools. ```yaml name: "My Mentor" category: custom # Standard fields expertise: owns: ["Team building"] # User-specific fields (ignored by built-in tools) user_notes: | Last conversation: 2024-01-15 Topics discussed: Conflict resolution reminders: - "Ask about quarterly goals" - "Follow up on team feedback" ``` -------------------------------- ### Search Legends by Keywords Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Use `search_legends` to find legends based on keywords, categories, or expertise areas. This tool is useful for discovering legends with specific domain expertise. ```javascript const results = await client.callTool({ name: 'search_legends', arguments: { query: 'crypto blockchain DeFi', }, }); ``` -------------------------------- ### list_legends Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Lists all available legends with their metadata. Returns an array of legends, each containing id, name, tagline, category, and tags. ```APIDOC ## list_legends ### Description Lists all available legends with metadata. ### Method `client.callTool` ### Parameters #### Arguments - `name` (string) - Required - The name of the tool to call, which is 'list_legends'. - `arguments` (object) - Required - An empty object as this tool does not require any specific arguments. ### Response #### Success Response - `legends` (array) - An array of legend objects, each containing: - `id` (string) - `name` (string) - `tagline` (string) - `category` (string) - `tags` (array of strings) ### Request Example ```javascript const legends = await client.callTool({ name: 'list_legends', arguments: {}, }); ``` ### Response Example ```json { "legends": [ { "id": "example-legend-id", "name": "Example Legend", "tagline": "An example tagline.", "category": "Example Category", "tags": ["example", "tag"] } ] } ``` ``` -------------------------------- ### Validate Persona Consistency Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Verify that a legend's core principles remain consistent over time by comparing the original summoned state with a reloaded state. ```javascript // ✅ Good: Verify persona hasn't drifted const original = await summonLegend('paul-graham'); // ... many operations later ... const reloaded = await summonLegend('paul-graham'); const consistent = JSON.stringify(original.principles) === JSON.stringify(reloaded.principles); ``` -------------------------------- ### JavaScript Class for Session Management Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md This class manages conversation history and persona data for multi-turn interactions. It includes methods for adding exchanges and formatting history for prompts. ```javascript class LegendSession { constructor(legendId, personaData) { this.legendId = legendId; this.personaData = personaData; this.conversationHistory = []; this.startTime = new Date(); } addExchange(userMessage, assistantResponse) { this.conversationHistory.push({ turn: this.conversationHistory.length + 1, timestamp: new Date(), user: userMessage, assistant: assistantResponse, }); } formatHistoryForPrompt() { // Format conversation history for context } } ``` -------------------------------- ### YAML Schema for User-Defined Personas Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Defines the structure for a custom persona's skill.yaml file, including name, tagline, category, expertise, principles, and patterns. The 'category: custom' flag distinguishes user-defined personas. ```yaml # ~/.legends-mcp/custom/my-mentor/skill.yaml name: "My Mentor" tagline: "Leadership coach focused on team building" category: custom # Flag as user-defined expertise: owns: - "Leadership frameworks I've learned" - "Team management strategies" principles: - name: "Servant Leadership" description: "Lead by serving the team's needs" patterns: - name: "1-on-1 Framework" when: "Having individual check-ins" approach: "Ask open-ended questions, listen actively" ``` -------------------------------- ### Caching Persona Data Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Implement a cache to store summoned legends and avoid re-fetching. This can significantly reduce latency for repeated lookups of the same persona. ```javascript const personaCache = new Map(); if (!personaCache.has(legendId)) { const persona = await client.callTool({ ... }); personaCache.set(legendId, persona); } ``` -------------------------------- ### get_legend_context Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Retrieves comprehensive frameworks and mental models for a specific topic related to a legend. Returns deep context including principles, decision patterns, anti-patterns, mental models, and frameworks. ```APIDOC ## get_legend_context ### Description Get comprehensive frameworks and mental models for a specific topic. ### Method `client.callTool` ### Parameters #### Arguments - `name` (string) - Required - The name of the tool to call, which is 'get_legend_context'. - `arguments` (object) - Required - An object containing the legend's ID and the topic. - `legend_id` (string) - Required - The unique identifier of the legend. - `topic` (string) - Required - The specific topic for which to retrieve context. ### Response #### Success Response - `context` (object) - Deep context including: - `principles` (array of strings) - Principles relevant to the topic. - `decision_patterns` (array of objects) - When and how to apply decision patterns. - `anti_patterns` (array of objects) - Anti-patterns to avoid. - `mental_models` (array of objects) - Relevant mental models. - `frameworks` (array of objects) - Comprehensive frameworks. ### Request Example ```javascript const context = await client.callTool({ name: 'get_legend_context', arguments: { legend_id: 'steve-jobs', topic: 'product design', }, }); ``` ### Response Example ```json { "context": { "principles": ["Simplicity is the ultimate sophistication."], "decision_patterns": [{"name": "Focus on user experience", "approach": "Iterative design"}], "anti_patterns": [{"name": "Feature Creep", "description": "Adding too many features"}], "mental_models": [{"name": "Jobs's Law", "description": "Focus on a few key things"}], "frameworks": [{"name": "Design Thinking", "steps": ["Empathize", "Define", "Ideate", "Prototype", "Test"]}] } } ``` ``` -------------------------------- ### Life Advice Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md Obtain life advice from AI personas by posing questions about wealth building and personal development. ```text "How do I build wealth?" → Naval Ravikant on leverage, specific knowledge, equity ``` -------------------------------- ### On-Demand Persona Loading Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Implements lazy loading for individual personas by only loading a specific legend when its ID is requested. This is an optimization strategy for performance at scale. ```typescript export function getLegend(id: string): LegendSkill { return loadSingleLegend(id); // On-demand } ``` -------------------------------- ### search_legends Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Searches for legends by keywords, categories, or expertise areas. Returns an array of matching legends ranked by relevance. ```APIDOC ## search_legends ### Description Search for legends by keywords, categories, or expertise areas. ### Method `client.callTool` ### Parameters #### Arguments - `name` (string) - Required - The name of the tool to call, which is 'search_legends'. - `arguments` (object) - Required - An object containing the search query. - `query` (string) - Required - Keywords, categories, or expertise areas to search for. ### Response #### Success Response - `results` (array) - An array of matching legend objects, ranked by relevance. ### Request Example ```javascript const results = await client.callTool({ name: 'search_legends', arguments: { query: 'crypto blockchain DeFi', }, }); ``` ### Response Example ```json { "results": [ { "id": "vitalik-buterin", "name": "Vitalik Buterin", "tagline": "Co-founder of Ethereum.", "category": "Technology", "tags": ["crypto", "blockchain", "DeFi"] } ] } ``` ``` -------------------------------- ### Conditional Loading of Custom Personas Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md This TypeScript code snippet demonstrates how to conditionally load custom personas only if the user explicitly enables them via an environment variable. ```typescript // Only load custom personas if user opts in const customEnabled = process.env.LEGENDS_ENABLE_CUSTOM === 'true'; if (customEnabled) { legends.push(...loadCustomPersonas()); } ``` -------------------------------- ### Searching Legends Using Indexed Fields Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md A TypeScript function that searches through a loaded index of personas. It filters personas based on whether their name or tags include the search query, optimizing search performance. ```typescript function searchLegends(query: string): string[] { const index = loadIndex(); return index.filter(p => p.name.includes(query) || p.tags.includes(query) ); } ``` -------------------------------- ### get_legend_insight Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/examples/README.md Provides quick actionable advice and memorable quotes for a specific topic related to a legend. Returns wisdom including quotes, key frameworks, and topic-relevant principles. ```APIDOC ## get_legend_insight ### Description Get quick actionable advice and memorable quotes. ### Method `client.callTool` ### Parameters #### Arguments - `name` (string) - Required - The name of the tool to call, which is 'get_legend_insight'. - `arguments` (object) - Required - An object containing the legend's ID and the topic. - `legend_id` (string) - Required - The unique identifier of the legend. - `topic` (string) - Required - The specific topic for which to retrieve insight. ### Response #### Success Response - `insight` (object) - Quick wisdom including: - `quotes` (array of strings) - 3-5 actionable statements. - `key_frameworks` (array of objects) - Condensed versions of frameworks. - `principles` (array of strings) - Topic-relevant principles. ### Request Example ```javascript const insight = await client.callTool({ name: 'get_legend_insight', arguments: { legend_id: 'elon-musk', topic: 'product-market fit', }, }); ``` ### Response Example ```json { "insight": { "quotes": ["First principles thinking.", "Iterate rapidly."], "key_frameworks": [{"name": "First Principles", "description": "Break down problems to fundamental truths"}], "principles": ["Solve a real problem.", "Focus on the user."] } } ``` ``` -------------------------------- ### AI Persona Disclaimers Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/README.md Important disclaimers regarding the AI personas used in Legends MCP. Emphasizes that personas are for educational and entertainment purposes only and are not affiliated with real individuals. ```text ⚠️ NOT affiliated with, endorsed by, or representative of any real individual ⚠️ NOT financial, legal, or professional advice ⚠️ AI personas for EDUCATIONAL and ENTERTAINMENT purposes only ⚠️ Based on publicly available information, speeches, and writings ⚠️ Always do your own research (DYOR) ``` -------------------------------- ### Validate Persona YAML Input Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Sanitizes user-provided YAML to prevent code injection and validate required fields before processing. Throws an error if YAML contains functions or is missing 'name' or 'tagline'. ```typescript function validatePersona(yaml: any): LegendSkill { // Prevent code injection via YAML if (typeof yaml === 'function') { throw new Error('YAML cannot contain functions'); } // Validate required fields if (!yaml.name || !yaml.tagline) { throw new Error('Missing required fields'); } return yaml as LegendSkill; } ``` -------------------------------- ### Custom Persona Validation Schema Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Defines validation logic for custom personas in `scripts/validate-legends.js`. It allows for relaxed validation for 'custom' category personas, ensuring required fields are present while permitting user-specific fields. ```javascript const REQUIRED_FIELDS = ['name', 'tagline', 'category']; const OPTIONAL_FIELDS = ['expertise', 'principles', 'patterns', 'user_notes']; function validateCustomPersona(yaml) { // Allow user-specific fields without breaking validation if (yaml.category === 'custom') { // Relaxed validation for custom personas return validateRequired(yaml, REQUIRED_FIELDS); } return validateBuiltin(yaml); } ``` -------------------------------- ### Sanitize Legend ID Path Source: https://github.com/aytuncyildizli/legends-mcp/blob/main/ARCHITECTURE.md Ensures that a legend ID is safe for use in file paths by allowing only alphanumeric characters and hyphens. Prevents path traversal attacks. ```typescript function sanitizePath(legendId: string): string { // Only allow alphanumeric + hyphens if (!/^[a-z0-9-]+$/.test(legendId)) { throw new Error('Invalid legend ID'); } return legendId; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.