Improve get_doc name resolution with normalization and alias map#1727
Open
onlyexeption wants to merge 3 commits into
Open
Improve get_doc name resolution with normalization and alias map#1727onlyexeption wants to merge 3 commits into
onlyexeption wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the get_doc tool in the Ignite UI MCP server by resolving documentation names more flexibly, allowing callers to use framework component class names (e.g., IgxGridComponent, IgrCombo) and mapping them to the correct doc keys via normalization + per-framework aliases.
Changes:
- Added
normalizeDocName()to convert common component class naming patterns to kebab-case doc keys. - Introduced per-framework alias maps and
applyDocAlias()to handle non-mechanical doc key mappings. - Updated the
get_doctool handler to normalize + alias the requested doc name before fetching.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts | Adds doc name normalization plus framework-specific alias resolution helpers and alias tables. |
| packages/igniteui-mcp/igniteui-doc-mcp/src/index.ts | Applies normalization + aliasing in the get_doc tool handler before calling docsProvider.getDoc(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (1)
packages/igniteui-mcp/igniteui-doc-mcp/src/index.ts:141
get_docnow trims/normalizes/aliases the provided name, so the schema description is no longer accurate when it says "Exact doc name in kebab-case". Update it to reflect that component class names likeIgxGridComponentare accepted too.
.describe(
'Exact doc name in kebab-case without the .md extension. ' +
'Examples: "grid-editing", "combo-overview", "accordion". ' +
'Get valid names from list_components or search_docs.'
| 'combo-single-selection': 'single-selection', | ||
| 'combobox-single-selection': 'single-selection', | ||
| // Grid | ||
| grid: 'grid-grid', |
Comment on lines
+102
to
+106
| angular: { | ||
| // Combo Box | ||
| 'combo-box': 'combo', | ||
| combobox: 'combo', | ||
| // Grid -overview suffix |
Comment on lines
+120
to
+124
| webcomponents: { | ||
| // Combo Box | ||
| combo: 'overview', | ||
| 'combo-box': 'overview', | ||
| combobox: 'overview', |
Comment on lines
+140
to
+144
| blazor: { | ||
| // Combo Box | ||
| combo: 'overview', | ||
| 'combo-box': 'overview', | ||
| combobox: 'overview', |
| * Covers cases where the doc key cannot be derived mechanically: | ||
| * - Combo Box overview is keyed as "overview" not "combo" / "combo-box" | ||
| * - Combo sub-docs use bare generic names: "features", "templates", "single-selection" | ||
| * - Grid overview is "data-grid", not "grid" |
Comment on lines
+145
to
+147
| it('resolves react grid to grid-grid', () => { | ||
| expect(applyDocAlias('react', 'grid')).toBe('grid-grid'); | ||
| }); |
Comment on lines
+177
to
+180
| it('IgxGridComponent normalizes then aliases correctly for angular', () => { | ||
| const normalized = normalizeDocName('IgxGridComponent'); | ||
| expect(applyDocAlias('angular', normalized)).toBe('grid'); | ||
| }); |
Comment on lines
+157
to
+172
| it('resolves angular hierarchical-grid correctly', () => { | ||
| expect(applyDocAlias('angular', 'hierarchical-grid')).toBe('hierarchicalgrid-hierarchical-grid'); | ||
| }); | ||
|
|
||
| it('resolves webcomponents combo to overview', () => { | ||
| expect(applyDocAlias('webcomponents', 'combo')).toBe('overview'); | ||
| }); | ||
|
|
||
| it('resolves blazor radio-group to radio', () => { | ||
| expect(applyDocAlias('blazor', 'radio-group')).toBe('radio'); | ||
| }); | ||
|
|
||
| it('resolves blazor range-slider to slider', () => { | ||
| expect(applyDocAlias('blazor', 'range-slider')).toBe('slider'); | ||
| }); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issue
Closes #
Type of Change
Affected Packages
igniteui-cli(packages/cli)@igniteui/cli-core(packages/core)@igniteui/angular-templates(packages/igx-templates)@igniteui/angular-schematics(packages/ng-schematics)@igniteui/mcp-server(packages/igniteui-mcp)Checklist
npm run test)npm run build)npm run lint)Additional Context