@epic-web/workshop-mcp 5.18.2 → 5.19.0
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/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/prompts.d.ts +13 -0
- package/dist/esm/prompts.d.ts.map +1 -0
- package/dist/esm/prompts.js +53 -0
- package/dist/esm/prompts.js.map +1 -0
- package/dist/esm/resources.d.ts +73 -0
- package/dist/esm/resources.d.ts.map +1 -0
- package/dist/esm/resources.js +375 -0
- package/dist/esm/resources.js.map +1 -0
- package/dist/esm/tools.d.ts +5 -0
- package/dist/esm/tools.d.ts.map +1 -0
- package/dist/esm/tools.js +218 -0
- package/dist/esm/tools.js.map +1 -0
- package/dist/esm/utils.d.ts +9 -0
- package/dist/esm/utils.d.ts.map +1 -0
- package/dist/esm/utils.js +19 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +8 -8
- package/dist/esm/cli.d.ts +0 -3
- package/dist/esm/cli.d.ts.map +0 -1
- package/dist/esm/cli.js +0 -400
- package/dist/esm/cli.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/resources.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EACN,sCAAsC,EACtC,eAAe,EACf,OAAO,EACP,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GACf,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAChE,OAAO,EACN,iBAAiB,EACjB,uBAAuB,GACvB,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAEN,gBAAgB,GA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AAW,EAAE,EACpD,KAAK,EAAE,IAAI,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QACjD,SAAS,CACR,OAAO,iBAAiB,KAAK,QAAQ,EACrC,wCAAwC,CACxC,CAAA;QACD,SAAS,CAAC,OAAO,IAAI,KAAK,QAAQ,EAAE,2BAA2B,CAAC,CAAA;QAChE,SAAS,CAAC,OAAO,IAAI,KAAK,QAAQ,EAAE,2BAA2B,CAAC,CAAA;QAChE,OAAO;YACN,QAAQ,EAAE;gBACT,MAAM,uBAAuB,CAAC,WAAW,CAAC;oBACzC,iBAAiB;oBACjB,IAAI;oBACJ,IAAI;iBACJ,CAAC;aACF;SACD,CAAA;IACF,CAAC,CACD,CAAA;IAED,MAAM,CAAC,QAAQ,CACd,gCAAgC,CAAC,IAAI,EACrC,gCAAgC,CAAC,WAAW,EAC5C,EAAE,WAAW,EAAE,gCAAgC,CAAC,WAAW,EAAE,EAC7D,KAAK,EAAE,IAAI,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE;QACrC,SAAS,CACR,OAAO,iBAAiB,KAAK,QAAQ,EACrC,wCAAwC,CACxC,CAAA;QACD,OAAO;YACN,QAAQ,EAAE;gBACT,MAAM,gCAAgC,CAAC,WAAW,CAAC;oBAClD,iBAAiB;iBACjB,CAAC;aACF;SACD,CAAA;IACF,CAAC,CACD,CAAA;AACF,CAAC","sourcesContent":["import path from 'node:path'\nimport { invariant } from '@epic-web/invariant'\nimport {\n\textractNumbersAndTypeFromAppNameOrPath,\n\tfindSolutionDir,\n\tgetApps,\n\tgetExercise,\n\tgetExercises,\n\tgetFullPathFromAppName,\n\tgetPlaygroundApp,\n\tisExerciseStepApp,\n\tisPlaygroundApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getAuthInfo } from '@epic-web/workshop-utils/db.server'\nimport {\n\tgetEpicVideoInfos,\n\tuserHasAccessToWorkshop,\n} from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\ttype McpServer,\n\tResourceTemplate,\n} from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { type ReadResourceResult } from '@modelcontextprotocol/sdk/types.js'\nimport { z } from 'zod'\nimport {\n\thandleWorkshopDirectory,\n\ttype InputSchemaType,\n\tsafeReadFile,\n} from './utils.js'\n\nexport const getWorkshopContextInputSchema = {\n\tworkshopDirectory: z\n\t\t.string()\n\t\t.describe(\n\t\t\t'The workshop directory (the root directory of the workshop repo.).',\n\t\t),\n}\n\nexport async function getWorkshopContext({\n\tworkshopDirectory,\n}: InputSchemaType<typeof getWorkshopContextInputSchema>) {\n\tconst workshopRoot = await handleWorkshopDirectory(workshopDirectory)\n\tconst inWorkshop = (...d: Array<string>) => path.join(workshopRoot, ...d)\n\tconst readInWorkshop = (...d: Array<string>) => safeReadFile(inWorkshop(...d))\n\n\tconst output = {\n\t\tmeta: {\n\t\t\t'README.md': await readInWorkshop('README.md'),\n\t\t\tconfig: (\n\t\t\t\tJSON.parse((await readInWorkshop('package.json')) || '{}') as any\n\t\t\t).epicshop,\n\t\t\tinstructions: await readInWorkshop('exercise', 'README.mdx'),\n\t\t\tfinishedInstructions: await readInWorkshop('exercise', 'FINISHED.mdx'),\n\t\t},\n\t\texercises: [] as Array<any>,\n\t}\n\n\tconst exercises = await getExercises()\n\tfor (const exercise of exercises) {\n\t\tconst exerciseInfo = {\n\t\t\tfullPath: exercise.fullPath,\n\t\t\texerciseNumber: exercise.exerciseNumber,\n\t\t\ttitle: exercise.title,\n\t\t\tinstructions: await safeReadFile(\n\t\t\t\tpath.join(exercise.fullPath, 'README.mdx'),\n\t\t\t),\n\t\t\tfinishedInstructions: await safeReadFile(\n\t\t\t\tpath.join(exercise.fullPath, 'FINISHED.mdx'),\n\t\t\t),\n\t\t\tsteps: exercise.steps.map((step) => {\n\t\t\t\treturn {\n\t\t\t\t\tstepNumber: step.stepNumber,\n\t\t\t\t\ttitle: step.problem?.title ?? step.solution?.title ?? null,\n\t\t\t\t\tproblem: step.problem\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tfullPath: step.problem.fullPath,\n\t\t\t\t\t\t\t\ttestConfig: step.problem.test,\n\t\t\t\t\t\t\t\tdevConfig: step.problem.dev,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: 'No problem app',\n\t\t\t\t\tsolution: step.solution\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tfullPath: step.solution.fullPath,\n\t\t\t\t\t\t\t\ttestConfig: step.solution.test,\n\t\t\t\t\t\t\t\tdevConfig: step.solution.dev,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: 'No solution app',\n\t\t\t\t}\n\t\t\t}),\n\t\t}\n\t\toutput.exercises.push(exerciseInfo)\n\t}\n\n\treturn output\n}\n\nconst workshopContextUriTemplate = new ResourceTemplate(\n\t'epicshop://{workshopDirectory}/workshop-context',\n\t{ list: undefined },\n)\n\nexport async function getWorkshopContextResource({\n\tworkshopDirectory,\n}: InputSchemaType<typeof getWorkshopContextInputSchema>): Promise<\n\tReadResourceResult['contents'][number]\n> {\n\treturn {\n\t\turi: workshopContextUriTemplate.uriTemplate.expand({\n\t\t\tworkshopDirectory,\n\t\t}),\n\t\tmimeType: 'application/json',\n\t\ttext: JSON.stringify(await getWorkshopContext({ workshopDirectory })),\n\t}\n}\n\nexport const workshopContextResource = {\n\tname: 'workshop_context',\n\tdescription: 'The context of the workshop',\n\turiTemplate: workshopContextUriTemplate,\n\tgetResource: getWorkshopContextResource,\n\tinputSchema: getWorkshopContextInputSchema,\n}\n\nconst getExerciseContextInputSchema = {\n\tworkshopDirectory: z\n\t\t.string()\n\t\t.describe(\n\t\t\t'The workshop directory (the root directory of the workshop repo.).',\n\t\t),\n\texerciseNumber: z.coerce\n\t\t.number()\n\t\t.optional()\n\t\t.describe(\n\t\t\t`The exercise number to get the context for (defaults to the exercise number the playground is currently set to)`,\n\t\t),\n}\n\nasync function getExerciseContext({\n\tworkshopDirectory,\n\texerciseNumber,\n}: {\n\tworkshopDirectory: string\n\texerciseNumber?: number\n}) {\n\tawait handleWorkshopDirectory(workshopDirectory)\n\tconst userHasAccess = await userHasAccessToWorkshop()\n\tconst authInfo = await getAuthInfo()\n\tlet stepNumber = 1\n\tconst playgroundApp = await getPlaygroundApp()\n\tinvariant(playgroundApp, 'No playground app found')\n\tconst numbers = extractNumbersAndTypeFromAppNameOrPath(playgroundApp.appName)\n\tconst isCurrentExercise =\n\t\texerciseNumber === undefined ||\n\t\texerciseNumber === Number(numbers?.exerciseNumber)\n\tif (exerciseNumber === undefined) {\n\t\tinvariant(numbers, 'No numbers found in playground app name')\n\t\texerciseNumber = Number(numbers.exerciseNumber)\n\t\tstepNumber = Number(numbers.stepNumber)\n\t}\n\tconst exercise = await getExercise(exerciseNumber)\n\tinvariant(exercise, `No exercise found for exercise number ${exerciseNumber}`)\n\n\tconst videoInfos = await getEpicVideoInfos([\n\t\t...(exercise.instructionsEpicVideoEmbeds ?? []),\n\t\t...exercise.steps.flatMap((s) => s.problem?.epicVideoEmbeds ?? []),\n\t\t...exercise.steps.flatMap((s) => s.solution?.epicVideoEmbeds ?? []),\n\t\t...(exercise.finishedEpicVideoEmbeds ?? []),\n\t])\n\n\tfunction getTranscripts(embeds?: Array<string>) {\n\t\tif (!embeds) return []\n\t\tif (!userHasAccess && embeds.length) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tmessage: `User must upgrade before they can get access to ${embeds.length} transcript${embeds.length === 1 ? '' : 's'}.`,\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\t\treturn embeds.map((embed) => {\n\t\t\tconst info = videoInfos[embed]\n\t\t\tif (info) {\n\t\t\t\tif (info.status === 'error') {\n\t\t\t\t\tif (info.type === 'region-restricted') {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tembed,\n\t\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\t\ttype: info.type,\n\t\t\t\t\t\t\trequestedCountry: info.requestCountry,\n\t\t\t\t\t\t\trestrictedCountry: info.restrictedCountry,\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tembed,\n\t\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\t\ttype: info.type,\n\t\t\t\t\t\t\tstatusCode: info.statusCode,\n\t\t\t\t\t\t\tstatusText: info.statusText,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tembed,\n\t\t\t\t\t\tstatus: 'success',\n\t\t\t\t\t\ttranscript: info.transcript,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tembed,\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\ttype: 'not-found',\n\t\t\t\t\tmessage: 'No transcript found',\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tasync function getFileContent(filePath: string) {\n\t\treturn {\n\t\t\tpath: filePath,\n\t\t\tcontent: (await safeReadFile(filePath)) ?? 'None found',\n\t\t}\n\t}\n\n\tconst context = {\n\t\tcurrentContext: {\n\t\t\tuser: {\n\t\t\t\thasAccess: userHasAccess,\n\t\t\t\tisAuthenticated: Boolean(authInfo),\n\t\t\t\temail: authInfo?.email,\n\t\t\t},\n\t\t\tplayground: isCurrentExercise\n\t\t\t\t? {\n\t\t\t\t\t\texerciseNumber,\n\t\t\t\t\t\tstepNumber,\n\t\t\t\t\t}\n\t\t\t\t: 'currently set to a different exercise',\n\t\t},\n\t\texerciseBackground: {\n\t\t\tnumber: exerciseNumber,\n\t\t\tintro: {\n\t\t\t\tcontent: await getFileContent(\n\t\t\t\t\tpath.join(exercise.fullPath, 'README.mdx'),\n\t\t\t\t),\n\t\t\t\ttranscripts: getTranscripts(exercise.instructionsEpicVideoEmbeds),\n\t\t\t},\n\t\t\toutro: {\n\t\t\t\tcontent: await getFileContent(\n\t\t\t\t\tpath.join(exercise.fullPath, 'FINISHED.mdx'),\n\t\t\t\t),\n\t\t\t\ttranscripts: getTranscripts(exercise.finishedEpicVideoEmbeds),\n\t\t\t},\n\t\t},\n\t\tsteps: exercise.steps\n\t\t\t? await Promise.all(\n\t\t\t\t\texercise.steps.map(async (app) => ({\n\t\t\t\t\t\tnumber: app.stepNumber,\n\t\t\t\t\t\tisCurrent: isCurrentExercise && app.stepNumber === stepNumber,\n\t\t\t\t\t\tproblem: {\n\t\t\t\t\t\t\tcontent: app.problem\n\t\t\t\t\t\t\t\t? await getFileContent(\n\t\t\t\t\t\t\t\t\t\tpath.join(app.problem.fullPath, 'README.mdx'),\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: 'No problem found',\n\t\t\t\t\t\t\ttranscripts: getTranscripts(app.problem?.epicVideoEmbeds),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsolution: {\n\t\t\t\t\t\t\tcontent: app.solution\n\t\t\t\t\t\t\t\t? await getFileContent(\n\t\t\t\t\t\t\t\t\t\tpath.join(app.solution.fullPath, 'README.mdx'),\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: 'No solution found',\n\t\t\t\t\t\t\ttranscripts: getTranscripts(app.solution?.epicVideoEmbeds),\n\t\t\t\t\t\t},\n\t\t\t\t\t})),\n\t\t\t\t)\n\t\t\t: [],\n\t\tnotes: [] as Array<string>,\n\t}\n\n\tif (exercise.steps) {\n\t\tif (isCurrentExercise) {\n\t\t\tcontext.notes.push(\n\t\t\t\t`Reminder, the current step is ${stepNumber} of ${exercise.steps.length + 1}. The most relevant information will be in the context above within the current step.`,\n\t\t\t)\n\t\t}\n\t} else {\n\t\tcontext.notes.push('Unusually, this exercise has no steps.')\n\t}\n\n\treturn context\n}\n\nconst exerciseContextUriTemplate = new ResourceTemplate(\n\t'epicshop://{workshopDirectory}/exercise/{exerciseNumber}',\n\t{ list: undefined },\n)\n\nasync function getExerciseContextResource({\n\tworkshopDirectory,\n\texerciseNumber,\n}: {\n\tworkshopDirectory: string\n\texerciseNumber?: number\n}): Promise<ReadResourceResult['contents'][number]> {\n\tconst context = await getExerciseContext({\n\t\tworkshopDirectory,\n\t\texerciseNumber,\n\t})\n\treturn {\n\t\turi: exerciseContextUriTemplate.uriTemplate.expand({\n\t\t\tworkshopDirectory,\n\t\t\texerciseNumber: String(context.exerciseBackground.number),\n\t\t}),\n\t\tmimeType: 'application/json',\n\t\ttext: JSON.stringify(context),\n\t}\n}\n\nexport const exerciseContextResource = {\n\tname: 'exercise_context',\n\tdescription: 'The context of the exercise',\n\turiTemplate: exerciseContextUriTemplate,\n\tgetResource: getExerciseContextResource,\n\tinputSchema: getExerciseContextInputSchema,\n}\n\nconst diffBetweenAppsInputSchema = {\n\tworkshopDirectory: z.string().describe('The workshop directory'),\n\tapp1: z.string().describe('The ID of the first app'),\n\tapp2: z.string().describe('The ID of the second app'),\n}\n\nasync function getDiffBetweenApps({\n\tworkshopDirectory,\n\tapp1,\n\tapp2,\n}: InputSchemaType<typeof diffBetweenAppsInputSchema>) {\n\tawait handleWorkshopDirectory(workshopDirectory)\n\n\tconst { getDiffOutputWithRelativePaths } = await import(\n\t\t'@epic-web/workshop-utils/diff.server'\n\t)\n\n\tconst app1Name = extractNumbersAndTypeFromAppNameOrPath(app1)\n\tconst app2Name = extractNumbersAndTypeFromAppNameOrPath(app2)\n\n\tconst apps = await getApps()\n\tconst app1App = apps\n\t\t.filter(isExerciseStepApp)\n\t\t.find(\n\t\t\t(a) =>\n\t\t\t\ta.exerciseNumber === Number(app1Name?.exerciseNumber) &&\n\t\t\t\ta.stepNumber === Number(app1Name?.stepNumber) &&\n\t\t\t\ta.type === app1Name?.type,\n\t\t)\n\tconst app2App = apps\n\t\t.filter(isExerciseStepApp)\n\t\t.find(\n\t\t\t(a) =>\n\t\t\t\ta.exerciseNumber === Number(app2Name?.exerciseNumber) &&\n\t\t\t\ta.stepNumber === Number(app2Name?.stepNumber) &&\n\t\t\t\ta.type === app2Name?.type,\n\t\t)\n\n\tinvariant(app1App, `No app found for ${app1}`)\n\tinvariant(app2App, `No app found for ${app2}`)\n\n\tconst diffCode = await getDiffOutputWithRelativePaths(app1App, app2App)\n\n\tif (!diffCode) return 'No changes'\n\n\treturn diffCode\n}\n\nasync function getDiffBetweenAppsResource({\n\tworkshopDirectory,\n\tapp1,\n\tapp2,\n}: InputSchemaType<typeof diffBetweenAppsInputSchema>): Promise<\n\tReadResourceResult['contents'][number]\n> {\n\treturn {\n\t\turi: diffBetweenAppsUriTemplate.uriTemplate.expand({\n\t\t\tworkshopDirectory,\n\t\t\tapp1,\n\t\t\tapp2,\n\t\t}),\n\t\tmimeType: 'application/json',\n\t\ttext: JSON.stringify(\n\t\t\tawait getDiffBetweenApps({ workshopDirectory, app1, app2 }),\n\t\t),\n\t}\n}\n\nconst diffBetweenAppsUriTemplate = new ResourceTemplate(\n\t'epicshop://{workshopDirectory}/diff-between-apps/{app1}__vs___{app2}',\n\t{ list: undefined },\n)\n\nexport const diffBetweenAppsResource = {\n\tname: 'diff_between_apps',\n\tdescription: 'The diff between two apps',\n\turiTemplate: diffBetweenAppsUriTemplate,\n\tgetResource: getDiffBetweenAppsResource,\n\tinputSchema: diffBetweenAppsInputSchema,\n}\n\nconst getExerciseStepProgressDiffInputSchema = {\n\tworkshopDirectory: z.string().describe('The workshop directory'),\n}\n\nasync function getExerciseStepProgressDiff({\n\tworkshopDirectory,\n}: InputSchemaType<typeof getExerciseStepProgressDiffInputSchema>) {\n\tawait handleWorkshopDirectory(workshopDirectory)\n\n\tconst { getDiffOutputWithRelativePaths } = await import(\n\t\t'@epic-web/workshop-utils/diff.server'\n\t)\n\n\tconst apps = await getApps()\n\tconst playgroundApp = apps.find(isPlaygroundApp)\n\n\tinvariant(playgroundApp, 'No playground app found')\n\n\tconst baseApp = playgroundApp\n\tconst solutionDir = await findSolutionDir({\n\t\tfullPath: await getFullPathFromAppName(playgroundApp.appName),\n\t})\n\tconst headApp = apps.find((a) => a.fullPath === solutionDir)\n\n\tinvariant(headApp, 'No playground solution app found')\n\n\tconst diffCode = await getDiffOutputWithRelativePaths(baseApp, headApp)\n\n\tif (!diffCode) return 'No changes'\n\n\treturn diffCode\n}\n\nasync function getExerciseStepProgressDiffResource({\n\tworkshopDirectory,\n}: InputSchemaType<typeof getExerciseStepProgressDiffInputSchema>): Promise<\n\tReadResourceResult['contents'][number]\n> {\n\treturn {\n\t\turi: exerciseStepProgressDiffUriTemplate.uriTemplate.expand({\n\t\t\tworkshopDirectory,\n\t\t}),\n\t\tmimeType: 'application/json',\n\t\ttext: JSON.stringify(\n\t\t\tawait getExerciseStepProgressDiff({ workshopDirectory }),\n\t\t),\n\t}\n}\n\nconst exerciseStepProgressDiffUriTemplate = new ResourceTemplate(\n\t'epicshop://{workshopDirectory}/exercise-step-progress-diff',\n\t{ list: undefined },\n)\n\nexport const exerciseStepProgressDiffResource = {\n\tname: 'exercise_step_progress_diff',\n\tdescription: 'The diff between the current exercise step and the solution',\n\turiTemplate: exerciseStepProgressDiffUriTemplate,\n\tgetResource: getExerciseStepProgressDiffResource,\n\tinputSchema: getExerciseStepProgressDiffInputSchema,\n}\n\nexport function initResources(server: McpServer) {\n\tserver.resource(\n\t\tworkshopContextResource.name,\n\t\tworkshopContextResource.uriTemplate,\n\t\t{ description: workshopContextResource.description },\n\t\tasync (_uri, { workshopDirectory }) => {\n\t\t\tinvariant(\n\t\t\t\ttypeof workshopDirectory === 'string',\n\t\t\t\t'A single workshopDirectory is required',\n\t\t\t)\n\t\t\tconst resource = await workshopContextResource.getResource({\n\t\t\t\tworkshopDirectory,\n\t\t\t})\n\t\t\treturn { contents: [resource] }\n\t\t},\n\t)\n\n\tserver.resource(\n\t\texerciseContextResource.name,\n\t\texerciseContextResource.uriTemplate,\n\t\t{ description: exerciseContextResource.description },\n\t\tasync (\n\t\t\t_uri,\n\t\t\t{ workshopDirectory, exerciseNumber: providedExerciseNumber },\n\t\t) => {\n\t\t\tinvariant(\n\t\t\t\ttypeof workshopDirectory === 'string',\n\t\t\t\t'A single workshopDirectory is required',\n\t\t\t)\n\t\t\tinvariant(\n\t\t\t\ttypeof providedExerciseNumber === 'string',\n\t\t\t\t'A single exerciseNumber is required',\n\t\t\t)\n\t\t\tconst exerciseNumber = Number(providedExerciseNumber)\n\t\t\tinvariant(!isNaN(exerciseNumber), 'exerciseNumber must be a number')\n\t\t\tinvariant(\n\t\t\t\texerciseNumber >= 0,\n\t\t\t\t'exerciseNumber must be greater than or equal to 0',\n\t\t\t)\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\tawait exerciseContextResource.getResource({\n\t\t\t\t\t\tworkshopDirectory,\n\t\t\t\t\t\texerciseNumber,\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t}\n\t\t},\n\t)\n\n\tserver.resource(\n\t\tdiffBetweenAppsResource.name,\n\t\tdiffBetweenAppsResource.uriTemplate,\n\t\t{ description: diffBetweenAppsResource.description },\n\t\tasync (_uri, { workshopDirectory, app1, app2 }) => {\n\t\t\tinvariant(\n\t\t\t\ttypeof workshopDirectory === 'string',\n\t\t\t\t'A single workshopDirectory is required',\n\t\t\t)\n\t\t\tinvariant(typeof app1 === 'string', 'A single app1 is required')\n\t\t\tinvariant(typeof app2 === 'string', 'A single app2 is required')\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\tawait diffBetweenAppsResource.getResource({\n\t\t\t\t\t\tworkshopDirectory,\n\t\t\t\t\t\tapp1,\n\t\t\t\t\t\tapp2,\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t}\n\t\t},\n\t)\n\n\tserver.resource(\n\t\texerciseStepProgressDiffResource.name,\n\t\texerciseStepProgressDiffResource.uriTemplate,\n\t\t{ description: exerciseStepProgressDiffResource.description },\n\t\tasync (_uri, { workshopDirectory }) => {\n\t\t\tinvariant(\n\t\t\t\ttypeof workshopDirectory === 'string',\n\t\t\t\t'A single workshopDirectory is required',\n\t\t\t)\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\tawait exerciseStepProgressDiffResource.getResource({\n\t\t\t\t\t\tworkshopDirectory,\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t}\n\t\t},\n\t)\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
export declare function initTools(server: McpServer): void;
|
|
3
|
+
export declare function initResourceTools(server: McpServer): void;
|
|
4
|
+
export declare function initPromptTools(server: McpServer): void;
|
|
5
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAexE,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,QAiG1C;AAKD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QAgHlD;AAGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QAuBhD"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { invariant } from '@epic-web/invariant';
|
|
2
|
+
import { getApps, getPlaygroundAppName, isExerciseStepApp, isProblemApp, setPlayground, } from '@epic-web/workshop-utils/apps.server';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { quizMe, quizMeInputSchema } from './prompts.js';
|
|
5
|
+
import { exerciseContextResource, workshopContextResource, diffBetweenAppsResource, exerciseStepProgressDiffResource, } from './resources.js';
|
|
6
|
+
import { handleWorkshopDirectory } from './utils.js';
|
|
7
|
+
// not enough support for this yet
|
|
8
|
+
const clientSupportsEmbeddedResources = false;
|
|
9
|
+
export function initTools(server) {
|
|
10
|
+
server.tool('set_playground', `
|
|
11
|
+
Sets the playground environment so the user can continue to that exercise or see
|
|
12
|
+
what that step looks like in their playground environment.
|
|
13
|
+
|
|
14
|
+
NOTE: this will override their current exercise step work in the playground!
|
|
15
|
+
|
|
16
|
+
Generally, it is better to not provide an exerciseNumber, stepNumber, and type
|
|
17
|
+
and let the user continue to the next exercise. Only provide these arguments if
|
|
18
|
+
the user explicitely asks to go to a specific exercise or step. If the user asks
|
|
19
|
+
to start an exercise, specify stepNumber 1 and type 'problem' unless otherwise
|
|
20
|
+
directed.
|
|
21
|
+
|
|
22
|
+
Argument examples:
|
|
23
|
+
A. Set to next exercise step from current (or first if there is none) - Most common
|
|
24
|
+
- [No arguments]
|
|
25
|
+
B. Set to a specific exercise step
|
|
26
|
+
- exerciseNumber: 1
|
|
27
|
+
- stepNumber: 1
|
|
28
|
+
- type: 'solution'
|
|
29
|
+
C. Set to the solution of the current exercise step
|
|
30
|
+
- type: 'solution'
|
|
31
|
+
D. Set to the second step problem of the current exercise
|
|
32
|
+
- stepNumber: 2
|
|
33
|
+
E. Set to the first step problem of the fifth exercise
|
|
34
|
+
- exerciseNumber: 5
|
|
35
|
+
|
|
36
|
+
An error will be returned if no app is found for the given arguments.
|
|
37
|
+
`.trim(), {
|
|
38
|
+
workshopDirectory: z.string().describe('The workshop directory'),
|
|
39
|
+
exerciseNumber: z.coerce
|
|
40
|
+
.number()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('The exercise number to set the playground to'),
|
|
43
|
+
stepNumber: z.coerce
|
|
44
|
+
.number()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('The step number to set the playground to'),
|
|
47
|
+
type: z
|
|
48
|
+
.enum(['problem', 'solution'])
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('The type of app to set the playground to'),
|
|
51
|
+
}, async ({ workshopDirectory, exerciseNumber, stepNumber, type }) => {
|
|
52
|
+
await handleWorkshopDirectory(workshopDirectory);
|
|
53
|
+
const apps = await getApps();
|
|
54
|
+
const exerciseStepApps = apps.filter(isExerciseStepApp);
|
|
55
|
+
const playgroundAppName = await getPlaygroundAppName();
|
|
56
|
+
const currentExerciseStepAppIndex = exerciseStepApps.findIndex((a) => a.name === playgroundAppName);
|
|
57
|
+
let desiredApp;
|
|
58
|
+
// if nothing was provided, set to the next step problem app
|
|
59
|
+
const noArgumentsProvided = !exerciseNumber && !stepNumber && !type;
|
|
60
|
+
if (noArgumentsProvided) {
|
|
61
|
+
desiredApp = exerciseStepApps
|
|
62
|
+
.slice(currentExerciseStepAppIndex + 1)
|
|
63
|
+
.find(isProblemApp);
|
|
64
|
+
invariant(desiredApp, 'No next problem app found to set playground to');
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const currentExerciseStepApp = exerciseStepApps[currentExerciseStepAppIndex];
|
|
68
|
+
// otherwise, default to the current exercise step app for arguments
|
|
69
|
+
exerciseNumber ??= currentExerciseStepApp?.exerciseNumber;
|
|
70
|
+
stepNumber ??= currentExerciseStepApp?.stepNumber;
|
|
71
|
+
type ??= currentExerciseStepApp?.type;
|
|
72
|
+
desiredApp = exerciseStepApps.find((a) => a.exerciseNumber === exerciseNumber &&
|
|
73
|
+
a.stepNumber === stepNumber &&
|
|
74
|
+
a.type === type);
|
|
75
|
+
}
|
|
76
|
+
invariant(desiredApp, `No app found for values derived by the arguments: ${exerciseNumber}.${stepNumber}.${type}`);
|
|
77
|
+
await setPlayground(desiredApp.fullPath);
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'text',
|
|
82
|
+
text: `Playground set to ${desiredApp.name}`,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// These are tools that retrieve resources. Not all resources should be
|
|
89
|
+
// accessible via tools, but allowing the LLM to access them on demand is useful
|
|
90
|
+
// for some situations.
|
|
91
|
+
export function initResourceTools(server) {
|
|
92
|
+
server.tool('get_workshop_context', `
|
|
93
|
+
Indended to help you get wholistic context of the topics covered in this
|
|
94
|
+
workshop. This doesn't go into as much detail per exercise as the
|
|
95
|
+
\`get_exercise_context\` tool, but it is a good starting point to orient
|
|
96
|
+
yourself on the workshop as a whole.
|
|
97
|
+
`.trim(), workshopContextResource.inputSchema, async ({ workshopDirectory }) => {
|
|
98
|
+
const resource = await workshopContextResource.getResource({
|
|
99
|
+
workshopDirectory,
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
content: [getEmbeddedResourceContent(resource)],
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
server.tool('get_exercise_context', `
|
|
106
|
+
Intended to help a student understand what they need to do for the current
|
|
107
|
+
exercise step.
|
|
108
|
+
|
|
109
|
+
This returns the instructions MDX content for the current exercise and each
|
|
110
|
+
exercise step. If the user is has the paid version of the workshop, it will also
|
|
111
|
+
include the transcript from each of the videos as well.
|
|
112
|
+
|
|
113
|
+
The output for this will rarely change, so it's unnecessary to call this tool
|
|
114
|
+
more than once.
|
|
115
|
+
|
|
116
|
+
\`get_exercise_context\` is often best when used with the
|
|
117
|
+
\`get_exercise_step_progress_diff\` tool to help a student understand what
|
|
118
|
+
work they still need to do and answer any questions about the exercise.
|
|
119
|
+
`.trim(), exerciseContextResource.inputSchema, async ({ workshopDirectory, exerciseNumber }) => {
|
|
120
|
+
const resource = await exerciseContextResource.getResource({
|
|
121
|
+
workshopDirectory,
|
|
122
|
+
exerciseNumber,
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
content: [getEmbeddedResourceContent(resource)],
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
server.tool('get_diff_between_apps', `
|
|
129
|
+
Intended to give context about the changes between two apps.
|
|
130
|
+
|
|
131
|
+
The output is a git diff of the playground directory as BASE (their work in
|
|
132
|
+
progress) against the solution directory as HEAD (the final state they're trying
|
|
133
|
+
to achieve).
|
|
134
|
+
|
|
135
|
+
The output is formatted as a git diff.
|
|
136
|
+
|
|
137
|
+
App IDs are formatted as \`{exerciseNumber}.{stepNumber}.{type}\`.
|
|
138
|
+
|
|
139
|
+
If the user asks for the diff for 2.3, then use 02.03.problem for app1 and 02.03.solution for app2.
|
|
140
|
+
`, diffBetweenAppsResource.inputSchema, async ({ workshopDirectory, app1, app2 }) => {
|
|
141
|
+
const resource = await diffBetweenAppsResource.getResource({
|
|
142
|
+
workshopDirectory,
|
|
143
|
+
app1,
|
|
144
|
+
app2,
|
|
145
|
+
});
|
|
146
|
+
return {
|
|
147
|
+
content: [getEmbeddedResourceContent(resource)],
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
server.tool('get_exercise_step_progress_diff', `
|
|
151
|
+
Intended to help a student understand what work they still have to complete.
|
|
152
|
+
|
|
153
|
+
This returns a git diff of the playground directory as BASE (their work in
|
|
154
|
+
progress) against the solution directory as HEAD (the final state they're trying
|
|
155
|
+
to achieve). Meaning, if there are lines removed, it means they still need to
|
|
156
|
+
add those lines and if they are added, it means they still need to remove them.
|
|
157
|
+
|
|
158
|
+
Only tell the user they have more work to do if the diff output affects the
|
|
159
|
+
required behavior, API, or user experience. If the differences are only
|
|
160
|
+
stylistic or organizational, explain that things look different, but they are
|
|
161
|
+
still valid and ready to be tested.
|
|
162
|
+
|
|
163
|
+
If there's a diff with significant changes, you should explain what the changes
|
|
164
|
+
are and their significance. Be brief. Let them tell you whether they need you to
|
|
165
|
+
elaborate.
|
|
166
|
+
|
|
167
|
+
The output for this changes over time so it's useful to call multiple times.
|
|
168
|
+
|
|
169
|
+
For additional context, you can use the \`get_exercise_instructions\` tool
|
|
170
|
+
to get the instructions for the current exercise step to help explain the
|
|
171
|
+
significance of changes.
|
|
172
|
+
`.trim(), exerciseStepProgressDiffResource.inputSchema, async ({ workshopDirectory }) => {
|
|
173
|
+
const resource = await exerciseStepProgressDiffResource.getResource({
|
|
174
|
+
workshopDirectory,
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
content: [getEmbeddedResourceContent(resource)],
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
// Sometimes the user will ask the LLM to select a prompt to use so they don't have to.
|
|
182
|
+
export function initPromptTools(server) {
|
|
183
|
+
server.tool('get_quiz_instructions', `
|
|
184
|
+
If the user asks you to quiz them on a topic from the workshop, use this tool to
|
|
185
|
+
retrieve the instructions for how to do so.
|
|
186
|
+
`.trim(), quizMeInputSchema, async ({ workshopDirectory, exerciseNumber }) => {
|
|
187
|
+
const result = await quizMe({ workshopDirectory, exerciseNumber });
|
|
188
|
+
return {
|
|
189
|
+
// QUESTION: will a prompt ever return messages that have role: 'assistant'?
|
|
190
|
+
// if so, this may be a little confusing for the LLM, but I can't think of a
|
|
191
|
+
// good use case for that so 🤷♂️
|
|
192
|
+
content: result.messages.map((m) => {
|
|
193
|
+
if (m.content.type === 'resource') {
|
|
194
|
+
return getEmbeddedResourceContent(m.content.resource);
|
|
195
|
+
}
|
|
196
|
+
return m.content;
|
|
197
|
+
}),
|
|
198
|
+
};
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function getEmbeddedResourceContent(resource) {
|
|
202
|
+
if (clientSupportsEmbeddedResources) {
|
|
203
|
+
return {
|
|
204
|
+
type: 'resource',
|
|
205
|
+
resource,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
else if (typeof resource.text === 'string') {
|
|
209
|
+
return {
|
|
210
|
+
type: 'text',
|
|
211
|
+
text: resource.text,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
throw new Error(`Unknown resource type: ${resource.type} for ${resource.uri}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EACN,OAAO,EACP,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GAEb,MAAM,sCAAsC,CAAA;AAG7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,iBAAiB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C;AACF,CAAC","sourcesContent":["import { invariant } from '@epic-web/invariant'\nimport {\n\tgetApps,\n\tgetPlaygroundAppName,\n\tisExerciseStepApp,\n\tisProblemApp,\n\tsetPlayground,\n\ttype ExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { type ReadResourceResult } from '@modelcontextprotocol/sdk/types.js'\nimport { z } from 'zod'\nimport { quizMe, quizMeInputSchema } from './prompts.js'\nimport {\n\texerciseContextResource,\n\tworkshopContextResource,\n\tdiffBetweenAppsResource,\n\texerciseStepProgressDiffResource,\n} from './resources.js'\nimport { handleWorkshopDirectory } from './utils.js'\n\n// not enough support for this yet\nconst clientSupportsEmbeddedResources = false\n\nexport function initTools(server: McpServer) {\n\tserver.tool(\n\t\t'set_playground',\n\t\t`\nSets the playground environment so the user can continue to that exercise or see\nwhat that step looks like in their playground environment.\n\nNOTE: this will override their current exercise step work in the playground!\n\nGenerally, it is better to not provide an exerciseNumber, stepNumber, and type\nand let the user continue to the next exercise. Only provide these arguments if\nthe user explicitely asks to go to a specific exercise or step. If the user asks\nto start an exercise, specify stepNumber 1 and type 'problem' unless otherwise\ndirected.\n\nArgument examples:\nA. Set to next exercise step from current (or first if there is none) - Most common\n\t- [No arguments]\nB. Set to a specific exercise step\n\t- exerciseNumber: 1\n\t- stepNumber: 1\n\t- type: 'solution'\nC. Set to the solution of the current exercise step\n\t- type: 'solution'\nD. Set to the second step problem of the current exercise\n\t- stepNumber: 2\nE. Set to the first step problem of the fifth exercise\n\t- exerciseNumber: 5\n\nAn error will be returned if no app is found for the given arguments.\n\t`.trim(),\n\t\t{\n\t\t\tworkshopDirectory: z.string().describe('The workshop directory'),\n\t\t\texerciseNumber: z.coerce\n\t\t\t\t.number()\n\t\t\t\t.optional()\n\t\t\t\t.describe('The exercise number to set the playground to'),\n\t\t\tstepNumber: z.coerce\n\t\t\t\t.number()\n\t\t\t\t.optional()\n\t\t\t\t.describe('The step number to set the playground to'),\n\t\t\ttype: z\n\t\t\t\t.enum(['problem', 'solution'])\n\t\t\t\t.optional()\n\t\t\t\t.describe('The type of app to set the playground to'),\n\t\t},\n\t\tasync ({ workshopDirectory, exerciseNumber, stepNumber, type }) => {\n\t\t\tawait handleWorkshopDirectory(workshopDirectory)\n\n\t\t\tconst apps = await getApps()\n\t\t\tconst exerciseStepApps = apps.filter(isExerciseStepApp)\n\n\t\t\tconst playgroundAppName = await getPlaygroundAppName()\n\t\t\tconst currentExerciseStepAppIndex = exerciseStepApps.findIndex(\n\t\t\t\t(a) => a.name === playgroundAppName,\n\t\t\t)\n\n\t\t\tlet desiredApp: ExerciseStepApp | undefined\n\t\t\t// if nothing was provided, set to the next step problem app\n\t\t\tconst noArgumentsProvided = !exerciseNumber && !stepNumber && !type\n\t\t\tif (noArgumentsProvided) {\n\t\t\t\tdesiredApp = exerciseStepApps\n\t\t\t\t\t.slice(currentExerciseStepAppIndex + 1)\n\t\t\t\t\t.find(isProblemApp)\n\t\t\t\tinvariant(desiredApp, 'No next problem app found to set playground to')\n\t\t\t} else {\n\t\t\t\tconst currentExerciseStepApp =\n\t\t\t\t\texerciseStepApps[currentExerciseStepAppIndex]\n\n\t\t\t\t// otherwise, default to the current exercise step app for arguments\n\t\t\t\texerciseNumber ??= currentExerciseStepApp?.exerciseNumber\n\t\t\t\tstepNumber ??= currentExerciseStepApp?.stepNumber\n\t\t\t\ttype ??= currentExerciseStepApp?.type\n\n\t\t\t\tdesiredApp = exerciseStepApps.find(\n\t\t\t\t\t(a) =>\n\t\t\t\t\t\ta.exerciseNumber === exerciseNumber &&\n\t\t\t\t\t\ta.stepNumber === stepNumber &&\n\t\t\t\t\t\ta.type === type,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tinvariant(\n\t\t\t\tdesiredApp,\n\t\t\t\t`No app found for values derived by the arguments: ${exerciseNumber}.${stepNumber}.${type}`,\n\t\t\t)\n\t\t\tawait setPlayground(desiredApp.fullPath)\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\ttext: `Playground set to ${desiredApp.name}`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t},\n\t)\n}\n\n// These are tools that retrieve resources. Not all resources should be\n// accessible via tools, but allowing the LLM to access them on demand is useful\n// for some situations.\nexport function initResourceTools(server: McpServer) {\n\tserver.tool(\n\t\t'get_workshop_context',\n\t\t`\nIndended to help you get wholistic context of the topics covered in this\nworkshop. This doesn't go into as much detail per exercise as the\n\\`get_exercise_context\\` tool, but it is a good starting point to orient\nyourself on the workshop as a whole.\n\t\t`.trim(),\n\t\tworkshopContextResource.inputSchema,\n\t\tasync ({ workshopDirectory }) => {\n\t\t\tconst resource = await workshopContextResource.getResource({\n\t\t\t\tworkshopDirectory,\n\t\t\t})\n\t\t\treturn {\n\t\t\t\tcontent: [getEmbeddedResourceContent(resource)],\n\t\t\t}\n\t\t},\n\t)\n\n\tserver.tool(\n\t\t'get_exercise_context',\n\t\t`\nIntended to help a student understand what they need to do for the current\nexercise step.\n\nThis returns the instructions MDX content for the current exercise and each\nexercise step. If the user is has the paid version of the workshop, it will also\ninclude the transcript from each of the videos as well.\n\nThe output for this will rarely change, so it's unnecessary to call this tool\nmore than once.\n\n\\`get_exercise_context\\` is often best when used with the\n\\`get_exercise_step_progress_diff\\` tool to help a student understand what\nwork they still need to do and answer any questions about the exercise.\n\t\t`.trim(),\n\t\texerciseContextResource.inputSchema,\n\t\tasync ({ workshopDirectory, exerciseNumber }) => {\n\t\t\tconst resource = await exerciseContextResource.getResource({\n\t\t\t\tworkshopDirectory,\n\t\t\t\texerciseNumber,\n\t\t\t})\n\t\t\treturn {\n\t\t\t\tcontent: [getEmbeddedResourceContent(resource)],\n\t\t\t}\n\t\t},\n\t)\n\n\tserver.tool(\n\t\t'get_diff_between_apps',\n\t\t`\nIntended to give context about the changes between two apps.\n\nThe output is a git diff of the playground directory as BASE (their work in\nprogress) against the solution directory as HEAD (the final state they're trying\nto achieve).\n\nThe output is formatted as a git diff.\n\nApp IDs are formatted as \\`{exerciseNumber}.{stepNumber}.{type}\\`.\n\nIf the user asks for the diff for 2.3, then use 02.03.problem for app1 and 02.03.solution for app2.\n\t\t`,\n\t\tdiffBetweenAppsResource.inputSchema,\n\t\tasync ({ workshopDirectory, app1, app2 }) => {\n\t\t\tconst resource = await diffBetweenAppsResource.getResource({\n\t\t\t\tworkshopDirectory,\n\t\t\t\tapp1,\n\t\t\t\tapp2,\n\t\t\t})\n\t\t\treturn {\n\t\t\t\tcontent: [getEmbeddedResourceContent(resource)],\n\t\t\t}\n\t\t},\n\t)\n\n\tserver.tool(\n\t\t'get_exercise_step_progress_diff',\n\t\t`\nIntended to help a student understand what work they still have to complete.\n\nThis returns a git diff of the playground directory as BASE (their work in\nprogress) against the solution directory as HEAD (the final state they're trying\nto achieve). Meaning, if there are lines removed, it means they still need to\nadd those lines and if they are added, it means they still need to remove them.\n\nOnly tell the user they have more work to do if the diff output affects the\nrequired behavior, API, or user experience. If the differences are only\nstylistic or organizational, explain that things look different, but they are\nstill valid and ready to be tested.\n\nIf there's a diff with significant changes, you should explain what the changes\nare and their significance. Be brief. Let them tell you whether they need you to\nelaborate.\n\nThe output for this changes over time so it's useful to call multiple times.\n\nFor additional context, you can use the \\`get_exercise_instructions\\` tool\nto get the instructions for the current exercise step to help explain the\nsignificance of changes.\n\t\t`.trim(),\n\t\texerciseStepProgressDiffResource.inputSchema,\n\t\tasync ({ workshopDirectory }) => {\n\t\t\tconst resource = await exerciseStepProgressDiffResource.getResource({\n\t\t\t\tworkshopDirectory,\n\t\t\t})\n\t\t\treturn {\n\t\t\t\tcontent: [getEmbeddedResourceContent(resource)],\n\t\t\t}\n\t\t},\n\t)\n}\n\n// Sometimes the user will ask the LLM to select a prompt to use so they don't have to.\nexport function initPromptTools(server: McpServer) {\n\tserver.tool(\n\t\t'get_quiz_instructions',\n\t\t`\nIf the user asks you to quiz them on a topic from the workshop, use this tool to\nretrieve the instructions for how to do so.\n\t\t`.trim(),\n\t\tquizMeInputSchema,\n\t\tasync ({ workshopDirectory, exerciseNumber }) => {\n\t\t\tconst result = await quizMe({ workshopDirectory, exerciseNumber })\n\t\t\treturn {\n\t\t\t\t// QUESTION: will a prompt ever return messages that have role: 'assistant'?\n\t\t\t\t// if so, this may be a little confusing for the LLM, but I can't think of a\n\t\t\t\t// good use case for that so 🤷♂️\n\t\t\t\tcontent: result.messages.map((m) => {\n\t\t\t\t\tif (m.content.type === 'resource') {\n\t\t\t\t\t\treturn getEmbeddedResourceContent(m.content.resource)\n\t\t\t\t\t}\n\t\t\t\t\treturn m.content\n\t\t\t\t}),\n\t\t\t}\n\t\t},\n\t)\n}\n\nfunction getEmbeddedResourceContent(\n\tresource: ReadResourceResult['contents'][number],\n) {\n\tif (clientSupportsEmbeddedResources) {\n\t\treturn {\n\t\t\ttype: 'resource' as const,\n\t\t\tresource,\n\t\t}\n\t} else if (typeof resource.text === 'string') {\n\t\treturn {\n\t\t\ttype: 'text' as const,\n\t\t\ttext: resource.text,\n\t\t}\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Unknown resource type: ${resource.type} for ${resource.uri}`,\n\t\t)\n\t}\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type z } from 'zod';
|
|
2
|
+
export declare function handleWorkshopDirectory(workshopDirectory: string): Promise<string>;
|
|
3
|
+
export declare function safeReadFile(filePath: string): Promise<string | null>;
|
|
4
|
+
export type InputSchemaType<T extends {
|
|
5
|
+
[K: string]: z.ZodType;
|
|
6
|
+
}> = {
|
|
7
|
+
[K in keyof T]: z.infer<T[K]>;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,wBAAsB,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,mBAOtE;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,0BAMlD;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,CAAA;CAAE,IAAI;KAClE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7B,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { init as initApps } from '@epic-web/workshop-utils/apps.server';
|
|
4
|
+
export async function handleWorkshopDirectory(workshopDirectory) {
|
|
5
|
+
if (workshopDirectory.endsWith('playground')) {
|
|
6
|
+
workshopDirectory = path.join(workshopDirectory, '..');
|
|
7
|
+
}
|
|
8
|
+
await initApps(workshopDirectory);
|
|
9
|
+
return workshopDirectory;
|
|
10
|
+
}
|
|
11
|
+
export async function safeReadFile(filePath) {
|
|
12
|
+
try {
|
|
13
|
+
return await fs.readFile(filePath, 'utf-8');
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACjC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAGvE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,iBAAyB;IACtE,IAAI,iBAAiB,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9C,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAA;IACvD,CAAC;IAED,MAAM,QAAQ,CAAC,iBAAiB,CAAC,CAAA;IACjC,OAAO,iBAAiB,CAAA;AACzB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IAClD,IAAI,CAAC;QACJ,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAA;IACZ,CAAC;AACF,CAAC","sourcesContent":["import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { init as initApps } from '@epic-web/workshop-utils/apps.server'\nimport { type z } from 'zod'\n\nexport async function handleWorkshopDirectory(workshopDirectory: string) {\n\tif (workshopDirectory.endsWith('playground')) {\n\t\tworkshopDirectory = path.join(workshopDirectory, '..')\n\t}\n\n\tawait initApps(workshopDirectory)\n\treturn workshopDirectory\n}\n\nexport async function safeReadFile(filePath: string) {\n\ttry {\n\t\treturn await fs.readFile(filePath, 'utf-8')\n\t} catch {\n\t\treturn null\n\t}\n}\n\nexport type InputSchemaType<T extends { [K: string]: z.ZodType }> = {\n\t[K in keyof T]: z.infer<T[K]>\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epic-web/workshop-mcp",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.19.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"bin": "./dist/esm/
|
|
7
|
+
"bin": "./dist/esm/index.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"tshy": {
|
|
10
10
|
"project": "./tsconfig.build.json",
|
|
@@ -13,24 +13,24 @@
|
|
|
13
13
|
],
|
|
14
14
|
"exports": {
|
|
15
15
|
"./package.json": "./package.json",
|
|
16
|
-
".": "./dist/esm/
|
|
16
|
+
".": "./dist/esm/index.js"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"exports": {
|
|
20
20
|
"./package.json": "./package.json",
|
|
21
|
-
".": "./dist/esm/
|
|
21
|
+
".": "./dist/esm/index.js"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
|
-
"dev": "tsx src/
|
|
27
|
+
"dev": "tsx src/index.ts",
|
|
28
28
|
"typecheck": "tsc -b --noEmit",
|
|
29
29
|
"build": "tshy",
|
|
30
30
|
"build:watch": "nx watch --projects=@epic-web/workshop-mcp -- nx run \\$NX_PROJECT_NAME:build"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@epic-web/workshop-utils": "5.
|
|
33
|
+
"@epic-web/workshop-utils": "5.19.0",
|
|
34
34
|
"@epic-web/invariant": "^1.0.0",
|
|
35
35
|
"@modelcontextprotocol/sdk": "^1.9.0",
|
|
36
36
|
"zod": "^3.24.2"
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"url": "https://github.com/epicweb-dev/epicshop.git",
|
|
47
47
|
"directory": "packages/workshop-mcp"
|
|
48
48
|
},
|
|
49
|
-
"main": "./dist/esm/
|
|
50
|
-
"module": "./dist/esm/
|
|
49
|
+
"main": "./dist/esm/index.js",
|
|
50
|
+
"module": "./dist/esm/index.js"
|
|
51
51
|
}
|
package/dist/esm/cli.d.ts
DELETED
package/dist/esm/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
|