Fix [MCP] Enforce library boundaries in search_api and server instructions#1694
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens framework boundary enforcement in the Ignite UI MCP server to prevent AI agents from mixing component APIs across Angular, React, Blazor, and Web Components. It updates server-level instructions, the usage guide prompt, the search_api tool description, and adds a runtime warning when search_api results span multiple frameworks.
Changes:
- Added a "LIBRARY BOUNDARY RULE" to the MCP server's
instructionsfield and a "Library Boundary Rules" section to theUSAGE_GUIDEprompt. - Updated the
search_apitool description to encourage always passingplatformwhen known. - Added a multi-framework warning prefix to
search_apiresponses whenplatformis omitted and hits cover more than one framework.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/igniteui-mcp/igniteui-doc-mcp/src/index.ts | Extends server instructions with an explicit library boundary rule. |
| packages/igniteui-mcp/igniteui-doc-mcp/src/tools/constants.ts | Adds Library Boundary Rules to USAGE_GUIDE and reframes search_api description to prefer specifying platform. |
| packages/igniteui-mcp/igniteui-doc-mcp/src/tools/handlers.ts | Prepends a cross-framework warning to search_api output when results span multiple frameworks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kdinev
approved these changes
May 19, 2026
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.
Closes #1620
Problem
When
search_apiis called without aplatformargument, it returns results interleaved across all four frameworks (Angular, React, Blazor, Web Components) with no warning. An AI consuming those results could pick up Angular-specific event names, directive imports, or binding syntax and apply them to React or Blazor code — producing output that looks valid at first glance but fails at runtime.Additionally, the MCP server's
instructionsfield and theUSAGE_GUIDEprompt only described how to detect the target framework, but never stated that once identified its APIs must be used exclusively. This left a gap that allowed cross-library API patterns to bleed into generated code.Changes
src/index.ts— Extendedserver.instructionswith an explicit LIBRARY BOUNDARY RULE: once the target framework is identified, always pass it asframework/platformto every tool call, and never apply APIs, events, binding syntax, or state patterns from one framework to another.src/tools/constants.tsUSAGE_GUIDEthat explicitly calls out the incompatibility of Igx/Igr/Igb/Igc APIs and mandates always passingplatform.search_apitool description to prefer passingplatformwhen the target framework is known, instead of encouraging omission.src/tools/handlers.ts— Whensearch_apiis called withoutplatformand the results span more than one framework, the response now prepends a warning: "⚠ Results span multiple frameworks. Only use entries that match your target framework — never apply APIs, events, or binding syntax from one framework to another."