Skip to content

fix(mcp): improve search_docs ranking and get_doc resolution#1746

Open
onlyexeption wants to merge 4 commits into
masterfrom
ibarakov/fix-1745
Open

fix(mcp): improve search_docs ranking and get_doc resolution#1746
onlyexeption wants to merge 4 commits into
masterfrom
ibarakov/fix-1745

Conversation

@onlyexeption

Copy link
Copy Markdown
Contributor

Description

  • Field-weighted re-ranking (title +10, keywords +5, filename +4, summary +3) replaces FTS4 default scoring that buried dedicated feature docs
  • Multi-word queries use AND instead of OR — reduces noise significantly
  • Generic grid-prefix fallback in get_doc: "sorting" → "grid-sorting"
  • Added aliases for virtualization, virtual-scroll, igxFor, and cross-framework grid naming
  • Updated tool descriptions to reflect actual resolution behavior

Related Issue

Closes #1745

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

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.

Pull request overview

Improves the Ignite UI MCP documentation search and retrieval experience by making search_docs return more relevant feature-specific docs (especially for multi-word queries) and making get_doc resolve common/implicit doc name patterns more reliably.

Changes:

  • Switch search_docs query sanitization from OR-joined terms to implicit AND for multi-word queries.
  • Add field-weighted re-ranking (title/keywords/filename/summary boosts) after fetching a larger candidate set.
  • Expand get_doc name resolution via new aliases and a generic grid- prefix fallback for bare grid feature names.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts Updates FTS query sanitization behavior and adds new doc aliases (virtualization, igxFor, etc.).
packages/igniteui-mcp/igniteui-doc-mcp/src/tools/constants.ts Updates MCP tool descriptions to reflect new resolution and query semantics.
packages/igniteui-mcp/igniteui-doc-mcp/src/providers/LocalDocsProvider.ts Implements field-weighted re-ranking for searchDocs() and increases candidate LIMIT to 200.
packages/igniteui-mcp/igniteui-doc-mcp/src/index.ts Adds get_doc fallback to grid-{name} when the initial lookup misses.
packages/igniteui-mcp/igniteui-doc-mcp/src/tests/tools/doc-tools.test.ts Updates unit tests to match the new implicit-AND sanitization output.
packages/igniteui-mcp/igniteui-doc-mcp/docs/knowledgebase.md Documents the ranking issue and the applied fixes/rules.
packages/igniteui-mcp/docs-backend/docs-backend/Controllers/DocsController.cs Mirrors field-weighted re-ranking behavior in the backend search endpoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/igniteui-mcp/igniteui-doc-mcp/src/providers/LocalDocsProvider.ts Outdated
Comment thread packages/igniteui-mcp/igniteui-doc-mcp/src/providers/LocalDocsProvider.ts Outdated
Comment thread packages/igniteui-mcp/igniteui-doc-mcp/src/index.ts
Comment thread packages/igniteui-mcp/igniteui-doc-mcp/src/index.ts
@kdinev

kdinev commented Jul 9, 2026

Copy link
Copy Markdown
Member

@onlyexeption You need to update the tests.

Copilot finished work on behalf of kdinev July 9, 2026 09:48
@coveralls

coveralls commented Jul 9, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 87.79%. remained the same — ibarakov/fix-1745 into master

Comment on lines +99 to +100
'hierarchical-grid-virtualization': 'hierarchical-grid-virtualization',
'tree-grid-virtualization': 'tree-grid-virtualization',

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.

Aren't these the same?

Comment on lines +130 to +131
'hierarchical-grid-virtualization': 'hierarchicalgrid-virtualization',
'tree-grid-virtualization': 'treegrid-virtualization',

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.

Do these need to be joined? The dashed seems like a better term

Comment on lines +165 to +166
'hierarchical-grid-virtualization': 'hierarchical-grid-virtualization',
'tree-grid-virtualization': 'tree-grid-virtualization',

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.

These again seem the same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's because Angular's docfx doc filenames are joined (hierarchicalgrid-virtualization.md, treegrid-virtualization.md), unlike the other platforms which keep the dash (hierarchical-grid-, tree-grid-). These lines exist so that when the LLM guesses the more natural (dashed) form, we still resolve it to the actual Angular doc.

Comment on lines +191 to +192
'hierarchical-grid-virtualization': 'hierarchical-grid-virtualization',
'tree-grid-virtualization': 'tree-grid-virtualization',

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.

Again, identical.

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.

search_docs MCP tool returns irrelevant results for feature-specific queries (e.g. "virtual scroll")

5 participants