Skip to content

Fix [MCP] Enforce library boundaries in search_api and server instructions#1694

Merged
kdinev merged 1 commit into
masterfrom
ipetrov/fix-1620-enforce-library-boundaries
May 19, 2026
Merged

Fix [MCP] Enforce library boundaries in search_api and server instructions#1694
kdinev merged 1 commit into
masterfrom
ipetrov/fix-1620-enforce-library-boundaries

Conversation

@ivanvpetrov
Copy link
Copy Markdown
Contributor

Closes #1620

Problem

When search_api is called without a platform argument, 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 instructions field and the USAGE_GUIDE prompt 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 — Extended server.instructions with an explicit LIBRARY BOUNDARY RULE: once the target framework is identified, always pass it as framework/platform to every tool call, and never apply APIs, events, binding syntax, or state patterns from one framework to another.

  • src/tools/constants.ts

    • Added a "Library Boundary Rules" section to USAGE_GUIDE that explicitly calls out the incompatibility of Igx/Igr/Igb/Igc APIs and mandates always passing platform.
    • Updated the search_api tool description to prefer passing platform when the target framework is known, instead of encouraging omission.
  • src/tools/handlers.ts — When search_api is called without platform and 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."

Copilot AI review requested due to automatic review settings May 19, 2026 07:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 instructions field and a "Library Boundary Rules" section to the USAGE_GUIDE prompt.
  • Updated the search_api tool description to encourage always passing platform when known.
  • Added a multi-framework warning prefix to search_api responses when platform is 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.

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 87.371%. remained the same — ipetrov/fix-1620-enforce-library-boundaries into master

@kdinev kdinev merged commit a806506 into master May 19, 2026
7 checks passed
@kdinev kdinev deleted the ipetrov/fix-1620-enforce-library-boundaries branch May 19, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CLI MCP]: Generation mixes one library binding patterns with Ignite UI APIs

4 participants