Skip to content

fix(mcp): add search fallback to get_doc and generic-stripped lookup to get_api_reference - #1808

Merged
kdinev merged 6 commits into
masterfrom
dkalinov/searchFallback
Sep 24, 2026
Merged

kdinev merged 6 commits into
masterfrom
dkalinov/searchFallback

Conversation

@dkalinovInfra

Copy link
Copy Markdown
Contributor

Description

Improves name resolution in the MCP server so agents get the doc/API entry they meant instead of an error.

get_doc

  • Shared resolveDoc() with a resolution chain: alias → Angular compact grid prefix (tree-grid-editing → treegrid-editing) → grid- retry → full-text search fallback. Search-fallback hits are prefixed with a "closest match" notice so the caller can tell a substitution from an exact hit.
  • parseDocNames understands both the local ((`name`)) and remote (**name**) search result formats — previously the fallback silently returned not-found in remote mode.
  • sanitizeSearchDocsQuery strips natural-language stopwords ("how do I …") that made FTS4 implicit-AND queries return nothing.
  • normalizeDocName collapses spaces/underscores to hyphens ("date picker" → date-picker).

get_api_reference

  • Blank or placeholder member values (" ", ".*", "*") are treated as omitted instead of failing with -32602; agents send these when they want the full entry.
  • Component lookup is case-insensitive and generic-stripped: IgbCombo / igbcombo resolve to the indexed IgbCombo<T>. Exact non-generic names still win (DynamicContentInfo vs DynamicContentInfo<T>).

Related Issue

N/A — driven by an agent evaluation sweep against the MCP server.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring / code cleanup
  • Build / CI configuration 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

  • I have tested my changes locally (npm run test)
  • I have built the project successfully (npm run build)
  • I have run the linter (npm run lint)
  • I have added/updated tests as needed
  • My changes do not introduce new warnings or errors

Additional Context

  • MCP vitest suite: 324/324 passing; tsc --noEmit clean.
  • Behaviour change to note: get_doc can now serve a "closest match" doc (with a notice) where it previously returned isError.
  • Surfaced but not fixed here: IgbCombo<T> is defined in both IgniteUI.Blazor and IgniteUI.Blazor.Lite; the loader keys by name with last-wins, so the Lite entry shadows the full one for every shared name. Worth a separate issue (package-priority rule in ApiDocLoader).

Copilot AI lite review requested due to automatic review settings September 18, 2026 05:55
@dkalinovInfra dkalinovInfra changed the title Dkalinov/search fallback fix(mcp): add search fallback to get_doc and generic-stripped lookup to get_api_reference Sep 18, 2026
Comment thread packages/igniteui-mcp/igniteui-doc-mcp/src/lib/api-doc-loader.ts Dismissed

This comment was marked as resolved.

@coveralls

coveralls commented Sep 18, 2026 •

Copy link
Copy Markdown

Coverage Status

No base build to compare — dkalinov/searchFallback into master

@kdinev kdinev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll wait to see if there would be any additional changes produced from the copilot review. Looks good to me so far.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Case-insensitive generic requests can incorrectly resolve to the corresponding non-generic API type.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Comment thread packages/igniteui-mcp/igniteui-doc-mcp/src/lib/api-doc-loader.ts

@kdinev kdinev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The last copilot comment requires a large code change and can be ignored for now.

@kdinev
kdinev merged commit 7fc6a19 into master Sep 24, 2026
5 checks passed
@kdinev
kdinev deleted the dkalinov/searchFallback branch September 24, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants