diff --git a/.changeset/common-vans-poke.md b/.changeset/common-vans-poke.md new file mode 100644 index 0000000..17a9d0f --- /dev/null +++ b/.changeset/common-vans-poke.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/mcp': patch +--- + +fix: minor tweaks to the prompt to allow for automatic sync diff --git a/.github/workflows/update-prompt-docs.yml b/.github/workflows/update-prompt-docs.yml new file mode 100644 index 0000000..a19df35 --- /dev/null +++ b/.github/workflows/update-prompt-docs.yml @@ -0,0 +1,78 @@ +name: Update Prompt Documentation + +on: + push: + branches: + - main + paths: + - 'packages/mcp-server/src/mcp/handlers/prompts/**' + +permissions: + contents: write + pull-requests: write + +jobs: + update-docs: + # prevents this action from running on forks + if: github.repository == 'sveltejs/mcp' + name: Update Prompt Documentation + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + node-version: 24 + package-manager-cache: false # pnpm is not installed yet + + - name: Install pnpm + shell: bash + run: | + PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json) + echo installing pnpm version $PNPM_VER + npm i -g pnpm@$PNPM_VER + + - name: Setup Node.js with pnpm cache + uses: actions/setup-node@v5 + with: + node-version: 24 + package-manager-cache: true # caches pnpm via packageManager field in package.json + + - name: Install dependencies + run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts + + - name: Generate prompt documentation + run: pnpm generate-prompt-docs + + - name: Check for changes + id: git-check + run: | + git diff --exit-code documentation/docs/30-capabilities/30-prompts.md || echo "changed=true" >> $GITHUB_OUTPUT + + - name: Create Pull Request + if: steps.git-check.outputs.changed == 'true' + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: 'docs: update prompts documentation' + branch: docs/update-prompt-docs + delete-branch: true + title: 'docs: update prompt documentation' + body: | + ## Summary + Automatically generated documentation update for MCP prompts. + + This PR was triggered by changes to the prompts folder in `packages/mcp-server/src/mcp/handlers/prompts/`. + + ## Changes + - Updated `documentation/docs/30-capabilities/30-prompts.md` with latest prompt definitions + + ## Generated by + GitHub Action: Update Prompt Documentation + labels: | + documentation + automated diff --git a/.vscode/mcp-snippets.code-snippets b/.vscode/mcp-snippets.code-snippets index 931d77a..9a8df93 100644 --- a/.vscode/mcp-snippets.code-snippets +++ b/.vscode/mcp-snippets.code-snippets @@ -30,4 +30,62 @@ ], "description": "Create a setup export for an autofixer", }, + "Prompt Generator": { + "scope": "javascript,typescript", + "prefix": "!prompt", + "body": [ + "import type { SvelteMcp } from '../../index.js';", + "", + "/**", + " * Function that actually generates the prompt string. You can use this in the MCP server handler to generate the prompt, it can accept arguments", + " * if needed (it will always be invoked manually so it's up to you to provide the arguments).", + " */", + "function ${1:prompt_name}() {", + "\treturn `$0`;", + "}", + "", + "/**", + " * This function is used to generate the prompt to update the docs in the script `/scripts/update-docs-prompts.ts` it should use the default export", + " * function and pass in the arguments. Since it will be included in the documentation if it's an argument that the MCP will expose it should", + " * be in the format [NAME_OF_THE_ARGUMENT] to signal the user that it can substitute it.", + " * ", + " * The name NEEDS to be `generate_for_docs`.", + " */", + "export async function generate_for_docs() {", + "\treturn ${1:prompt_name}();", + "}", + "", + "/**", + " * Human readable description of what the prompt does. It will be included in the documentation.", + " * ", + " * The name NEEDS to be `docs_description`.", + " */", + "export const docs_description = '';", + "", + "export function setup_${1:prompt_name}(server: SvelteMcp) {", + "\tserver.prompt(", + "\t\t{", + "\t\t\tname: '${1:prompt_name}',", + "\t\t\ttitle: '${2:title}',", + "\t\t\tdescription:", + "\t\t\t\t'${3:llm_description}',", + "\t\t},", + "\t\tasync () => {", + "\t\t\treturn {", + "\t\t\t\tmessages: [", + "\t\t\t\t\t{", + "\t\t\t\t\t\trole: 'assistant',", + "\t\t\t\t\t\tcontent: {", + "\t\t\t\t\t\t\ttype: 'text',", + "\t\t\t\t\t\t\ttext: ${1:prompt_name}(),", + "\t\t\t\t\t\t},", + "\t\t\t\t\t},", + "\t\t\t\t],", + "\t\t\t};", + "\t\t},", + "\t);", + "}", + ], + "description": "Create a setup export for a prompt generator", + }, } diff --git a/package.json b/package.json index 6e60443..cd2ca5d 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "test:watch": "npm run test:unit -- --watch", "inspect": "pnpm mcp-inspector", "generate-summaries": "pnpm --filter @sveltejs/mcp-server run generate-summaries", + "generate-prompt-docs": "node --import node-resolve-ts/register scripts/update-docs-prompts.ts", "debug:generate-summaries": "pnpm --filter @sveltejs/mcp-server run debug:generate-summaries", "release": "pnpm --filter @sveltejs/mcp run build && changeset publish", "changeset:version": "changeset version && pnpm --filter @sveltejs/mcp run update:version && git add --all" @@ -39,6 +40,7 @@ "eslint-plugin-import": "^2.32.0", "eslint-plugin-svelte": "^3.12.3", "globals": "^16.0.0", + "node-resolve-ts": "^1.0.2", "prettier": "^3.4.2", "prettier-plugin-svelte": "^3.3.3", "publint": "^0.3.13", diff --git a/packages/mcp-server/src/mcp/handlers/prompts/index.ts b/packages/mcp-server/src/mcp/handlers/prompts/index.ts index 8c16a8b..c4c7415 100644 --- a/packages/mcp-server/src/mcp/handlers/prompts/index.ts +++ b/packages/mcp-server/src/mcp/handlers/prompts/index.ts @@ -1 +1 @@ -export * from './svelte-task.js'; +export { setup_svelte_task } from './svelte-task.js'; diff --git a/packages/mcp-server/src/mcp/handlers/prompts/svelte-task.ts b/packages/mcp-server/src/mcp/handlers/prompts/svelte-task.ts index db34310..73a7516 100644 --- a/packages/mcp-server/src/mcp/handlers/prompts/svelte-task.ts +++ b/packages/mcp-server/src/mcp/handlers/prompts/svelte-task.ts @@ -2,16 +2,68 @@ import type { SvelteMcp } from '../../index.js'; import * as v from 'valibot'; import { format_sections_list } from '../../utils.js'; +/** + * Function that actually generates the prompt string. You can use this in the MCP server handler to generate the prompt, it can accept arguments + * if needed (it will always be invoked manually so it's up to you to provide the arguments). + */ +function svelte_task(available_docs: string, task: string) { + return `You are a Svelte expert tasked to build components and utilities for Svelte developers. If you need documentation for anything related to Svelte you can invoke the tool \`get_documentation\` with one of the following paths: + + +${available_docs} + + + +Every time you write a Svelte component or a Svelte module you MUST invoke the \`svelte-autofixer\` tool providing the code. The tool will return a list of issues or suggestions. If there are any issues or suggestions you MUST fix them and call the tool again with the updated code. You MUST keep doing this until the tool returns no issues or suggestions. Only then you can return the code to the user. + +This is the task you will work on: + + +${task} + + +If you are not writing the code into a file, once you have the final version of the code ask the user if it wants to generate a playground link to quickly check the code in it and if it answer yes call the \`playground-link\` tool and return the url to the user nicely formatted. The playground link MUST be generated only once you have the final version of the code and you are ready to share it, it MUST include an entry point file called \`App.svelte\` where the main component should live. If you have multiple files to include in the playground link you can include them all at the root.`; +} + +/** + * This function is used to generate the prompt to update the docs in the script `/scripts/update-docs-prompts.ts` it should use the default export + * function and pass in the arguments. Since it will be included in the documentation if it's an argument that the MCP will expose it should + * be in the format [NAME_OF_THE_ARGUMENT] to signal the user that it can substitute it. + * + * The name NEEDS to be `generate_for_docs`. + */ +export async function generate_for_docs() { + const available_docs = await format_sections_list(); + return svelte_task(available_docs, '[YOUR TASK HERE]'); +} + +/** + * Human readable description of what the prompt does. It will be included in the documentation. + * + * The name NEEDS to be `docs_description`. + */ +export const docs_description = + 'This prompt should be used whenever you are asking the model to work on a Svelte-related task. It will instruct the LLM which documentation sections are available, which tools to invoke, when to invoke them, and how to interpret the results.'; + export function setup_svelte_task(server: SvelteMcp) { server.prompt( { - name: 'svelte-task-prompt', + name: 'svelte-task', title: 'Svelte-Task-Prompt', description: 'Use this Prompt to ask for any svelte related task. It will automatically instruct the LLM on how to best use the autofixer and how to query for documentation pages.', schema: v.object({ task: v.pipe(v.string(), v.description('The task to be performed')), }), + complete: { + task() { + return { + completion: { + values: [''], + }, + }; + }, + }, }, async ({ task }) => { const available_docs = await format_sections_list(); @@ -22,21 +74,7 @@ export function setup_svelte_task(server: SvelteMcp) { role: 'user', content: { type: 'text', - text: `You are a Svelte expert tasked to build components and utilities for Svelte developers. If you need documentation for anything related to Svelte you can invoke the tool \`get_documentation\` with one of the following paths: - -${available_docs} - - -Every time you write a Svelte component or a Svelte module you MUST invoke the \`svelte-autofixer\` tool providing the code. The tool will return a list of issues or suggestions. If there are any issues or suggestions you MUST fix them and call the tool again with the updated code. You MUST keep doing this until the tool returns no issues or suggestions. Only then you can return the code to the user. - -This is the task you will work on: - - -${task} - - -If you are not writing the code into a file, once you have the final version of the code ask the user if it wants to generate a playground link to quickly check the code in it and if it answer yes call the \`playground-link\` tool and return the url to the user nicely formatted. The playground link MUST be generated only once you have the final version of the code and you are ready to share it, it MUST include an entry point file called \`App.svelte\` where the main component should live. If you have multiple files to include in the playground link you can include them all at the root. -`, + text: svelte_task(available_docs, task), }, }, ], diff --git a/packages/mcp-server/src/mcp/utils.ts b/packages/mcp-server/src/mcp/utils.ts index f0d54b3..5a50fca 100644 --- a/packages/mcp-server/src/mcp/utils.ts +++ b/packages/mcp-server/src/mcp/utils.ts @@ -51,6 +51,6 @@ export async function get_sections() { export async function format_sections_list() { const sections = await get_sections(); return sections - .map((s) => `* title: ${s.title}, use_cases: ${s.use_cases}, path: ${s.slug}`) + .map((s) => `- title: ${s.title}, use_cases: ${s.use_cases}, path: ${s.slug}`) .join('\n'); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba011e2..95462bb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,13 +31,16 @@ importers: version: 10.1.8(eslint@9.36.0(jiti@2.6.0)) eslint-plugin-import: specifier: ^2.32.0 - version: 2.32.0(eslint@9.36.0(jiti@2.6.0)) + version: 2.32.0(@typescript-eslint/parser@8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2))(eslint@9.36.0(jiti@2.6.0)) eslint-plugin-svelte: specifier: ^3.12.3 version: 3.12.4(eslint@9.36.0(jiti@2.6.0))(svelte@5.39.6)(ts-node@10.9.2(@types/node@24.5.2)(typescript@5.9.2)) globals: specifier: ^16.0.0 version: 16.4.0 + node-resolve-ts: + specifier: ^1.0.2 + version: 1.0.2 prettier: specifier: ^3.4.2 version: 3.6.2 @@ -875,8 +878,8 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@oxc-project/types@0.93.0': - resolution: {integrity: sha512-yNtwmWZIBtJsMr5TEfoZFDxIWV6OdScOpza/f5YxbqUMJk+j6QX3Cf3jgZShGEFYWQJ5j9mJ6jM0tZHu2J9Yrg==} + '@oxc-project/types@0.94.0': + resolution: {integrity: sha512-+UgQT/4o59cZfH6Cp7G0hwmqEQ0wE+AdIwhikdwnhWI9Dp8CgSY081+Q3O67/wq3VJu8mgUEB93J9EHHn70fOw==} '@petamoriken/float16@3.9.2': resolution: {integrity: sha512-VgffxawQde93xKxT3qap3OH+meZf7VaSB5Sqd4Rqc+FP5alWbpOyan/7tRbOAvynjpG3GpdtAuGU/NdhQpmrog==} @@ -1282,91 +1285,91 @@ packages: '@radix-ui/rect@1.1.1': resolution: {integrity: sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==} - '@rolldown/binding-android-arm64@1.0.0-beta.41': - resolution: {integrity: sha512-Edflndd9lU7JVhVIvJlZhdCj5DkhYDJPIRn4Dx0RUdfc8asP9xHOI5gMd8MesDDx+BJpdIT/uAmVTearteU/mQ==} + '@rolldown/binding-android-arm64@1.0.0-beta.42': + resolution: {integrity: sha512-W5ZKF3TP3bOWuBfotAGp+UGjxOkGV7jRmIRbBA7NFjggx7Oi6vOmGDqpHEIX7kDCiry1cnIsWQaxNvWbMdkvzQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@rolldown/binding-darwin-arm64@1.0.0-beta.41': - resolution: {integrity: sha512-XGCzqfjdk7550PlyZRTBKbypXrB7ATtXhw/+bjtxnklLQs0mKP/XkQVOKyn9qGKSlvH8I56JLYryVxl0PCvSNw==} + '@rolldown/binding-darwin-arm64@1.0.0-beta.42': + resolution: {integrity: sha512-abw/wtgJA8OCgaTlL+xJxnN/Z01BwV1rfzIp5Hh9x+IIO6xOBfPsQ0nzi0+rWx3TyZ9FZXyC7bbC+5NpQ9EaXQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@rolldown/binding-darwin-x64@1.0.0-beta.41': - resolution: {integrity: sha512-Ho6lIwGJed98zub7n0xcRKuEtnZgbxevAmO4x3zn3C3N4GVXZD5xvCvTVxSMoeBJwTcIYzkVDRTIhylQNsTgLQ==} + '@rolldown/binding-darwin-x64@1.0.0-beta.42': + resolution: {integrity: sha512-Y/UrZIRVr8CvXVEB88t6PeC46r1K9/QdPEo2ASE/b/KBEyXIx+QbM6kv9QfQVWU2Atly2+SVsQzxQsIvuk3lZQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@rolldown/binding-freebsd-x64@1.0.0-beta.41': - resolution: {integrity: sha512-ijAZETywvL+gACjbT4zBnCp5ez1JhTRs6OxRN4J+D6AzDRbU2zb01Esl51RP5/8ZOlvB37xxsRQ3X4YRVyYb3g==} + '@rolldown/binding-freebsd-x64@1.0.0-beta.42': + resolution: {integrity: sha512-zRM0oOk7BZiy6DoWBvdV4hyEg+j6+WcBZIMHVirMEZRu8hd18kZdJkg+bjVMfCEhwpWeFUfBfZ1qcaZ5UdYzlQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.41': - resolution: {integrity: sha512-EgIOZt7UildXKFEFvaiLNBXm+4ggQyGe3E5Z1QP9uRcJJs9omihOnm897FwOBQdCuMvI49iBgjFrkhH+wMJ2MA==} + '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.42': + resolution: {integrity: sha512-6RjFaC52QNwo7ilU8C5H7swbGlgfTkG9pudXwzr3VYyT18s0C9gLg3mvc7OMPIGqNxnQ0M5lU8j6aQCk2DTRVg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.41': - resolution: {integrity: sha512-F8bUwJq8v/JAU8HSwgF4dztoqJ+FjdyjuvX4//3+Fbe2we9UktFeZ27U4lRMXF1vxWtdV4ey6oCSqI7yUrSEeg==} + '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.42': + resolution: {integrity: sha512-LMYHM5Sf6ROq+VUwHMDVX2IAuEsWTv4SnlFEedBnMGpvRuQ14lCmD4m5Q8sjyAQCgyha9oghdGoK8AEg1sXZKg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.41': - resolution: {integrity: sha512-MioXcCIX/wB1pBnBoJx8q4OGucUAfC1+/X1ilKFsjDK05VwbLZGRgOVD5OJJpUQPK86DhQciNBrfOKDiatxNmg==} + '@rolldown/binding-linux-arm64-musl@1.0.0-beta.42': + resolution: {integrity: sha512-/bNTYb9aKNhzdbPn3O4MK2aLv55AlrkUKPE4KNfBYjkoZUfDr4jWp7gsSlvTc5A/99V1RCm9axvt616ZzeXGyA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.41': - resolution: {integrity: sha512-m66M61fizvRCwt5pOEiZQMiwBL9/y0bwU/+Kc4Ce/Pef6YfoEkR28y+DzN9rMdjo8Z28NXjsDPq9nH4mXnAP0g==} + '@rolldown/binding-linux-x64-gnu@1.0.0-beta.42': + resolution: {integrity: sha512-n/SLa4h342oyeGykZdch7Y3GNCNliRPL4k5wkeZ/5eQZs+c6/ZG1SHCJQoy7bZcmxiMyaXs9HoFmv1PEKrZgWg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - '@rolldown/binding-linux-x64-musl@1.0.0-beta.41': - resolution: {integrity: sha512-yRxlSfBvWnnfrdtJfvi9lg8xfG5mPuyoSHm0X01oiE8ArmLRvoJGHUTJydCYz+wbK2esbq5J4B4Tq9WAsOlP1Q==} + '@rolldown/binding-linux-x64-musl@1.0.0-beta.42': + resolution: {integrity: sha512-4PSd46sFzqpLHSGdaSViAb1mk55sCUMpJg+X8ittXaVocQsV3QLG/uydSH8RyL0ngHX5fy3D70LcCzlB15AgHw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - '@rolldown/binding-openharmony-arm64@1.0.0-beta.41': - resolution: {integrity: sha512-PHVxYhBpi8UViS3/hcvQQb9RFqCtvFmFU1PvUoTRiUdBtgHA6fONNHU4x796lgzNlVSD3DO/MZNk1s5/ozSMQg==} + '@rolldown/binding-openharmony-arm64@1.0.0-beta.42': + resolution: {integrity: sha512-BmWoeJJyeZXmZBcfoxG6J9+rl2G7eO47qdTkAzEegj4n3aC6CBIHOuDcbE8BvhZaEjQR0nh0nJrtEDlt65Q7Sw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@rolldown/binding-wasm32-wasi@1.0.0-beta.41': - resolution: {integrity: sha512-OAfcO37ME6GGWmj9qTaDT7jY4rM0T2z0/8ujdQIJQ2x2nl+ztO32EIwURfmXOK0U1tzkyuaKYvE34Pug/ucXlQ==} + '@rolldown/binding-wasm32-wasi@1.0.0-beta.42': + resolution: {integrity: sha512-2Ft32F7uiDTrGZUKws6CLNTlvTWHC33l4vpXrzUucf9rYtUThAdPCOt89Pmn13tNX6AulxjGEP2R0nZjTSW3eQ==} engines: {node: '>=14.0.0'} cpu: [wasm32] - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.41': - resolution: {integrity: sha512-NIYGuCcuXaq5BC4Q3upbiMBvmZsTsEPG9k/8QKQdmrch+ocSy5Jv9tdpdmXJyighKqm182nh/zBt+tSJkYoNlg==} + '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.42': + resolution: {integrity: sha512-hC1kShXW/z221eG+WzQMN06KepvPbMBknF0iGR3VMYJLOe9gwnSTfGxFT5hf8XrPv7CEZqTWRd0GQpkSHRbGsw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.41': - resolution: {integrity: sha512-kANdsDbE5FkEOb5NrCGBJBCaZ2Sabp3D7d4PRqMYJqyLljwh9mDyYyYSv5+QNvdAmifj+f3lviNEUUuUZPEFPw==} + '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.42': + resolution: {integrity: sha512-AICBYromawouGjj+GS33369E8Vwhy6UwhQEhQ5evfS8jPCsyVvoICJatbDGDGH01dwtVGLD5eDFzPicUOVpe4g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.41': - resolution: {integrity: sha512-UlpxKmFdik0Y2VjZrgUCgoYArZJiZllXgIipdBRV1hw6uK45UbQabSTW6Kp6enuOu7vouYWftwhuxfpE8J2JAg==} + '@rolldown/binding-win32-x64-msvc@1.0.0-beta.42': + resolution: {integrity: sha512-XpZ0M+tjoEiSc9c+uZR7FCnOI0uxDRNs1elGOMjeB0pUP1QmvVbZGYNsyLbLoP4u7e3VQN8rie1OQ8/mB6rcJg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] - '@rolldown/pluginutils@1.0.0-beta.41': - resolution: {integrity: sha512-ycMEPrS3StOIeb87BT3/+bu+blEtyvwQ4zmo2IcJQy0Rd1DAAhKksA0iUZ3MYSpJtjlPhg0Eo6mvVS6ggPhRbw==} + '@rolldown/pluginutils@1.0.0-beta.42': + resolution: {integrity: sha512-N7pQzk9CyE7q0bBN/q0J8s6Db279r5kUZc6d7/wWRe9/zXqC52HQovVyu6iXPIDY4BEzzgbVLhVFXrOuGJ22ZQ==} '@rollup/pluginutils@5.3.0': resolution: {integrity: sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==} @@ -3052,6 +3055,9 @@ packages: resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==} hasBin: true + node-resolve-ts@1.0.2: + resolution: {integrity: sha512-OXr7jYcmWWhO0Bb4eyK7Rwi9PbWRy5+Ie7bRIL+tlD4hdkVf/HMNoZhF/ze5H31eMBee8NSVwfxSpb/WwpJt6g==} + nopt@8.1.0: resolution: {integrity: sha512-ieGu42u/Qsa4TFktmaKEwM6MQH0pOWnaB3htzh0JRtx84+Mebc0cbZYN5bC+6WTZ4+77xrL9Pn5m7CV6VIkV7A==} engines: {node: ^18.17.0 || >=20.5.0} @@ -3412,8 +3418,8 @@ packages: vue-tsc: optional: true - rolldown@1.0.0-beta.41: - resolution: {integrity: sha512-U+NPR0Bkg3wm61dteD2L4nAM1U9dtaqVrpDXwC36IKRHpEO/Ubpid4Nijpa2imPchcVNHfxVFwSSMJdwdGFUbg==} + rolldown@1.0.0-beta.42: + resolution: {integrity: sha512-xaPcckj+BbJhYLsv8gOqezc8EdMcKKe/gk8v47B0KPvgABDrQ0qmNPAiT/gh9n9Foe0bUkEv2qzj42uU5q1WRg==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true @@ -4766,7 +4772,7 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.19.1 - '@oxc-project/types@0.93.0': {} + '@oxc-project/types@0.94.0': {} '@petamoriken/float16@3.9.2': optional: true @@ -5087,51 +5093,51 @@ snapshots: '@radix-ui/rect@1.1.1': {} - '@rolldown/binding-android-arm64@1.0.0-beta.41': + '@rolldown/binding-android-arm64@1.0.0-beta.42': optional: true - '@rolldown/binding-darwin-arm64@1.0.0-beta.41': + '@rolldown/binding-darwin-arm64@1.0.0-beta.42': optional: true - '@rolldown/binding-darwin-x64@1.0.0-beta.41': + '@rolldown/binding-darwin-x64@1.0.0-beta.42': optional: true - '@rolldown/binding-freebsd-x64@1.0.0-beta.41': + '@rolldown/binding-freebsd-x64@1.0.0-beta.42': optional: true - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.41': + '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.42': optional: true - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.41': + '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.42': optional: true - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.41': + '@rolldown/binding-linux-arm64-musl@1.0.0-beta.42': optional: true - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.41': + '@rolldown/binding-linux-x64-gnu@1.0.0-beta.42': optional: true - '@rolldown/binding-linux-x64-musl@1.0.0-beta.41': + '@rolldown/binding-linux-x64-musl@1.0.0-beta.42': optional: true - '@rolldown/binding-openharmony-arm64@1.0.0-beta.41': + '@rolldown/binding-openharmony-arm64@1.0.0-beta.42': optional: true - '@rolldown/binding-wasm32-wasi@1.0.0-beta.41': + '@rolldown/binding-wasm32-wasi@1.0.0-beta.42': dependencies: '@napi-rs/wasm-runtime': 1.0.6 optional: true - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.41': + '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.42': optional: true - '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.41': + '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.42': optional: true - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.41': + '@rolldown/binding-win32-x64-msvc@1.0.0-beta.42': optional: true - '@rolldown/pluginutils@1.0.0-beta.41': {} + '@rolldown/pluginutils@1.0.0-beta.42': {} '@rollup/pluginutils@5.3.0(rollup@4.52.2)': dependencies: @@ -5469,14 +5475,6 @@ snapshots: chai: 5.3.3 tinyrainbow: 2.0.0 - '@vitest/mocker@3.2.4(vite@7.1.7(@types/node@22.18.6)(jiti@2.6.0)(tsx@4.20.6))': - dependencies: - '@vitest/spy': 3.2.4 - estree-walker: 3.0.3 - magic-string: 0.30.19 - optionalDependencies: - vite: 7.1.7(@types/node@22.18.6)(jiti@2.6.0)(tsx@4.20.6) - '@vitest/mocker@3.2.4(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6))': dependencies: '@vitest/spy': 3.2.4 @@ -6101,16 +6099,17 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.1(eslint-import-resolver-node@0.3.9)(eslint@9.36.0(jiti@2.6.0)): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.36.0(jiti@2.6.0)): dependencies: debug: 3.2.7 optionalDependencies: + '@typescript-eslint/parser': 8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2) eslint: 9.36.0(jiti@2.6.0) eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-import@2.32.0(eslint@9.36.0(jiti@2.6.0)): + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2))(eslint@9.36.0(jiti@2.6.0)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.9 @@ -6121,7 +6120,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.36.0(jiti@2.6.0) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(eslint-import-resolver-node@0.3.9)(eslint@9.36.0(jiti@2.6.0)) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.36.0(jiti@2.6.0)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -6132,6 +6131,8 @@ snapshots: semver: 6.3.1 string.prototype.trimend: 1.0.9 tsconfig-paths: 3.15.0 + optionalDependencies: + '@typescript-eslint/parser': 8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -6864,6 +6865,8 @@ snapshots: node-gyp-build@4.8.4: {} + node-resolve-ts@1.0.2: {} + nopt@8.1.0: dependencies: abbrev: 3.0.1 @@ -7166,7 +7169,7 @@ snapshots: reusify@1.1.0: {} - rolldown-plugin-dts@0.16.11(rolldown@1.0.0-beta.41)(typescript@5.9.2): + rolldown-plugin-dts@0.16.11(rolldown@1.0.0-beta.42)(typescript@5.9.2): dependencies: '@babel/generator': 7.28.3 '@babel/parser': 7.28.4 @@ -7177,33 +7180,33 @@ snapshots: dts-resolver: 2.1.2 get-tsconfig: 4.10.1 magic-string: 0.30.19 - rolldown: 1.0.0-beta.41 + rolldown: 1.0.0-beta.42 optionalDependencies: typescript: 5.9.2 transitivePeerDependencies: - oxc-resolver - supports-color - rolldown@1.0.0-beta.41: + rolldown@1.0.0-beta.42: dependencies: - '@oxc-project/types': 0.93.0 - '@rolldown/pluginutils': 1.0.0-beta.41 + '@oxc-project/types': 0.94.0 + '@rolldown/pluginutils': 1.0.0-beta.42 ansis: 4.2.0 optionalDependencies: - '@rolldown/binding-android-arm64': 1.0.0-beta.41 - '@rolldown/binding-darwin-arm64': 1.0.0-beta.41 - '@rolldown/binding-darwin-x64': 1.0.0-beta.41 - '@rolldown/binding-freebsd-x64': 1.0.0-beta.41 - '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.41 - '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.41 - '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.41 - '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.41 - '@rolldown/binding-linux-x64-musl': 1.0.0-beta.41 - '@rolldown/binding-openharmony-arm64': 1.0.0-beta.41 - '@rolldown/binding-wasm32-wasi': 1.0.0-beta.41 - '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.41 - '@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.41 - '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.41 + '@rolldown/binding-android-arm64': 1.0.0-beta.42 + '@rolldown/binding-darwin-arm64': 1.0.0-beta.42 + '@rolldown/binding-darwin-x64': 1.0.0-beta.42 + '@rolldown/binding-freebsd-x64': 1.0.0-beta.42 + '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.42 + '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.42 + '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.42 + '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.42 + '@rolldown/binding-linux-x64-musl': 1.0.0-beta.42 + '@rolldown/binding-openharmony-arm64': 1.0.0-beta.42 + '@rolldown/binding-wasm32-wasi': 1.0.0-beta.42 + '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.42 + '@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.42 + '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.42 rollup@4.52.2: dependencies: @@ -7631,8 +7634,8 @@ snapshots: diff: 8.0.2 empathic: 2.0.0 hookable: 5.5.3 - rolldown: 1.0.0-beta.41 - rolldown-plugin-dts: 0.16.11(rolldown@1.0.0-beta.41)(typescript@5.9.2) + rolldown: 1.0.0-beta.42 + rolldown-plugin-dts: 0.16.11(rolldown@1.0.0-beta.42)(typescript@5.9.2) semver: 7.7.2 tinyexec: 1.0.1 tinyglobby: 0.2.15 @@ -7848,7 +7851,7 @@ snapshots: dependencies: '@types/chai': 5.2.2 '@vitest/expect': 3.2.4 - '@vitest/mocker': 3.2.4(vite@7.1.7(@types/node@22.18.6)(jiti@2.6.0)(tsx@4.20.6)) + '@vitest/mocker': 3.2.4(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6)) '@vitest/pretty-format': 3.2.4 '@vitest/runner': 3.2.4 '@vitest/snapshot': 3.2.4 diff --git a/scripts/update-docs-prompts.ts b/scripts/update-docs-prompts.ts new file mode 100644 index 0000000..30cc485 --- /dev/null +++ b/scripts/update-docs-prompts.ts @@ -0,0 +1,36 @@ +import fs from 'node:fs/promises'; +import path from 'node:path'; + +let content = `--- +title: Prompts +--- + +This is the list of available prompts provided by the MCP server. Prompts are selected by the user and are sent as a user message. They can be useful to write repetitive instructions for the LLM on how to properly use the MCP server. + +`; + +const prompts_generators = fs.glob('./packages/mcp-server/src/mcp/handlers/prompts/*.ts'); + +const filename_regex = /packages\/mcp-server\/src\/mcp\/handlers\/prompts\/(?.+)\.ts/; + +for await (const file of prompts_generators) { + const title = file.match(filename_regex)?.groups?.prompt; + if (title === 'index') continue; + const module = await import(path.resolve('./', file)); + content += `## ${title} + +${module.docs_description} + +
+ Copy the prompt + +\`\`\`md +${await module.generate_for_docs()} +\`\`\` + +
+ +`; +} + +await fs.writeFile('./documentation/docs/30-capabilities/30-prompts.md', content.trim() + '\n');