@vue-skuilder/mcp 0.1.8-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +113 -0
- package/dist/examples/local-dev.d.cts +1 -0
- package/dist/examples/local-dev.d.ts +1 -0
- package/dist/examples/local-dev.js +1555 -0
- package/dist/examples/local-dev.js.map +1 -0
- package/dist/examples/local-dev.mjs +1554 -0
- package/dist/examples/local-dev.mjs.map +1 -0
- package/dist/index.d.cts +334 -0
- package/dist/index.d.ts +334 -0
- package/dist/index.js +1630 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1578 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +33 -0
- package/src/examples/index.ts +2 -0
- package/src/examples/local-dev.ts +49 -0
- package/src/index.ts +14 -0
- package/src/prompts/elo-scoring-guidance.ts +116 -0
- package/src/prompts/fill-in-card-authoring.ts +99 -0
- package/src/prompts/index.ts +9 -0
- package/src/resources/cards.ts +313 -0
- package/src/resources/course.ts +32 -0
- package/src/resources/index.ts +23 -0
- package/src/resources/shapes.ts +121 -0
- package/src/resources/tags.ts +277 -0
- package/src/server.ts +595 -0
- package/src/tools/create-card.ts +58 -0
- package/src/tools/delete-card.ts +85 -0
- package/src/tools/index.ts +13 -0
- package/src/tools/tag-card.ts +83 -0
- package/src/tools/update-card.ts +115 -0
- package/src/types/index.ts +33 -0
- package/src/types/resources.ts +20 -0
- package/src/types/tools.ts +74 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/pouchdb.ts +41 -0
- package/src/utils/tools.ts +32 -0
- package/tsconfig.json +16 -0
- package/tsup.config.ts +17 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/server.ts","../src/resources/course.ts","../src/resources/cards.ts","../src/utils/pouchdb.ts","../src/utils/tools.ts","../src/resources/shapes.ts","../src/resources/tags.ts","../src/resources/index.ts","../src/types/tools.ts","../src/tools/create-card.ts","../src/tools/update-card.ts","../src/tools/tag-card.ts","../src/tools/delete-card.ts","../src/tools/index.ts","../src/prompts/fill-in-card-authoring.ts","../src/prompts/elo-scoring-guidance.ts","../src/prompts/index.ts","../src/examples/local-dev.ts"],"sourcesContent":["export { MCPServer } from './server.js';\nexport type { MCPServerOptions } from './server.js';\n\n// Types\nexport * from './types/index.js';\n\n// Resources\nexport * from './resources/index.js';\n\n// Tools\nexport * from './tools/index.js';\n\n// Examples\nexport * from './examples/index.js';","import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';\nimport type { CourseDBInterface } from '@vue-skuilder/db';\nimport {\n handleCourseConfigResource,\n handleCardsAllResource,\n handleCardsTagResource,\n handleCardsShapeResource,\n handleCardsEloResource,\n handleShapesAllResource,\n handleShapeSpecificResource,\n handleTagsAllResource,\n handleTagsStatsResource,\n handleTagSpecificResource,\n handleTagsUnionResource,\n handleTagsIntersectResource,\n handleTagsExclusiveResource,\n handleTagsDistributionResource,\n RESOURCE_PATTERNS,\n} from './resources/index.js';\nimport {\n handleCreateCard,\n handleUpdateCard,\n handleTagCard,\n handleDeleteCard,\n TOOL_PATTERNS,\n} from './tools/index.js';\nimport {\n type CreateCardInput,\n type UpdateCardInput,\n type TagCardInput,\n type DeleteCardInput,\n} from './types/tools.js';\nimport { z } from 'zod';\nimport {\n createFillInCardAuthoringPrompt,\n createEloScoringGuidancePrompt,\n PROMPT_PATTERNS,\n} from './prompts/index.js';\n\nexport interface MCPServerOptions {\n enableSourceLinking?: boolean;\n maxCardsPerQuery?: number;\n allowedDataShapes?: string[];\n eloCalibrationMode?: 'strict' | 'adaptive' | 'manual';\n}\n\nexport class MCPServer {\n private mcpServer: McpServer;\n private transport?: Transport;\n\n constructor(\n private courseDB: CourseDBInterface,\n private readonly options: MCPServerOptions = {}\n ) {\n this.mcpServer = new McpServer({\n name: 'vue-skuilder-mcp',\n version: '0.1.0',\n });\n\n this.setupCapabilities();\n }\n\n private setupCapabilities(): void {\n // Register course://config resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.COURSE_CONFIG,\n RESOURCE_PATTERNS.COURSE_CONFIG,\n {\n title: 'Course Configuration',\n description: 'Course configuration with metadata and ELO statistics',\n mimeType: 'application/json',\n },\n async (uri) => {\n const result = await handleCourseConfigResource(this.courseDB);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register cards://all resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.CARDS_ALL,\n RESOURCE_PATTERNS.CARDS_ALL,\n {\n title: 'All Course Cards',\n description: 'List all cards in the course with pagination support',\n mimeType: 'application/json',\n },\n async (uri) => {\n const url = new URL(uri.href);\n const limit = parseInt(url.searchParams.get('limit') || '50', 10);\n const offset = parseInt(url.searchParams.get('offset') || '0', 10);\n\n const result = await handleCardsAllResource(this.courseDB, limit, offset);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register cards://tag/{tagName} resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.CARDS_TAG,\n new ResourceTemplate('cards://tag/{tagName}', { list: undefined }),\n {\n title: 'Cards by Tag',\n description: 'Filter cards by tag name with pagination support',\n mimeType: 'application/json',\n },\n async (uri, { tagName }) => {\n const url = new URL(uri.href);\n const limit = parseInt(url.searchParams.get('limit') || '50', 10);\n const offset = parseInt(url.searchParams.get('offset') || '0', 10);\n\n const result = await handleCardsTagResource(\n this.courseDB,\n tagName as string,\n limit,\n offset\n );\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register cards://shape/{shapeName} resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.CARDS_SHAPE,\n new ResourceTemplate('cards://shape/{shapeName}', { list: undefined }),\n {\n title: 'Cards by DataShape',\n description: 'Filter cards by DataShape with pagination support',\n mimeType: 'application/json',\n },\n async (uri, { shapeName }) => {\n const url = new URL(uri.href);\n const limit = parseInt(url.searchParams.get('limit') || '50', 10);\n const offset = parseInt(url.searchParams.get('offset') || '0', 10);\n\n const result = await handleCardsShapeResource(\n this.courseDB,\n shapeName as string,\n limit,\n offset\n );\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register cards://elo/{eloRange} resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.CARDS_ELO,\n new ResourceTemplate('cards://elo/{eloRange}', { list: undefined }),\n {\n title: 'Cards by ELO Range',\n description: 'Filter cards by ELO range (format: min-max, e.g., 1200-1800)',\n mimeType: 'application/json',\n },\n async (uri, { eloRange }) => {\n const url = new URL(uri.href);\n const limit = parseInt(url.searchParams.get('limit') || '50', 10);\n const offset = parseInt(url.searchParams.get('offset') || '0', 10);\n\n const result = await handleCardsEloResource(\n this.courseDB,\n eloRange as string,\n limit,\n offset\n );\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register shapes://all resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.SHAPES_ALL,\n RESOURCE_PATTERNS.SHAPES_ALL,\n {\n title: 'All DataShapes',\n description: 'List all available DataShapes in the course',\n mimeType: 'application/json',\n },\n async (uri) => {\n const result = await handleShapesAllResource(this.courseDB);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register shapes://{shapeName} resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.SHAPES_SPECIFIC,\n new ResourceTemplate('shapes://{shapeName}', { list: undefined }),\n {\n title: 'Specific DataShape',\n description: 'Get detailed information about a specific DataShape',\n mimeType: 'application/json',\n },\n async (uri, { shapeName }) => {\n const result = await handleShapeSpecificResource(this.courseDB, shapeName as string);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register tags://all resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.TAGS_ALL,\n RESOURCE_PATTERNS.TAGS_ALL,\n {\n title: 'All Tags',\n description: 'List all available tags in the course',\n mimeType: 'application/json',\n },\n async (uri) => {\n const result = await handleTagsAllResource(this.courseDB);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register tags://stats resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.TAGS_STATS,\n RESOURCE_PATTERNS.TAGS_STATS,\n {\n title: 'Tag Statistics',\n description: 'Get usage statistics for tags in the course',\n mimeType: 'application/json',\n },\n async (uri) => {\n const result = await handleTagsStatsResource(this.courseDB);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register tags://{tagName} resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.TAGS_SPECIFIC,\n new ResourceTemplate('tags://{tagName}', { list: undefined }),\n {\n title: 'Specific Tag',\n description: 'Get detailed information about a specific tag',\n mimeType: 'application/json',\n },\n async (uri, { tagName }) => {\n const result = await handleTagSpecificResource(this.courseDB, tagName as string);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register tags://union/{tags} resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.TAGS_UNION,\n new ResourceTemplate('tags://union/{tags}', { list: undefined }),\n {\n title: 'Tags Union',\n description: 'Find cards with ANY of the specified tags (format: tag1+tag2)',\n mimeType: 'application/json',\n },\n async (uri, { tags }) => {\n const result = await handleTagsUnionResource(this.courseDB, tags as string);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register tags://intersect/{tags} resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.TAGS_INTERSECT,\n new ResourceTemplate('tags://intersect/{tags}', { list: undefined }),\n {\n title: 'Tags Intersect',\n description: 'Find cards with ALL of the specified tags (format: tag1+tag2)',\n mimeType: 'application/json',\n },\n async (uri, { tags }) => {\n const result = await handleTagsIntersectResource(this.courseDB, tags as string);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register tags://exclusive/{tags} resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.TAGS_EXCLUSIVE,\n new ResourceTemplate('tags://exclusive/{tags}', { list: undefined }),\n {\n title: 'Tags Exclusive',\n description: 'Find cards with first tag but NOT second tag (format: tag1-tag2)',\n mimeType: 'application/json',\n },\n async (uri, { tags }) => {\n const result = await handleTagsExclusiveResource(this.courseDB, tags as string);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register tags://distribution resource\n this.mcpServer.registerResource(\n RESOURCE_PATTERNS.TAGS_DISTRIBUTION,\n RESOURCE_PATTERNS.TAGS_DISTRIBUTION,\n {\n title: 'Tag Distribution',\n description: 'Get frequency distribution of all tags in the course',\n mimeType: 'application/json',\n },\n async (uri) => {\n const result = await handleTagsDistributionResource(this.courseDB);\n return {\n contents: [\n {\n uri: uri.href,\n text: JSON.stringify(result, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n }\n );\n\n // Register create_card tool\n this.mcpServer.registerTool(\n TOOL_PATTERNS.CREATE_CARD,\n {\n title: 'Create Card',\n description: 'Create a new course card with specified datashape and content',\n inputSchema: {\n datashape: z.string(),\n data: z.any(),\n tags: z.array(z.string()).optional(),\n elo: z.number().optional(),\n sourceRef: z.string().optional(),\n },\n },\n async (input) => {\n const result = await handleCreateCard(this.courseDB, input as CreateCardInput);\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n );\n\n // Register update_card tool\n this.mcpServer.registerTool(\n TOOL_PATTERNS.UPDATE_CARD,\n {\n title: 'Update Card',\n description: 'Update an existing course card (data, tags, ELO, sourceRef)',\n inputSchema: {\n cardId: z.string(),\n data: z.any().optional(),\n tags: z.array(z.string()).optional(),\n elo: z.number().optional(),\n sourceRef: z.string().optional(),\n },\n },\n async (input) => {\n const result = await handleUpdateCard(this.courseDB, input as UpdateCardInput);\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n );\n\n // Register tag_card tool\n this.mcpServer.registerTool(\n TOOL_PATTERNS.TAG_CARD,\n {\n title: 'Tag Card',\n description: 'Add or remove tags from a course card with optional ELO update',\n inputSchema: {\n cardId: z.string(),\n action: z.enum(['add', 'remove']),\n tags: z.array(z.string()),\n updateELO: z.boolean().optional().default(false),\n },\n },\n async (input) => {\n const result = await handleTagCard(this.courseDB, input as TagCardInput);\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n );\n\n // Register delete_card tool\n this.mcpServer.registerTool(\n TOOL_PATTERNS.DELETE_CARD,\n {\n title: 'Delete Card',\n description: 'Safely delete a course card with confirmation requirement',\n inputSchema: {\n cardId: z.string(),\n confirm: z.boolean().default(false),\n reason: z.string().optional(),\n },\n },\n async (input) => {\n const result = await handleDeleteCard(this.courseDB, input as DeleteCardInput);\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n );\n\n // Register fill-in-card-authoring prompt\n this.mcpServer.registerPrompt(\n PROMPT_PATTERNS.FILL_IN_CARD_AUTHORING,\n {\n title: 'Author Fill-In Card',\n description:\n 'Generate a fill-in-the-blank or multiple-choice card using Vue-Skuilder syntax.',\n argsSchema: {},\n },\n () => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: createFillInCardAuthoringPrompt(),\n },\n },\n ],\n })\n );\n\n // Register elo-scoring-guidance prompt\n this.mcpServer.registerPrompt(\n PROMPT_PATTERNS.ELO_SCORING_GUIDANCE,\n {\n title: 'ELO Scoring Guidance',\n description: 'Guidance for assigning ELO difficulty ratings to flashcard content.',\n argsSchema: {},\n },\n () => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: createEloScoringGuidancePrompt(),\n },\n },\n ],\n })\n );\n\n // Use options to configure server capabilities\n if (this.options.enableSourceLinking) {\n // Will configure source linking when implemented\n }\n\n // Configuration ready for Phase 2 implementation\n }\n\n async start(transport: Transport): Promise<void> {\n this.transport = transport;\n await this.mcpServer.connect(transport);\n }\n\n async stop(): Promise<void> {\n if (this.transport) {\n await this.transport.close();\n }\n await this.mcpServer.close();\n }\n\n // Getter for accessing the underlying MCP server (for testing)\n get server(): McpServer {\n return this.mcpServer;\n }\n\n // Getter for accessing the course database\n get courseDatabase(): CourseDBInterface {\n return this.courseDB;\n }\n}\n","import { z } from 'zod';\nimport type { CourseDBInterface } from '@vue-skuilder/db';\nimport type { CourseResource } from '../types/resources.js';\n\nexport async function handleCourseConfigResource(\n courseDB: CourseDBInterface\n): Promise<CourseResource> {\n try {\n // Get course configuration\n const config = await courseDB.getCourseConfig();\n \n // TODO: Implement proper ELO distribution calculation\n // For now, provide basic structure\n const eloStats = {\n min: 1000,\n max: 2000,\n mean: 1500,\n distribution: [100, 200, 300, 250, 150] // Placeholder histogram\n };\n\n return {\n config,\n eloStats\n };\n } catch (error) {\n throw new Error(`Failed to load course config: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n// URI pattern validation\nexport const CourseConfigUriSchema = z.string().regex(/^course:\\/\\/config$/);\nexport type CourseConfigUri = z.infer<typeof CourseConfigUriSchema>;","import type { CourseDBInterface } from '@vue-skuilder/db';\nimport { z } from 'zod';\nimport { isSuccessRow } from '../utils/index.js';\n\n// Types for card resources\nexport interface CardResourceData {\n cardId: string;\n datashape: string;\n data: any;\n tags: string[];\n elo?: number;\n created?: string;\n modified?: string;\n}\n\nexport interface CardsCollection {\n cards: CardResourceData[];\n total: number;\n page?: number;\n limit?: number;\n filter?: string;\n}\n\n// Schema for ELO range parsing\nconst EloRangeSchema = z.object({\n min: z.number().min(0).max(5000),\n max: z.number().min(0).max(5000)\n}).refine(data => data.min <= data.max, {\n message: \"Min ELO must be less than or equal to max ELO\"\n});\n\n/**\n * Handle cards://all resource - List all cards in the course\n */\nexport async function handleCardsAllResource(\n courseDB: CourseDBInterface,\n limit: number = 50,\n offset: number = 0\n): Promise<CardsCollection> {\n try {\n // Get course info for total count\n const courseInfo = await courseDB.getCourseInfo();\n \n // Get cards using ELO-based query (this gives us all cards sorted by ELO)\n const cardIds = await courseDB.getCardsByELO(1500, limit + offset);\n \n // Skip offset cards and take limit\n const targetCardIds = cardIds.slice(offset, offset + limit);\n \n if (targetCardIds.length === 0) {\n return {\n cards: [],\n total: courseInfo.cardCount,\n page: Math.floor(offset / limit) + 1,\n limit,\n filter: 'all'\n };\n }\n\n // Get card documents\n const cardDocs = await courseDB.getCourseDocs(targetCardIds);\n \n // Get ELO data for these cards \n const eloData = await courseDB.getCardEloData(targetCardIds);\n const eloMap = new Map(eloData.map((elo, index) => [targetCardIds[index], elo.global?.score || 1500]));\n\n // Transform to CardResourceData format\n const cards: CardResourceData[] = [];\n for (const row of cardDocs.rows) {\n if (isSuccessRow(row)) {\n const doc = row.doc;\n cards.push({\n cardId: doc._id,\n datashape: (doc as any).shape?.name || 'unknown',\n data: (doc as any).data || {},\n tags: [], // Will be populated separately if needed\n elo: eloMap.get(doc._id),\n created: (doc as any).created,\n modified: (doc as any).modified\n });\n }\n }\n\n return {\n cards,\n total: courseInfo.cardCount,\n page: Math.floor(offset / limit) + 1,\n limit,\n filter: 'all'\n };\n\n } catch (error) {\n console.error('Error fetching all cards:', error);\n throw new Error(`Failed to fetch cards: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle cards://tag/[tagName] resource - Filter cards by tag\n */\nexport async function handleCardsTagResource(\n courseDB: CourseDBInterface,\n tagName: string,\n limit: number = 50,\n offset: number = 0\n): Promise<CardsCollection> {\n try {\n // Get the tag to validate it exists\n const tag = await courseDB.getTag(tagName);\n if (!tag) {\n throw new Error(`Tag not found: ${tagName}`);\n }\n\n // Note: The current CourseDBInterface doesn't have a direct method to get cards by tag\n // We would need to implement this by querying the tag associations\n // For now, we'll return a placeholder that explains this limitation\n \n return {\n cards: [],\n total: 0,\n page: Math.floor(offset / limit) + 1,\n limit,\n filter: `tag:${tagName}`,\n };\n\n } catch (error) {\n console.error(`Error fetching cards for tag ${tagName}:`, error);\n throw new Error(`Failed to fetch cards for tag ${tagName}: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle cards://shape/[shapeName] resource - Filter cards by DataShape\n */\nexport async function handleCardsShapeResource(\n courseDB: CourseDBInterface,\n shapeName: string,\n limit: number = 50,\n offset: number = 0\n): Promise<CardsCollection> {\n try {\n // Validate shape exists in course config\n const courseConfig = await courseDB.getCourseConfig();\n const validShapes = courseConfig.dataShapes.map(ds => ds.name);\n \n if (!validShapes.includes(shapeName)) {\n throw new Error(`DataShape not found: ${shapeName}. Available: ${validShapes.join(', ')}`);\n }\n\n // Note: Direct filtering by DataShape would require a more sophisticated query\n // For now, we'll get all cards and filter in memory (not optimal for large datasets)\n const allCardIds = await courseDB.getCardsByELO(1500, 1000); // Get more cards to filter from\n \n if (allCardIds.length === 0) {\n return {\n cards: [],\n total: 0,\n page: Math.floor(offset / limit) + 1,\n limit,\n filter: `shape:${shapeName}`\n };\n }\n\n // Get card documents to check their shapes\n const cardDocs = await courseDB.getCourseDocs(allCardIds);\n \n // Filter by shape and collect card IDs\n const filteredCardIds: string[] = [];\n const allFilteredRows: any[] = [];\n \n for (const row of cardDocs.rows) {\n if (isSuccessRow(row) && (row.doc as any).shape?.name === shapeName) {\n allFilteredRows.push(row);\n filteredCardIds.push(row.doc._id);\n }\n }\n \n // Apply pagination to filtered results\n const paginatedRows = allFilteredRows.slice(offset, offset + limit);\n const paginatedCardIds = paginatedRows.map(row => row.doc._id);\n\n // Get ELO data for paginated cards\n const eloData = await courseDB.getCardEloData(paginatedCardIds);\n const eloMap = new Map(eloData.map((elo, index) => [paginatedCardIds[index], elo.global?.score || 1500]));\n\n // Transform to CardResourceData format\n const cards: CardResourceData[] = [];\n for (const row of paginatedRows) {\n if (isSuccessRow(row)) {\n const doc = row.doc;\n cards.push({\n cardId: doc._id,\n datashape: (doc as any).shape?.name || 'unknown',\n data: (doc as any).data || {},\n tags: [],\n elo: eloMap.get(doc._id),\n created: (doc as any).created,\n modified: (doc as any).modified\n });\n }\n }\n\n // Count total filtered cards\n const totalFiltered = filteredCardIds.length;\n\n return {\n cards,\n total: totalFiltered,\n page: Math.floor(offset / limit) + 1,\n limit,\n filter: `shape:${shapeName}`\n };\n\n } catch (error) {\n console.error(`Error fetching cards for shape ${shapeName}:`, error);\n throw new Error(`Failed to fetch cards for shape ${shapeName}: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle cards://elo/[min]-[max] resource - Filter cards by ELO range\n */\nexport async function handleCardsEloResource(\n courseDB: CourseDBInterface,\n eloRange: string,\n limit: number = 50,\n offset: number = 0\n): Promise<CardsCollection> {\n try {\n // Parse ELO range (format: \"1200-1800\")\n const [minStr, maxStr] = eloRange.split('-');\n if (!minStr || !maxStr) {\n throw new Error(`Invalid ELO range format: ${eloRange}. Expected format: min-max (e.g., 1200-1800)`);\n }\n\n const parsedRange = EloRangeSchema.parse({\n min: parseInt(minStr, 10),\n max: parseInt(maxStr, 10)\n });\n\n // Get cards around the middle of the ELO range\n const targetElo = Math.floor((parsedRange.min + parsedRange.max) / 2);\n const cardIds = await courseDB.getCardsByELO(targetElo, 1000); // Get more to filter from\n \n if (cardIds.length === 0) {\n return {\n cards: [],\n total: 0,\n page: Math.floor(offset / limit) + 1,\n limit,\n filter: `elo:${eloRange}`\n };\n }\n\n // Get ELO data for all cards\n const eloData = await courseDB.getCardEloData(cardIds);\n \n // Filter by ELO range\n const filteredEloData = eloData\n .map((elo, index) => ({ elo, cardId: cardIds[index] }))\n .filter(({ elo }) => {\n const score = elo.global?.score || 1500;\n return score >= parsedRange.min && score <= parsedRange.max;\n });\n\n // Apply pagination\n const paginatedEloData = filteredEloData.slice(offset, offset + limit);\n const paginatedCardIds = paginatedEloData.map(({ cardId }) => cardId);\n\n if (paginatedCardIds.length === 0) {\n return {\n cards: [],\n total: filteredEloData.length,\n page: Math.floor(offset / limit) + 1,\n limit,\n filter: `elo:${eloRange}`\n };\n }\n\n // Get card documents\n const cardDocs = await courseDB.getCourseDocs(paginatedCardIds);\n const eloMap = new Map(paginatedEloData.map(({ elo, cardId }) => [cardId, elo.global?.score || 1500]));\n\n // Transform to CardResourceData format\n const cards: CardResourceData[] = [];\n for (const row of cardDocs.rows) {\n if (isSuccessRow(row)) {\n const doc = row.doc;\n cards.push({\n cardId: doc._id,\n datashape: (doc as any).shape?.name || 'unknown',\n data: (doc as any).data || {},\n tags: [],\n elo: eloMap.get(doc._id),\n created: (doc as any).created,\n modified: (doc as any).modified\n });\n }\n }\n\n return {\n cards,\n total: filteredEloData.length,\n page: Math.floor(offset / limit) + 1,\n limit,\n filter: `elo:${eloRange}`\n };\n\n } catch (error) {\n console.error(`Error fetching cards for ELO range ${eloRange}:`, error);\n throw new Error(`Failed to fetch cards for ELO range ${eloRange}: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}","/**\n * Type guard for successful PouchDB rows\n * Filters out error rows and ensures doc property exists\n */\nexport function isSuccessRow<T = any>(row: any): row is { doc: NonNullable<T>; id: string; key: string; value: any } {\n return row.doc != null && !('error' in row);\n}\n\n/**\n * Safely extracts documents from PouchDB AllDocsResponse\n * Returns only successful rows with valid documents\n */\nexport function extractSuccessfulDocs<T>(rows: any[]): T[] {\n const docs: T[] = [];\n for (const row of rows) {\n if (isSuccessRow(row)) {\n docs.push(row.doc);\n }\n }\n return docs;\n}\n\n/**\n * Safely filters and maps PouchDB rows with type safety\n */\nexport function filterAndMapDocs<T, R>(\n rows: any[],\n filterFn: (doc: T) => boolean,\n mapFn: (doc: T) => R\n): R[] {\n const results: R[] = [];\n for (const row of rows) {\n if (isSuccessRow(row)) {\n const doc = row.doc as T;\n if (filterFn(doc)) {\n results.push(mapFn(doc));\n }\n }\n }\n return results;\n}","import { z } from 'zod';\n\n// Shared constants\nexport const MCP_AGENT_AUTHOR = 'mcp-agent';\n\n// Common error handling utility\nexport function handleToolError(error: unknown, context: string): never {\n if (error instanceof z.ZodError) {\n throw new Error(`Invalid input: ${error.errors.map(e => e.message).join(', ')}`);\n }\n \n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error(`Error in ${context}:`, error);\n throw new Error(`${context} failed: ${message}`);\n}\n\n// Logging utilities\nexport function logToolStart(toolName: string, input: any): void {\n console.log(`[${toolName}] Starting with input:`, JSON.stringify(input, null, 2));\n}\n\nexport function logToolSuccess(toolName: string, result: any): void {\n console.log(`[${toolName}] Completed successfully:`, JSON.stringify(result, null, 2));\n}\n\nexport function logToolWarning(toolName: string, message: string, details?: any): void {\n console.warn(`[${toolName}] Warning: ${message}`, details || '');\n}\n\nexport function logToolError(toolName: string, message: string, error?: any): void {\n console.error(`[${toolName}] Error: ${message}`, error || '');\n}","import type { CourseDBInterface } from '@vue-skuilder/db';\nimport { isSuccessRow } from '../utils/index.js';\n\nexport interface ShapeResource {\n name: string;\n description?: string;\n fields: Array<{\n name: string;\n type: string;\n required?: boolean;\n description?: string;\n }>;\n category?: string;\n examples?: any[];\n}\n\nexport interface ShapesCollection {\n shapes: ShapeResource[];\n total: number;\n availableShapes: string[];\n}\n\n/**\n * Handle shapes://all resource - List all available DataShapes\n */\nexport async function handleShapesAllResource(\n courseDB: CourseDBInterface\n): Promise<ShapesCollection> {\n try {\n // Get course config to access DataShapes\n const courseConfig = await courseDB.getCourseConfig();\n const dataShapes = courseConfig.dataShapes || [];\n\n // Transform DataShapes to ShapeResource format\n const shapes: ShapeResource[] = dataShapes.map(shape => ({\n name: shape.name,\n description: `DataShape for ${shape.name} content type`,\n fields: (shape as any).fields?.map((field: any) => ({\n name: field.name,\n type: field.type || 'string',\n required: field.required || false,\n description: field.description || `Field for ${field.name}`\n })) || [],\n category: 'course-content',\n examples: [] // Could be populated with example cards\n }));\n\n const availableShapes = dataShapes.map(shape => shape.name);\n\n return {\n shapes,\n total: shapes.length,\n availableShapes\n };\n\n } catch (error) {\n console.error('Error fetching all shapes:', error);\n throw new Error(`Failed to fetch shapes: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle shapes://[shapeName] resource - Get specific DataShape definition\n */\nexport async function handleShapeSpecificResource(\n courseDB: CourseDBInterface,\n shapeName: string\n): Promise<ShapeResource> {\n try {\n // Get course config to access DataShapes\n const courseConfig = await courseDB.getCourseConfig();\n const dataShapes = courseConfig.dataShapes || [];\n\n // Find the specific shape\n const targetShape = dataShapes.find(shape => shape.name === shapeName);\n if (!targetShape) {\n const availableShapes = dataShapes.map(s => s.name);\n throw new Error(`DataShape not found: ${shapeName}. Available shapes: ${availableShapes.join(', ')}`);\n }\n\n // Get examples by finding cards that use this shape\n let examples: any[] = [];\n try {\n // Get a few cards that use this shape to provide examples\n const cardIds = await courseDB.getCardsByELO(1500, 10); // Get some sample cards\n if (cardIds.length > 0) {\n const cardDocs = await courseDB.getCourseDocs(cardIds.slice(0, 5)); // Limit to 5 examples\n examples = [];\n for (const row of cardDocs.rows) {\n if (isSuccessRow(row) && (row.doc as any).shape?.name === shapeName) {\n const data = (row.doc as any)?.data;\n if (data) {\n examples.push(data);\n if (examples.length >= 3) break; // Max 3 examples\n }\n }\n }\n }\n } catch (error) {\n console.warn('Could not fetch examples for shape:', error);\n // Continue without examples\n }\n\n return {\n name: targetShape.name,\n description: `DataShape definition for ${targetShape.name} content type`,\n fields: (targetShape as any).fields?.map((field: any) => ({\n name: field.name,\n type: field.type || 'string',\n required: field.required || false,\n description: field.description || `Field for ${field.name}`\n })) || [],\n category: 'course-content',\n examples\n };\n\n } catch (error) {\n console.error(`Error fetching shape ${shapeName}:`, error);\n throw new Error(`Failed to fetch shape ${shapeName}: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}","import type { CourseDBInterface } from '@vue-skuilder/db';\n\nexport interface TagResource {\n name: string;\n description?: string;\n cardCount: number;\n created?: string;\n author?: string;\n metadata?: any;\n}\n\nexport interface TagsCollection {\n tags: TagResource[];\n total: number;\n stats?: {\n totalTags: number;\n totalTaggedCards: number;\n averageTagsPerCard: number;\n mostUsedTags: { name: string; count: number }[];\n };\n}\n\nexport interface TagDistribution {\n tagName: string;\n frequency: number;\n percentage: number;\n cardIds: string[];\n}\n\n/**\n * Handle tags://all resource - List all available tags\n */\nexport async function handleTagsAllResource(\n courseDB: CourseDBInterface\n): Promise<TagsCollection> {\n try {\n // Get all tag stubs for the course\n const tagStubsResponse = await courseDB.getCourseTagStubs();\n const tagStubs = tagStubsResponse.rows || [];\n\n // Transform to TagResource format\n const tags: TagResource[] = [];\n for (const stub of tagStubs) {\n if (stub.doc) {\n // For each tag, we'd need to count associated cards\n // Note: Current CourseDBInterface doesn't have a direct method for this\n // This is a limitation we'll need to address\n tags.push({\n name: (stub.doc as any).name || stub.id,\n description: (stub.doc as any).snippet || `Tag: ${(stub.doc as any).name}`,\n cardCount: (stub.doc as any).taggedCards?.length || 0,\n created: (stub.doc as any).created,\n author: (stub.doc as any).author,\n metadata: (stub.doc as any).metadata\n });\n }\n }\n\n return {\n tags,\n total: tags.length,\n stats: {\n totalTags: tags.length,\n totalTaggedCards: 0, // Would need additional queries\n averageTagsPerCard: 0, // Would need calculation\n mostUsedTags: [] // Would need tag usage analysis\n }\n };\n\n } catch (error) {\n console.error('Error fetching all tags:', error);\n throw new Error(`Failed to fetch tags: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle tags://stats resource - Tag usage statistics\n */\nexport async function handleTagsStatsResource(\n courseDB: CourseDBInterface\n): Promise<TagsCollection['stats']> {\n try {\n // Get all tags\n const tagStubsResponse = await courseDB.getCourseTagStubs();\n const totalTags = tagStubsResponse.rows?.length || 0;\n\n // Get course info for context \n const courseInfo = await courseDB.getCourseInfo();\n console.log('Course info loaded for stats:', courseInfo.cardCount);\n\n // Note: Comprehensive tag statistics would require additional methods\n // in CourseDBInterface to efficiently query tag-card associations\n return {\n totalTags,\n totalTaggedCards: 0, // Placeholder\n averageTagsPerCard: 0, // Placeholder\n mostUsedTags: [] // Placeholder\n };\n\n } catch (error) {\n console.error('Error fetching tag stats:', error);\n throw new Error(`Failed to fetch tag statistics: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle tags://[tagName] resource - Specific tag details + card count\n */\nexport async function handleTagSpecificResource(\n courseDB: CourseDBInterface,\n tagName: string\n): Promise<TagResource> {\n try {\n // Get the specific tag\n const tag = await courseDB.getTag(tagName);\n if (!tag) {\n throw new Error(`Tag not found: ${tagName}`);\n }\n\n return {\n name: (tag as any).name || tagName,\n description: (tag as any).snippet || `Tag: ${tagName}`,\n cardCount: (tag as any).taggedCards?.length || 0,\n created: (tag as any).created,\n author: (tag as any).author,\n metadata: (tag as any).metadata\n };\n\n } catch (error) {\n console.error(`Error fetching tag ${tagName}:`, error);\n throw new Error(`Failed to fetch tag ${tagName}: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle tags://union/[tag1]+[tag2] resource - Cards with ANY of these tags\n */\nexport async function handleTagsUnionResource(\n courseDB: CourseDBInterface,\n tagsParam: string\n): Promise<{ cardIds: string[]; tags: string[]; operation: 'union' }> {\n try {\n const tags = tagsParam.split('+').map(tag => tag.trim());\n \n if (tags.length === 0) {\n throw new Error('No tags specified for union operation');\n }\n\n // Validate all tags exist\n for (const tagName of tags) {\n try {\n await courseDB.getTag(tagName);\n } catch {\n throw new Error(`Tag not found: ${tagName}`);\n }\n }\n\n // Note: Union operation would require specialized queries\n // Current CourseDBInterface doesn't provide tag-based card filtering\n return {\n cardIds: [], // Placeholder\n tags,\n operation: 'union'\n };\n\n } catch (error) {\n console.error(`Error performing tags union for ${tagsParam}:`, error);\n throw new Error(`Failed to perform tags union: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle tags://intersect/[tag1]+[tag2] resource - Cards with ALL these tags\n */\nexport async function handleTagsIntersectResource(\n courseDB: CourseDBInterface,\n tagsParam: string\n): Promise<{ cardIds: string[]; tags: string[]; operation: 'intersect' }> {\n try {\n const tags = tagsParam.split('+').map(tag => tag.trim());\n \n if (tags.length === 0) {\n throw new Error('No tags specified for intersect operation');\n }\n\n // Validate all tags exist\n for (const tagName of tags) {\n try {\n await courseDB.getTag(tagName);\n } catch {\n throw new Error(`Tag not found: ${tagName}`);\n }\n }\n\n // Note: Intersect operation would require specialized queries\n return {\n cardIds: [], // Placeholder\n tags,\n operation: 'intersect'\n };\n\n } catch (error) {\n console.error(`Error performing tags intersect for ${tagsParam}:`, error);\n throw new Error(`Failed to perform tags intersect: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle tags://exclusive/[tag1]-[tag2] resource - Cards with tag1 but NOT tag2\n */\nexport async function handleTagsExclusiveResource(\n courseDB: CourseDBInterface,\n tagsParam: string\n): Promise<{ cardIds: string[]; includeTag: string; excludeTag: string; operation: 'exclusive' }> {\n try {\n const [includeTag, excludeTag] = tagsParam.split('-').map(tag => tag.trim());\n \n if (!includeTag || !excludeTag) {\n throw new Error('Both include and exclude tags must be specified (format: tag1-tag2)');\n }\n\n // Validate both tags exist\n try {\n await courseDB.getTag(includeTag);\n await courseDB.getTag(excludeTag);\n } catch (error) {\n throw new Error(`One or both tags not found: ${includeTag}, ${excludeTag}`);\n }\n\n // Note: Exclusive operation would require specialized queries\n return {\n cardIds: [], // Placeholder\n includeTag,\n excludeTag,\n operation: 'exclusive'\n };\n\n } catch (error) {\n console.error(`Error performing tags exclusive for ${tagsParam}:`, error);\n throw new Error(`Failed to perform tags exclusive: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}\n\n/**\n * Handle tags://distribution resource - Tag frequency distribution\n */\nexport async function handleTagsDistributionResource(\n courseDB: CourseDBInterface\n): Promise<{ distribution: TagDistribution[]; totalTags: number; totalCards: number }> {\n try {\n // Get all tags\n const tagStubsResponse = await courseDB.getCourseTagStubs();\n const tags = tagStubsResponse.rows || [];\n \n // Get course info\n const courseInfo = await courseDB.getCourseInfo();\n\n // Note: Full distribution analysis would require additional queries\n // to map tags to cards and calculate frequencies\n const distribution: TagDistribution[] = tags.map(stub => ({\n tagName: stub.doc?.name || stub.id,\n frequency: 0, // Placeholder\n percentage: 0, // Placeholder\n cardIds: [] // Placeholder\n }));\n\n return {\n distribution,\n totalTags: tags.length,\n totalCards: courseInfo.cardCount\n };\n\n } catch (error) {\n console.error('Error calculating tag distribution:', error);\n throw new Error(`Failed to calculate tag distribution: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n}","// Resource registry and exports\nexport * from './course.js';\nexport * from './cards.js';\nexport * from './shapes.js';\nexport * from './tags.js';\n\n// Resource URI patterns\nexport const RESOURCE_PATTERNS = {\n COURSE_CONFIG: 'course://config',\n CARDS_ALL: 'cards://all',\n CARDS_TAG: 'cards://tag/{tagName}',\n CARDS_SHAPE: 'cards://shape/{shapeName}',\n CARDS_ELO: 'cards://elo/{eloRange}',\n SHAPES_ALL: 'shapes://all',\n SHAPES_SPECIFIC: 'shapes://{shapeName}',\n TAGS_ALL: 'tags://all',\n TAGS_STATS: 'tags://stats',\n TAGS_SPECIFIC: 'tags://{tagName}',\n TAGS_UNION: 'tags://union/{tags}',\n TAGS_INTERSECT: 'tags://intersect/{tags}',\n TAGS_EXCLUSIVE: 'tags://exclusive/{tags}',\n TAGS_DISTRIBUTION: 'tags://distribution',\n} as const;","import { z } from 'zod';\n\n// Tool input/output schemas - will be expanded in Phase 2\nexport const CreateCardInputSchema = z.object({\n datashape: z.string(),\n // individual datashapes define their own schema\n data: z.any(),\n tags: z.array(z.string()).optional(),\n elo: z.number().optional(),\n sourceRef: z.string().optional(),\n});\n\nexport type CreateCardInput = z.infer<typeof CreateCardInputSchema>;\n\nexport interface CreateCardOutput {\n cardId: string;\n initialElo: number;\n created: boolean;\n}\n\n// Update Card Tool\nexport const UpdateCardInputSchema = z.object({\n cardId: z.string(),\n data: z.any().optional(),\n tags: z.array(z.string()).optional(),\n elo: z.number().optional(),\n sourceRef: z.string().optional(),\n});\n\nexport type UpdateCardInput = z.infer<typeof UpdateCardInputSchema>;\n\nexport interface UpdateCardOutput {\n cardId: string;\n updated: boolean;\n changes: {\n data?: boolean;\n tags?: boolean;\n elo?: boolean;\n sourceRef?: boolean;\n };\n}\n\n// Tag Card Tool\nexport const TagCardInputSchema = z.object({\n cardId: z.string(),\n action: z.enum(['add', 'remove']),\n tags: z.array(z.string()),\n updateELO: z.boolean().optional().default(false),\n});\n\nexport type TagCardInput = z.infer<typeof TagCardInputSchema>;\n\nexport interface TagCardOutput {\n cardId: string;\n action: string;\n tagsProcessed: string[];\n success: boolean;\n currentTags: string[];\n}\n\n// Delete Card Tool \nexport const DeleteCardInputSchema = z.object({\n cardId: z.string(),\n confirm: z.boolean().default(false),\n reason: z.string().optional(),\n});\n\nexport type DeleteCardInput = z.infer<typeof DeleteCardInputSchema>;\n\nexport interface DeleteCardOutput {\n cardId: string;\n deleted: boolean;\n message: string;\n}\n","import type { CourseDBInterface } from '@vue-skuilder/db';\nimport { CreateCardInputSchema, type CreateCardInput, type CreateCardOutput } from '../types/tools.js';\nimport { toCourseElo } from '@vue-skuilder/common';\nimport { MCP_AGENT_AUTHOR, handleToolError, logToolStart, logToolSuccess, logToolWarning } from '../utils/index.js';\n\nexport async function handleCreateCard(\n courseDB: CourseDBInterface,\n input: CreateCardInput\n): Promise<CreateCardOutput> {\n const TOOL_NAME = 'create_card';\n \n try {\n // Validate input and log start\n const validatedInput = CreateCardInputSchema.parse(input);\n logToolStart(TOOL_NAME, validatedInput);\n \n // Get course config to validate datashape\n const courseConfig = await courseDB.getCourseConfig();\n const availableDataShapes = courseConfig.dataShapes.map(ds => ds.name);\n \n if (!availableDataShapes.includes(validatedInput.datashape)) {\n const errorMsg = `Invalid datashape: ${validatedInput.datashape}. Available: ${availableDataShapes.join(', ')}`;\n logToolWarning(TOOL_NAME, errorMsg);\n throw new Error(errorMsg);\n }\n \n // Create the card via courseDB\n const result = await courseDB.addNote(\n courseConfig.courseID!,\n { name: validatedInput.datashape as any, fields: [] },\n validatedInput.data,\n MCP_AGENT_AUTHOR,\n validatedInput.tags || [],\n undefined, // No uploads for now\n validatedInput.elo ? toCourseElo(validatedInput.elo) : undefined\n );\n \n if (result.status !== 'ok') {\n const errorMsg = `Failed to create card: ${result.message || 'Unknown error'}`;\n throw new Error(errorMsg);\n }\n \n // Extract initial ELO from result or use default\n const initialElo = validatedInput.elo || 1500;\n \n const output = {\n cardId: result.id || 'unknown',\n initialElo,\n created: true\n };\n \n logToolSuccess(TOOL_NAME, output);\n return output;\n \n } catch (error) {\n handleToolError(error, TOOL_NAME);\n }\n}","import type { CourseDBInterface } from '@vue-skuilder/db';\nimport { UpdateCardInputSchema, type UpdateCardInput, type UpdateCardOutput } from '../types/tools.js';\nimport { toCourseElo } from '@vue-skuilder/common';\nimport { MCP_AGENT_AUTHOR, handleToolError, logToolStart, logToolSuccess, logToolWarning } from '../utils/index.js';\n\nexport async function handleUpdateCard(\n courseDB: CourseDBInterface,\n input: UpdateCardInput\n): Promise<UpdateCardOutput> {\n const TOOL_NAME = 'update_card';\n \n try {\n // Validate input and log start\n const validatedInput = UpdateCardInputSchema.parse(input);\n logToolStart(TOOL_NAME, validatedInput);\n \n // Track what changes were made\n const changes = {\n data: false,\n tags: false,\n elo: false,\n sourceRef: false\n };\n\n // Verify the card exists\n try {\n await courseDB.getCourseDoc(validatedInput.cardId);\n } catch (error) {\n throw new Error(`Card not found: ${validatedInput.cardId}`);\n }\n\n // Update ELO if provided\n if (validatedInput.elo !== undefined) {\n try {\n const courseElo = toCourseElo(validatedInput.elo);\n await courseDB.updateCardElo(validatedInput.cardId, courseElo);\n changes.elo = true;\n } catch (error) {\n logToolWarning(TOOL_NAME, `Failed to update ELO for card ${validatedInput.cardId}`, error);\n throw new Error(`Failed to update ELO: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n }\n\n // Update tags if provided\n if (validatedInput.tags !== undefined) {\n try {\n // Get current tags to determine what needs to be added/removed\n const currentTagsResponse = await courseDB.getAppliedTags(validatedInput.cardId);\n const currentTagNames = currentTagsResponse.rows.map(row => row.doc?.name).filter(Boolean) as string[];\n \n const newTags = validatedInput.tags;\n const tagsToAdd = newTags.filter(tag => !currentTagNames.includes(tag));\n const tagsToRemove = currentTagNames.filter(tag => !newTags.includes(tag));\n\n // Add new tags\n for (const tagName of tagsToAdd) {\n try {\n // Check if tag exists, if not create it\n try {\n await courseDB.getTag(tagName);\n } catch {\n // Tag doesn't exist, create it\n await courseDB.createTag(tagName, MCP_AGENT_AUTHOR);\n }\n \n await courseDB.addTagToCard(validatedInput.cardId, tagName);\n } catch (error) {\n logToolWarning(TOOL_NAME, `Failed to add tag ${tagName} to card`, error);\n // Continue with other tags\n }\n }\n\n // Remove old tags\n for (const tagName of tagsToRemove) {\n try {\n await courseDB.removeTagFromCard(validatedInput.cardId, tagName);\n } catch (error) {\n logToolWarning(TOOL_NAME, `Failed to remove tag ${tagName} from card`, error);\n // Continue with other tags\n }\n }\n\n if (tagsToAdd.length > 0 || tagsToRemove.length > 0) {\n changes.tags = true;\n }\n } catch (error) {\n logToolWarning(TOOL_NAME, `Failed to update tags for card ${validatedInput.cardId}`, error);\n throw new Error(`Failed to update tags: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n }\n\n // Update data and sourceRef if provided\n // Note: CourseDBInterface doesn't have direct methods for updating card data\n // This would require more complex PouchDB operations\n if (validatedInput.data !== undefined || validatedInput.sourceRef !== undefined) {\n logToolWarning(TOOL_NAME, 'Data and sourceRef updates are not yet implemented - require direct PouchDB operations');\n // TODO: Implement direct document updates for data and sourceRef\n // For now, we'll skip these updates but note them in the response\n }\n\n const updated = changes.elo || changes.tags || changes.data || changes.sourceRef;\n\n const output = {\n cardId: validatedInput.cardId,\n updated,\n changes\n };\n \n logToolSuccess(TOOL_NAME, output);\n return output;\n\n } catch (error) {\n handleToolError(error, TOOL_NAME);\n }\n}","import type { CourseDBInterface } from '@vue-skuilder/db';\nimport { TagCardInputSchema, type TagCardInput, type TagCardOutput } from '../types/tools.js';\nimport { MCP_AGENT_AUTHOR, handleToolError, logToolStart, logToolSuccess, logToolWarning } from '../utils/index.js';\n\nexport async function handleTagCard(\n courseDB: CourseDBInterface,\n input: TagCardInput\n): Promise<TagCardOutput> {\n const TOOL_NAME = 'tag_card';\n \n try {\n // Validate input and log start\n const validatedInput = TagCardInputSchema.parse(input);\n logToolStart(TOOL_NAME, validatedInput);\n \n // Verify the card exists\n try {\n await courseDB.getCourseDoc(validatedInput.cardId);\n } catch (error) {\n throw new Error(`Card not found: ${validatedInput.cardId}`);\n }\n\n const tagsProcessed: string[] = [];\n let success = true;\n \n // Process each tag\n for (const tagName of validatedInput.tags) {\n try {\n if (validatedInput.action === 'add') {\n // Check if tag exists, if not create it\n try {\n await courseDB.getTag(tagName);\n } catch {\n // Tag doesn't exist, create it\n await courseDB.createTag(tagName, MCP_AGENT_AUTHOR);\n }\n \n // Add tag to card\n await courseDB.addTagToCard(\n validatedInput.cardId, \n tagName, \n validatedInput.updateELO\n );\n tagsProcessed.push(tagName);\n \n } else if (validatedInput.action === 'remove') {\n // Remove tag from card\n await courseDB.removeTagFromCard(validatedInput.cardId, tagName);\n tagsProcessed.push(tagName);\n }\n } catch (error) {\n logToolWarning(TOOL_NAME, `Failed to ${validatedInput.action} tag ${tagName}`, error);\n success = false;\n // Continue with other tags\n }\n }\n\n // Get current tags to return in response\n let currentTags: string[] = [];\n try {\n const currentTagsResponse = await courseDB.getAppliedTags(validatedInput.cardId);\n currentTags = currentTagsResponse.rows\n .map(row => row.doc?.name)\n .filter(Boolean) as string[];\n } catch (error) {\n logToolWarning(TOOL_NAME, 'Failed to fetch current tags', error);\n }\n\n const output = {\n cardId: validatedInput.cardId,\n action: validatedInput.action,\n tagsProcessed,\n success: success && tagsProcessed.length === validatedInput.tags.length,\n currentTags\n };\n \n logToolSuccess(TOOL_NAME, output);\n return output;\n\n } catch (error) {\n handleToolError(error, TOOL_NAME);\n }\n}","import type { CourseDBInterface } from '@vue-skuilder/db';\nimport { DeleteCardInputSchema, type DeleteCardInput, type DeleteCardOutput } from '../types/tools.js';\nimport { handleToolError, logToolStart, logToolSuccess, logToolWarning, logToolError } from '../utils/index.js';\n\nexport async function handleDeleteCard(\n courseDB: CourseDBInterface,\n input: DeleteCardInput\n): Promise<DeleteCardOutput> {\n const TOOL_NAME = 'delete_card';\n \n try {\n // Validate input and log start\n const validatedInput = DeleteCardInputSchema.parse(input);\n logToolStart(TOOL_NAME, validatedInput);\n \n // Safety check: require explicit confirmation\n if (!validatedInput.confirm) {\n return {\n cardId: validatedInput.cardId,\n deleted: false,\n message: 'Card deletion requires explicit confirmation. Set confirm: true to proceed.'\n };\n }\n\n // Verify the card exists before attempting deletion\n let cardExists = true;\n try {\n await courseDB.getCourseDoc(validatedInput.cardId);\n } catch (error) {\n cardExists = false;\n }\n\n if (!cardExists) {\n return {\n cardId: validatedInput.cardId,\n deleted: false,\n message: `Card not found: ${validatedInput.cardId}`\n };\n }\n\n // Get card information before deletion for logging\n let cardInfo = '';\n try {\n const cardDoc = await courseDB.getCourseDoc(validatedInput.cardId);\n const cardData = cardDoc as any;\n cardInfo = `Card: ${cardData.shape?.name || 'unknown shape'}`;\n } catch (error) {\n logToolWarning(TOOL_NAME, 'Could not fetch card info before deletion', error);\n }\n\n // Attempt to delete the card\n try {\n const result = await courseDB.removeCard(validatedInput.cardId);\n \n if (result.ok) {\n const reason = validatedInput.reason ? ` Reason: ${validatedInput.reason}` : '';\n const message = `Card successfully deleted. ${cardInfo}${reason}`;\n \n logToolSuccess(TOOL_NAME, `Card deleted: ${validatedInput.cardId}${reason}`);\n \n return {\n cardId: validatedInput.cardId,\n deleted: true,\n message\n };\n } else {\n return {\n cardId: validatedInput.cardId,\n deleted: false,\n message: `Failed to delete card: ${result.rev || 'Unknown error'}`\n };\n }\n } catch (error) {\n logToolError(TOOL_NAME, `Error deleting card ${validatedInput.cardId}`, error);\n return {\n cardId: validatedInput.cardId,\n deleted: false,\n message: `Failed to delete card: ${error instanceof Error ? error.message : 'Unknown error'}`\n };\n }\n\n } catch (error) {\n handleToolError(error, TOOL_NAME);\n }\n}","// Tools registry and exports\nexport * from './create-card.js';\nexport * from './update-card.js';\nexport * from './tag-card.js';\nexport * from './delete-card.js';\n\n// Tool patterns\nexport const TOOL_PATTERNS = {\n CREATE_CARD: 'create_card',\n UPDATE_CARD: 'update_card',\n TAG_CARD: 'tag_card',\n DELETE_CARD: 'delete_card',\n} as const;","/* eslint-disable max-len */\nexport function createFillInCardAuthoringPrompt(): string {\n return `# GUIDE: Authoring \"fillIn\" type Flashcards\n\nThis guide provides the technical specifications for authoring a \"fillIn\" type flashcard for the Vue-Skuilder platform. When you need to create a new card, you should use the 'create_card' tool and format the content as described below.\n\n## 1. Tool: 'create_card'\n\nYou should call the 'create_card' tool with the following parameters:\n\n- 'datashape': Must be 'fillIn'.\n- 'data': A markdown string containing the question and the interactive '{{...}}' elements.\n- 'tags': (Optional) An array of strings for tagging, e.g., ['go', 'concurrency'].\n- 'elo': (Optional) An integer representing the estimated difficulty (e.g., 1250).\n\n**IMPORTANT**: Do NOT include 'tags:' or 'elo:' information inside the 'data' string itself. These are tool parameters.\n\n## 2. Content Formatting ('data' parameter)\n\nThe 'data' string is composed of a question and special interactive elements using '{{...}}' syntax.\n\n### A. Simple Fill-in-the-Blank\n- For a single correct answer.\n- **Syntax**: '{{answer}}'\n- **Example**: 'The capital of France is {{Paris}}.'\n\n### B. Fill-in-the-Blank with Alternatives\n- For when multiple text inputs are acceptable for the same blank.\n- **Syntax**: '{{answer1|answer2}}'\n- **Example**: 'A common way to declare a variable in JavaScript that can be reassigned is using the {{let|var}} keyword.'\n\n### C. Multiple Choice\n- For presenting a question with several options.\n- **Syntax**: '{{correct_answer1|correct_answer2||distractor1|distractor2|distractor3|...}}'\n- **Details**:\n - List one or more correct answers first, separated by '|'.\n - Use a double pipe '||' to separate correct answers from distractors.\n - List one or more incorrect answers (distractors) after the '||', separated by '|'.\n - **Many distractors can be added** - the rendering layer will limit runtime display to a maximum of 5 rendered distractors.\n - **Front-load the most relevant distractors** - they will be weighted more favorably in selection.\n- **Example (Single Correct)**: 'What is the main gas found in the air we breathe? {{Nitrogen||Oxygen|Carbon Dioxide|Hydrogen}}'\n- **Example (Multiple Correct)**: 'Which of the following are primary colors? {{Red|Blue|Yellow||Green|Orange|Purple}}' (The system will pick one correct answer to display with the distractors).\n- **Example (Many Distractors)**: 'Which letter comes after M in the alphabet? {{N||O|L|P|Q|R|S|T|U|V|W|X|Y|Z|A|B|C|D|E|F|G|H|I|J|K}}' (Only 5 distractors will be shown, with O and L being most likely due to their position).\n\n### D. Overlapping Cards for Difficulty Scaling\n- **It is normal and advisable** to present the same content in overlapping cards with different distractor sets to scale difficulty.\n- **Progressive difficulty**: Start with dissimilar distractors, then increase similarity to make the question harder.\n- **Examples (Spelling/Phonics)**: Given an image of a car:\n - **Easy**: 'What word matches this image? {{car||airplane}}' (very different options)\n - **Medium**: 'What word matches this image? {{car||cat}}' (similar sounds)\n - **Hard**: 'What word matches this image? {{car||care}}' (very similar spelling)\n - **Harder**: 'What word matches this image? {{car||care|cat|far}}' (multiple similar options)\n- **Benefits**: This approach allows learners to build confidence with easier versions before tackling more challenging variants of the same concept.\n\n## 3. Best Practices & Tips\n\n- **Clarity is Key**: Ensure your questions are clear and the blanks/choices are unambiguous.\n- **Keep Answers Concise**: For fill-in-the-blanks, prefer short, specific answers (1-3 words is ideal). Long answers are hard for users to match. Use multiple-choice for more complex answers.\n- **Code in Questions**: You can and should use markdown code blocks in the question body for context.\n - **Example**:\n Given the code:\n \\`\\`\\`go\n func main() {\n x := 10\n fmt.Println(x)\n }\n \\`\\`\\`\n The above program will {{compile and run correctly||fail at compilation|fail at runtime}}.\n- **Code in Answers**: Code blocks ARE allowed inside the '{{...}}' syntax.\n - **Example**: '{{\\`go\\\\nfunc main() {\\\\n fmt.Println(\"Hello\")\\\\n}\\\\n\\`}}'\n- **CRITICAL**: Do NOT place the '{{...}}' syntax inside a markdown code block (e.g., \\`\\`\\` ... {{...}} ... \\`\\`\\`). The interactive element must be outside of any code fences.\n- **Review Syntax**: Carefully check your use of '|' and '||' in multiple-choice questions to avoid parsing errors.\n\n## 4. Example Agent Workflow\n\nThis is an example of how an agent might use this guide.\n\n**User Request:** \"Make a card about Go channels.\"\n\n**Agent's Thought Process:**\n1. I need to create a \"fillIn\" card about Go channels.\n2. A good multiple-choice question would be about the operator used to send a value to a channel.\n3. The question will be: \"In Go, what operator is used to send a value to a channel?\"\n4. The correct answer is '<-'. Some good distractors would be '->', '<<', and '>>'.\n5. The 'data' string for the tool call will be: 'In Go, what operator is used to send a value to a channel? {{<-||->|<<|>>}}'\n6. I'll tag it with 'go' and 'channels'.\n7. This is a fundamental concept, so I'll give it an ELO of 1100.\n8. Now I will call the 'create_card' tool with these parameters.\n\n**Resulting Tool Call:**\n<tool_code>\nprint(default_api.create_card(\n datashape='fillIn',\n data='In Go, what operator is used to send a value to a channel? {{<-||->|<<|>>}}',\n tags=['go', 'channels'],\n elo=1100\n))\n</tool_code>`;\n}\n","/* eslint-disable max-len */\nexport function createEloScoringGuidancePrompt(): string {\n return `# GUIDE: ELO Scoring for Content\n\nThis guide provides guidance for agents on assigning ELO ratings to content. The ELO system helps provide initial difficulty sorting for new content.\n\n## Understanding ELO Ratings\n\nELO ratings use a chess-like rating scale to indicate content difficulty:\n\n- **100-500**: Beginner level, basic knowledge\n- **500-1000**: Some knowledge, early understanding\n- **1000-1500**: Intermediate knowledge\n- **1500-2000**: Advanced understanding\n- **2000-2400**: Expert level\n- **2400+**: Elite/master level\n\n## Key Principles\n\n### 1. Rough Initial Sorting\n- Your ELO assignments provide **rough, sane sorting** of new content\n- Aim for reasonable relative difficulty between cards, not perfect precision\n- The system will refine these ratings over time based on real-world performance\n\n### 2. Automated Refinement\n- The platform performs **automated realtime adjustment** of ELO ratings based on actual user performance\n- This convergence forcing function holds **most of the responsibility** for arranging relative difficulty\n- Your initial ratings serve as a starting point, not the final word\n\n### 3. Content-Based Guidelines\n\n#### Basic Knowledge (100-500)\n- Simple facts and definitions\n- Basic vocabulary\n- Elementary concepts\n- **Example**: \"The capital of France is {{Paris}}\"\n\n#### Early Understanding (500-1000)\n- Simple applications of concepts\n- Basic problem-solving\n- Common patterns and rules\n- **Example**: \"In JavaScript, use {{let|var}} to declare a reassignable variable\"\n\n#### Intermediate Knowledge (1000-1500)\n- More complex applications\n- Understanding relationships between concepts\n- Moderate problem-solving skills\n- **Example**: \"Which sorting algorithm has O(n log n) average time complexity? {{mergesort|heapsort||bubblesort|insertionsort}}\"\n\n#### Advanced Understanding (1500-2000)\n- Complex problem-solving\n- Deep conceptual understanding\n- Advanced techniques and patterns\n- **Example**: \"In Go, what happens when you close a channel that's already closed? {{runtime panic||returns false|blocks forever|does nothing}}\"\n\n#### Expert Level (2000-2400)\n- Specialized knowledge\n- Advanced edge cases\n- Professional-level understanding\n- **Example**: \"What's the difference between TCP_NODELAY and TCP_CORK socket options?\"\n\n#### Elite/Master Level (2400+)\n- Cutting-edge knowledge\n- Rare edge cases\n- Research-level understanding\n- **Example**: \"How does the Linux kernel's CFS scheduler handle nice values in relation to vruntime calculations?\"\n\n## Practical Application\n\n### When Assigning ELO Ratings:\n\n1. **Consider the target audience**: Who would reasonably be expected to know this?\n2. **Assess cognitive load**: How much thinking/reasoning is required?\n3. **Evaluate prerequisite knowledge**: What must someone know first?\n4. **Compare relatively**: Is this harder or easier than other cards on similar topics?\n\n### Common Patterns:\n\n- **Definitions and facts**: Usually 100-800\n- **Basic syntax/usage**: Usually 400-1200\n- **Concept application**: Usually 800-1600\n- **Problem-solving**: Usually 1200-2000\n- **Advanced techniques**: Usually 1600-2400+\n\n## Establishing Goalposts for Agentic Runs\n\n### Reference Live Course Data\nWhen appending data to existing courses, try to use existing data to understand the baseline against which we create. ELO is relative and not absolute.\n\n1. **Query existing course statistics** using available MCP resources:\n - \\`course://config\\` - Get overall course ELO distribution\n - \\`tags://stats\\` - Understand tag usage patterns\n - \\`cards://elo/{range}\\` - Sample cards in different difficulty ranges\n\n2. **Establish relative ranges** based on existing content:\n - If the course has cards ranging 800-1600, aim for similar distribution\n - If creating beginner content for an advanced course, adjust baseline accordingly\n - Use tag-specific ELO patterns to inform ratings for similar topics\n\n### Example Goalpost Process\n\\`\\`\\`\n1. Query: cards://elo/1000-1500 (check intermediate range)\n2. Observe: 23 cards average 1250 ELO on \"javascript\" tag\n3. Target: New JavaScript cards should cluster around 1200-1300\n4. Create: Cards with relative difficulty within established range\n\\`\\`\\`\n\n## Remember\n\n- **It's okay to be approximate** - the system will adjust based on real performance\n- **Consistency matters more than perfection** - try to be consistent within topic areas\n- **Focus on relative difficulty** - how does this compare to other cards you've created? re: factual content - specialization matters - more esoteric knowledge should be rated higher\n- **Use live data as your anchor** - let existing course content guide your rating decisions\n\nYour ELO assignments provide the initial scaffolding that allows the platform's adaptive algorithms to efficiently converge on optimal difficulty ratings.`;\n}\n","// Prompts registry and exports\nexport * from './fill-in-card-authoring.js';\nexport * from './elo-scoring-guidance.js';\n\n// Prompt patterns\nexport const PROMPT_PATTERNS = {\n FILL_IN_CARD_AUTHORING: 'fill-in-card-authoring',\n ELO_SCORING_GUIDANCE: 'elo-scoring-guidance',\n} as const;\n","#!/usr/bin/env node\n\nimport { initializeDataLayer, getDataLayer } from '@vue-skuilder/db';\nimport { MCPServer } from '../server.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n\n// Hardcoded test course ID - Go Programming Language\nconst TEST_COURSE_ID = '2aeb8315ef78f3e89ca386992d00825b';\n\nasync function main() {\n try {\n console.error('Starting Vue-Skuilder MCP Server...');\n console.error(`Using test course: ${TEST_COURSE_ID}`);\n\n // Initialize data layer and get course DB\n await initializeDataLayer({\n options: {\n COUCHDB_PASSWORD: 'password',\n COUCHDB_USERNAME: 'admin',\n COUCHDB_SERVER_PROTOCOL: 'http',\n COUCHDB_SERVER_URL: 'localhost:5984',\n },\n type: 'couch',\n });\n\n const dataLayer = getDataLayer();\n await dataLayer.initialize();\n\n const courseDB = dataLayer.getCourseDB(TEST_COURSE_ID);\n\n // Create and start MCP server\n const server = new MCPServer(courseDB, {\n enableSourceLinking: true,\n maxCardsPerQuery: 50,\n });\n\n const transport = new StdioServerTransport();\n await server.start(transport);\n\n console.error('MCP Server started successfully!');\n console.error('Resources available: course://config');\n console.error('Tools available: create_card');\n } catch (error) {\n console.error('Failed to start MCP server:', error);\n process.exit(1);\n }\n}\n\nmain().catch(console.error);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAA4C;;;ACA5C,iBAAkB;AAIlB,eAAsB,2BACpB,UACyB;AACzB,MAAI;AAEF,UAAM,SAAS,MAAM,SAAS,gBAAgB;AAI9C,UAAM,WAAW;AAAA,MACf,KAAK;AAAA,MACL,KAAK;AAAA,MACL,MAAM;AAAA,MACN,cAAc,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG;AAAA;AAAA,IACxC;AAEA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,SAAS,OAA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