From fa907de2afe51ad8bece06faac298e96b17a0a1c Mon Sep 17 00:00:00 2001 From: DKalinov Date: Wed, 18 Nov 2026 17:31:55 +0200 Subject: [PATCH 1/2] fix(mcp): stop get_doc aliases from serving the wrong doc The alias table still mapped combo names to a doc called "overview". Since the documentation database was rebuilt, that name belongs to the Themes page, so get_doc returned Themes for combo, IgrCombo, IgbCombo and IgcComboComponent, and the React combo-overview doc was unreachable. The virtual-scroll alias also hid the real Virtual Scroll doc. An exact doc name now wins over an alias, and the aliases point to the current doc names. A test checks every alias against the bundled database. Co-Authored-By: Claude Fable 5.2 --- .../src/__tests__/tools/doc-tools.test.ts | 77 ++++++++++++++++--- .../igniteui-doc-mcp/src/tools/doc-tools.ts | 61 ++++++++------- 2 files changed, 101 insertions(+), 37 deletions(-) diff --git a/packages/igniteui-mcp/igniteui-doc-mcp/src/__tests__/tools/doc-tools.test.ts b/packages/igniteui-mcp/igniteui-doc-mcp/src/__tests__/tools/doc-tools.test.ts index 5f7e60dfe..614f9fbea 100644 --- a/packages/igniteui-mcp/igniteui-doc-mcp/src/__tests__/tools/doc-tools.test.ts +++ b/packages/igniteui-mcp/igniteui-doc-mcp/src/__tests__/tools/doc-tools.test.ts @@ -1,5 +1,9 @@ +import { readFileSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; +import initSqlJs from 'sql.js'; import { describe, expect, it } from 'vitest'; import { + DOC_ALIASES, addPackageVersions, applyCompactGridPrefix, applyDocAlias, @@ -193,12 +197,12 @@ describe('applyDocAlias', () => { expect(applyDocAlias('angular', 'accordion')).toBe('accordion'); }); - it('resolves react combo to overview', () => { - expect(applyDocAlias('react', 'combo')).toBe('overview'); + it('resolves react combo to combo-overview', () => { + expect(applyDocAlias('react', 'combo')).toBe('combo-overview'); }); - it('resolves react combo-box to overview', () => { - expect(applyDocAlias('react', 'combo-box')).toBe('overview'); + it('resolves react combo-box to combo-overview', () => { + expect(applyDocAlias('react', 'combo-box')).toBe('combo-overview'); }); it('resolves react grid to data-grid', () => { @@ -209,8 +213,8 @@ describe('applyDocAlias', () => { expect(applyDocAlias('react', 'hierarchical-grid')).toBe('hierarchical-grid-overview'); }); - it('resolves angular combo-box to combo', () => { - expect(applyDocAlias('angular', 'combo-box')).toBe('combo'); + it('resolves angular combo-box to combo-overview', () => { + expect(applyDocAlias('angular', 'combo-box')).toBe('combo-overview'); }); it('resolves angular hierarchical-grid correctly', () => { @@ -221,8 +225,8 @@ describe('applyDocAlias', () => { expect(applyDocAlias('angular', 'grid')).toBe('grid-grid'); }); - it('resolves webcomponents combo to overview', () => { - expect(applyDocAlias('webcomponents', 'combo')).toBe('overview'); + it('resolves webcomponents combo to combo-overview', () => { + expect(applyDocAlias('webcomponents', 'combo')).toBe('combo-overview'); }); it('resolves webcomponents grid to data-grid', () => { @@ -251,7 +255,48 @@ describe('applyDocAlias', () => { it('IgrCombo normalizes then aliases correctly for react', () => { const normalized = normalizeDocName('IgrCombo'); - expect(applyDocAlias('react', normalized)).toBe('overview'); + expect(applyDocAlias('react', normalized)).toBe('combo-overview'); + }); +}); + +describe('DOC_ALIASES against the bundled database', async () => { + const dbPath = fileURLToPath(new URL('../../../db/igniteui-docs.db', import.meta.url)); + const SQL = await initSqlJs(); + const db = new SQL.Database(readFileSync(dbPath)); + const docNames = (framework: string) => + new Set( + (db.exec('SELECT filename FROM docs WHERE framework = ?', [framework])[0]?.values ?? []).map((row) => + String(row[0]).replace(/.md$/, ''), + ), + ); + + for (const [framework, aliases] of Object.entries(DOC_ALIASES)) { + const names = docNames(framework); + + it(`${framework}: every alias points to an existing doc`, () => { + const missing = Object.entries(aliases) + .filter(([, target]) => !names.has(target)) + .map(([alias, target]) => `${alias} -> ${target}`); + expect(missing).toEqual([]); + }); + + it(`${framework}: no alias renames an existing doc`, () => { + const shadowing = Object.entries(aliases) + .filter(([alias, target]) => alias !== target && names.has(alias)) + .map(([alias, target]) => `${alias} -> ${target}`); + expect(shadowing).toEqual([]); + }); + } + + it.each(['react', 'webcomponents', 'blazor', 'angular'])('%s: combo names resolve to the Combo doc', (framework) => { + for (const name of ['combo', 'combo-box', 'combobox']) { + expect(applyDocAlias(framework, name)).toBe('combo-overview'); + } + const [[tocName]] = db.exec('SELECT toc_name FROM docs WHERE framework = ? AND filename = ?', [ + framework, + 'combo-overview.md', + ])[0].values; + expect(tocName).toBe('Combo'); }); }); @@ -278,6 +323,20 @@ describe('resolveDoc', () => { }; } + it('serves a doc with the exact requested name even when an alias exists for it', async () => { + const p = makeProvider({ grid: 'EXACT', 'data-grid': 'ALIASED' }); + const r = await resolveDoc(p, 'react', 'grid'); + expect(r).toMatchObject({ found: true, servedName: 'grid', text: 'EXACT', fuzzy: false }); + }); + + it('falls back to the alias when no doc has the requested name', async () => { + const p = makeProvider({ overview: 'THEMES', 'combo-overview': 'COMBO' }); + for (const name of ['combo', 'IgrCombo', 'combo-box']) { + const r = await resolveDoc(p, 'react', name); + expect(r).toMatchObject({ found: true, servedName: 'combo-overview', text: 'COMBO', fuzzy: false }); + } + }); + it('resolves a direct name', async () => { const p = makeProvider({ accordion: 'ACC' }); const r = await resolveDoc(p, 'angular', 'accordion'); diff --git a/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts b/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts index bcc3e214a..5b83b8470 100644 --- a/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts +++ b/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts @@ -88,20 +88,22 @@ export function normalizeDocName(name: string): string { * Per-framework alias maps: normalized kebab-case name → actual doc key. * * Covers cases where the doc key cannot be derived mechanically: - * - Combo Box overview is keyed as "overview" not "combo" / "combo-box" + * - Combo Box overview is keyed as "combo-overview" not "combo" / "combo-box" * - Combo sub-docs use bare generic names: "features", "templates", "single-selection" * - Grid overview is "grid-grid" or "data-grid", not "grid" * - Several components append "-overview" or "-chart" suffix * - "radio" covers both Radio and Radio Group * - "slider" covers both Slider and Range Slider + * + * An alias applies only when no doc has the requested name (see resolveDoc), and + * every target must name a doc in the bundled database; doc-tools.test.ts checks both. */ -const DOC_ALIASES: Record> = { +export const DOC_ALIASES: Record> = { react: { // Combo Box - combo: 'overview', - 'combo-box': 'overview', - combobox: 'overview', - 'combo-overview': 'overview', + combo: 'combo-overview', + 'combo-box': 'combo-overview', + combobox: 'combo-overview', 'combo-features': 'features', 'combobox-features': 'features', 'combo-templates': 'templates', @@ -119,7 +121,6 @@ const DOC_ALIASES: Record> = { zoomslider: 'zoomslider-overview', // Virtualization virtualization: 'grid-virtualization', - 'virtual-scroll': 'grid-virtualization', 'virtual-scrolling': 'grid-virtualization', 'grid-performance': 'grid-virtualization', // Non-obvious renames @@ -128,18 +129,18 @@ const DOC_ALIASES: Record> = { 'radio-and-radio-group': 'radio', 'range-slider': 'slider', dashboard: 'dashboard-tile', - themes: 'themes-overview', - theme: 'themes-overview', + themes: 'overview', + theme: 'overview', 'geographic-map': 'geo-map', 'geo-map-overview': 'geo-map', 'geographic-map-features': 'geo-map', - // grids/theming-grid moved under grids/grid/ in igniteui-documentation - 'theming-grid': 'grid-theming-grid', + 'theming-grid': 'grid-theming', }, angular: { // Combo Box - 'combo-box': 'combo', - combobox: 'combo', + combo: 'combo-overview', + 'combo-box': 'combo-overview', + combobox: 'combo-overview', // Grid types grid: 'grid-grid', 'hierarchical-grid': 'hierarchicalgrid-hierarchical-grid', @@ -150,7 +151,6 @@ const DOC_ALIASES: Record> = { zoomslider: 'zoomslider-overview', // Virtualization — Angular uses different naming convention (hierarchicalgrid-, treegrid-) virtualization: 'grid-virtualization', - 'virtual-scroll': 'grid-virtualization', 'virtual-scrolling': 'grid-virtualization', 'grid-performance': 'grid-virtualization', 'hierarchical-grid-virtualization': 'hierarchicalgrid-virtualization', @@ -164,16 +164,16 @@ const DOC_ALIASES: Record> = { 'igx-for-of': 'for-of', // Non-obvious renames treemap: 'types-treemap-chart', - 'radio-group': 'radio-button', - 'range-slider': 'slider', + 'radio-group': 'radio', + 'range-slider': 'slider-slider', 'geographic-map': 'geo-map', 'geo-map-overview': 'geo-map', }, webcomponents: { // Combo Box - combo: 'overview', - 'combo-box': 'overview', - combobox: 'overview', + combo: 'combo-overview', + 'combo-box': 'combo-overview', + combobox: 'combo-overview', // Grid types grid: 'data-grid', 'hierarchical-grid': 'hierarchical-grid-overview', @@ -185,7 +185,6 @@ const DOC_ALIASES: Record> = { zoomslider: 'zoomslider-overview', // Virtualization virtualization: 'grid-virtualization', - 'virtual-scroll': 'grid-virtualization', 'virtual-scrolling': 'grid-virtualization', 'grid-performance': 'grid-virtualization', // Non-obvious renames @@ -194,13 +193,13 @@ const DOC_ALIASES: Record> = { 'range-slider': 'slider', 'geographic-map': 'geo-map', 'geo-map-overview': 'geo-map', - 'theming-grid': 'grid-theming-grid', + 'theming-grid': 'grid-theming', }, blazor: { // Combo Box - combo: 'overview', - 'combo-box': 'overview', - combobox: 'overview', + combo: 'combo-overview', + 'combo-box': 'combo-overview', + combobox: 'combo-overview', // Grid types grid: 'data-grid', 'hierarchical-grid': 'hierarchical-grid-overview', @@ -219,7 +218,7 @@ const DOC_ALIASES: Record> = { 'range-slider': 'slider', 'geographic-map': 'geo-map', 'geo-map-overview': 'geo-map', - 'theming-grid': 'grid-theming-grid', + 'theming-grid': 'grid-theming', }, }; @@ -322,7 +321,7 @@ export interface ResolvedDoc { /** * Resolve a caller-supplied doc name to actual doc content for get_doc. - * Applies normalizeDocName + applyDocAlias, then the Angular compact grid + * Tries the normalized name as given, then its alias, then the Angular compact grid * prefix rewrite (tree-grid-x → treegrid-x), then a generic grid- prefix * fallback for bare feature names (e.g. "sorting" → "grid-sorting"). * As a last resort, runs a full-text search and serves the top hit — this @@ -335,8 +334,14 @@ export async function resolveDoc( framework: string, name: string, ): Promise { - const resolvedName = applyDocAlias(framework, normalizeDocName(name.trim())); - let { text, found } = await docsProvider.getDoc(framework, resolvedName); + const normalizedName = normalizeDocName(name.trim()); + const aliasedName = applyDocAlias(framework, normalizedName); + let resolvedName = normalizedName; + let { text, found } = await docsProvider.getDoc(framework, normalizedName); + if (!found && aliasedName !== normalizedName) { + resolvedName = aliasedName; + ({ text, found } = await docsProvider.getDoc(framework, aliasedName)); + } let servedName = resolvedName; if (!found) { From f888bb378761d8cff2f07e24ab34de61d20a7645 Mon Sep 17 00:00:00 2001 From: DKalinov Date: Thu, 19 Nov 2026 06:39:09 +0200 Subject: [PATCH 2/2] fix(mcp): point virtual-scrolling at the virtual-scroll doc React, Angular and Web Components have a Virtual Scroll doc, so the "-ing" form resolves there instead of grid-virtualization. The get_doc description and README no longer advertise the removed virtual-scroll alias. Co-Authored-By: Claude Fable 5.2 --- packages/igniteui-mcp/igniteui-doc-mcp/README.md | 2 +- .../igniteui-mcp/igniteui-doc-mcp/src/tools/constants.ts | 2 +- .../igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/igniteui-mcp/igniteui-doc-mcp/README.md b/packages/igniteui-mcp/igniteui-doc-mcp/README.md index 2ca6753e4..cb2562ef1 100644 --- a/packages/igniteui-mcp/igniteui-doc-mcp/README.md +++ b/packages/igniteui-mcp/igniteui-doc-mcp/README.md @@ -142,7 +142,7 @@ Every tool is scoped to a single framework — `angular`, `react`, `blazor`, or | Tool | Parameters | Description | |------|-----------|-------------| | `list_components` | `framework` (required), `filter`, `group`, `detail` | Browse the component doc index, grouped by the published documentation table of contents. By default returns a compact index — one heading per group with a short summary and its doc names. `group` (a heading exactly as printed, e.g. `Grids & Lists > Data Grid`) returns that group's docs with summaries; in grouped mode, `filter` is a case-insensitive substring match against filename, component name, keywords, summary, and group name; `detail: "docs"` returns the flat per-doc list with every summary (much larger), where `filter` does not match group names. No pagination. | -| `get_doc` | `framework` (required), `name` (required) | Return the full markdown content of one component doc by name, kebab-case without `.md` (e.g. `grid-editing`, `accordion`). Bare grid feature names resolve automatically (`sorting` → `grid-sorting`), and common aliases are handled (`virtual-scroll` → `grid-virtualization`). The frontmatter has a `package` line with the package and version of the doc's components in the bundled API reference (e.g. `igniteui-react-grids@19.9`); local mode only. | +| `get_doc` | `framework` (required), `name` (required) | Return the full markdown content of one component doc by name, kebab-case without `.md` (e.g. `grid-editing`, `accordion`). Bare grid feature names resolve automatically (`sorting` → `grid-sorting`), and common aliases are handled (`virtualization` → `grid-virtualization`). The frontmatter has a `package` line with the package and version of the doc's components in the bundled API reference (e.g. `igniteui-react-grids@19.9`); local mode only. | | `search_docs` | `framework` (required), `query` (required) | Full-text search across the docs for one framework. Returns up to 20 title- and keyword-weighted results with highlighted excerpts. Multi-word queries are implicit AND; trailing `*` does prefix matching (`grid*`); hyphenated terms match as phrases. | | `search_api` | `query` (required), `platform` | Discover API entries by keyword, feature name, or partial component name. Returns up to 10 ranked results with framework tag, API type, package and version it describes (e.g. `igniteui-react-grids@19.9`), and excerpt. Omit `platform` to search all four frameworks at once. | | `get_api_reference` | `platform` (required), `component` (required), `section`, `member` | Return the full API reference for an exact component or class name (case-insensitive). Narrow the response with `section` (`properties`, `methods`, `events`, `all` — default `all`) or `member` to fetch a single property/method/event. `member` takes precedence over `section`. Every response starts with a `Package: @` line naming the release the entry was read from, plus an `Also in:` line when other packages ship the same name. | diff --git a/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/constants.ts b/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/constants.ts index d789d4df6..dcf869549 100644 --- a/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/constants.ts +++ b/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/constants.ts @@ -37,7 +37,7 @@ No pagination — the full result set is returned in one call. get_doc: `Retrieve the full markdown content of one specific Ignite UI component doc by its exact name. The name is kebab-case without the .md extension (e.g. "grid-editing", "combo-overview", "accordion"). -For grid feature docs, the bare feature name works without the "grid-" prefix — e.g. "sorting" resolves to "grid-sorting", "remote-data-operations" resolves to "grid-remote-data-operations". Common aliases are also handled: "virtualization" → "grid-virtualization", "virtual-scroll" → "grid-virtualization". For completely unknown names, use list_components or search_docs to discover the exact name first. +For grid feature docs, the bare feature name works without the "grid-" prefix — e.g. "sorting" resolves to "grid-sorting", "remote-data-operations" resolves to "grid-remote-data-operations". Common aliases are also handled: "virtualization" → "grid-virtualization", "combo-box" → "combo-overview". For completely unknown names, use list_components or search_docs to discover the exact name first. Returns YAML frontmatter (component, package, keywords, summary) followed by the complete markdown body with code samples, tables, and links. The \`package\` line (e.g. "igniteui-react-grids@19.9") names the package and release of the doc's components in the bundled API reference; compare it with the version in the project's package.json or .csproj, because an older release may lack what the doc describes. It is omitted when the doc lists no component from the API reference. diff --git a/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts b/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts index 5b83b8470..180cdbc08 100644 --- a/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts +++ b/packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts @@ -121,7 +121,7 @@ export const DOC_ALIASES: Record> = { zoomslider: 'zoomslider-overview', // Virtualization virtualization: 'grid-virtualization', - 'virtual-scrolling': 'grid-virtualization', + 'virtual-scrolling': 'virtual-scroll', 'grid-performance': 'grid-virtualization', // Non-obvious renames treemap: 'treemap-chart', @@ -151,7 +151,7 @@ export const DOC_ALIASES: Record> = { zoomslider: 'zoomslider-overview', // Virtualization — Angular uses different naming convention (hierarchicalgrid-, treegrid-) virtualization: 'grid-virtualization', - 'virtual-scrolling': 'grid-virtualization', + 'virtual-scrolling': 'virtual-scroll', 'grid-performance': 'grid-virtualization', 'hierarchical-grid-virtualization': 'hierarchicalgrid-virtualization', 'tree-grid-virtualization': 'treegrid-virtualization', @@ -185,7 +185,7 @@ export const DOC_ALIASES: Record> = { zoomslider: 'zoomslider-overview', // Virtualization virtualization: 'grid-virtualization', - 'virtual-scrolling': 'grid-virtualization', + 'virtual-scrolling': 'virtual-scroll', 'grid-performance': 'grid-virtualization', // Non-obvious renames treemap: 'treemap-chart',