Compare commits

..

1 Commits

Author SHA1 Message Date
paoloricciuti
fac76922b8 chore: sync skills and update documentation 2026-02-06 17:38:02 +00:00
4 changed files with 8 additions and 56 deletions

View File

@@ -1,5 +0,0 @@
---
'@sveltejs/mcp': patch
---
feat: display similar result & error at the end

View File

@@ -17,7 +17,7 @@ jobs:
name: Release
runs-on: ${{ matrix.os }}
outputs:
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
published: ${{ steps.changesets.outputs.published }}
strategy:
matrix:
# pseudo-matrix for convenience, NEVER use more than a single combination
@@ -64,7 +64,7 @@ jobs:
publish-mcp:
needs: release
if: contains(needs.release.outputs.publishedPackages, '"@sveltejs/mcp"')
if: needs.release.outputs.published == 'true'
uses: ./.github/workflows/publish-mcp.yml
secrets:
MCP_KEY: ${{ secrets.MCP_KEY }}

View File

@@ -33,9 +33,6 @@ The default configuration for the Svelte OpenCode plugin looks like this...
},
"skills": {
"enabled": true
},
"instructions": {
"enabled": true
}
}
```

View File

@@ -91,56 +91,16 @@ export async function get_documentation_handler({
}
});
const successes = results.filter((r) => r.success);
const failed_sections = sections.filter(
(s) =>
!available_sections.some(
(a) => a.title.toLowerCase() === s.toLowerCase() || a.slug === s || a.url === s,
),
);
const has_any_success = results.some((result) => result.success);
let final_text = results.map((r) => r.content).join('\n\n---\n\n');
if (successes.length > 0 && failed_sections.length === 0) {
return successes.map((r) => r.content).join('\n\n---\n\n');
}
const parts: string[] = [];
if (successes.length > 0) {
parts.push(successes.map((r) => r.content).join('\n\n---\n\n'));
}
const fuzzy_results = failed_sections.map((requested) => {
const lower = requested.toLowerCase();
const matches = available_sections.filter(
(a) =>
a.title.toLowerCase().includes(lower) ||
a.slug.includes(lower) ||
lower.includes(a.slug.split('/').pop() ?? '') ||
a.use_cases.toLowerCase().includes(lower),
);
return { requested, matches };
});
const has_fuzzy = fuzzy_results.some((r) => r.matches.length > 0);
// Full list only when no successes and no fuzzy matches
if (successes.length === 0 && !has_fuzzy) {
if (!has_any_success) {
const formatted_sections = await format_sections_list();
parts.push(`${SECTIONS_LIST_INTRO}\n\n${formatted_sections}\n\n${SECTIONS_LIST_OUTRO}`);
final_text += `\n\n---\n\n${SECTIONS_LIST_INTRO}\n\n${formatted_sections}\n\n${SECTIONS_LIST_OUTRO}`;
}
// Similar results then errors
for (const { requested, matches } of fuzzy_results) {
if (matches.length > 0) {
const match_list = matches.map((m) => `- title: ${m.title}, section: ${m.slug}`).join('\n');
parts.push(
`${matches.length} similar result${matches.length > 1 ? 's' : ''} for "${requested}":\n${match_list}`,
);
}
parts.push(`Section not found: "${requested}".`);
}
return parts.join('\n\n---\n\n');
return final_text;
}
export function get_documentation(server: SvelteMcp) {