Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/igniteui-mcp/igniteui-doc-mcp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ const server = new McpServer(
"React → Igr prefix (IgrGrid), package 'igniteui-react', .tsx files. " +
"Blazor → Igb prefix (IgbGrid), package 'IgniteUI.Blazor', .razor files. " +
"Web Components → Igc prefix + Component suffix (IgcGridComponent), package 'igniteui-webcomponents', .ts+.html with custom elements. " +
"If the framework is unclear from context, ask the user.",
"If the framework is unclear from context, ask the user. " +
"LIBRARY BOUNDARY RULE: Once the target framework is identified, always pass it as the 'framework' or 'platform' parameter to every tool call. " +
"Never apply component APIs, event names, binding syntax, prop names, or state patterns from one framework to code in another framework. " +
"Angular (Igx), React (Igr), Blazor (Igb), and Web Components (Igc) each have distinct APIs — they are not interchangeable.",
}
);

Expand Down
11 changes: 10 additions & 1 deletion packages/igniteui-mcp/igniteui-doc-mcp/src/tools/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Use this as the discovery step when the exact component name is unknown — e.g.

Each result includes: exact component name, framework tag, API type (class/interface/directive/enum), match count, keyword list, and a content excerpt. Pass the component name and framework from a result to get_api_reference for full details. To reduce response size, use section="properties", "methods", or "events" instead of the default "all".

Omit framework to search all frameworks at once. Maximum query length is 256 characters.
Always specify \`platform\` when your target framework is known — this prevents cross-framework API contamination. Omit only when you explicitly need to compare or search across all frameworks at once. Maximum query length is 256 characters.
`
};

Expand Down Expand Up @@ -132,6 +132,15 @@ Most tools require a \`framework\` parameter. Determine the framework from the u
4. **User's explicit statement** — "I'm using Angular", "Blazor project", etc.
5. **Ask the user** if none of the above apply

## Library Boundary Rules

> **These rules are mandatory. Violating them produces code that looks valid but fails at runtime.**

- **Always pass \`framework\` / \`platform\` to every tool call once the target framework is known.** Do not omit it.
- **Never mix APIs across frameworks.** Angular (\`Igx\`), React (\`Igr\`), Blazor (\`Igb\`), and Web Components (\`Igc\`) each have distinct component names, event shapes, prop names, binding syntax, and state models. They are not interchangeable.
- **Do not apply Angular patterns to React code** (or any other cross-framework combination). For example: Angular template bindings (\`(cellEditDone)\`), directive imports (\`IGX_GRID_DIRECTIVES\`), and signal-based \`viewChild\` are Angular-only. React uses callback props, hook-based state, and \`useRef\`.
- **When \`search_api\` returns results from multiple frameworks, only use entries that match your target framework.**

## Documentation Tools

- **\`search_docs\`** — full-text search when user asks "how do I..." or describes a feature need
Expand Down
7 changes: 6 additions & 1 deletion packages/igniteui-mcp/igniteui-doc-mcp/src/tools/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export function createSearchApiHandler(docLoader: ApiDocLoader) {
return `**${h.entry.component}** ${platformTag} ${typeTag} (${h.matches} matches)${kwTag}\n${h.excerpt}`;
});

return { content: [{ type: "text", text: lines.join("\n\n") }] };
const frameworks = new Set(hits.map(h => h.entry.platform));
const crossPlatformWarning = !platform && frameworks.size > 1
? `⚠ Results span multiple frameworks (${[...frameworks].join(', ')}). Only use entries that match your target framework — never apply APIs, events, or binding syntax from one framework to another.\n\n`
: '';

return { content: [{ type: "text", text: crossPlatformWarning + lines.join("\n\n") }] };
};
}
Loading