Skip to content

Conversation

clydin
Copy link
Member

@clydin clydin commented Sep 9, 2025

See individual commits.

This commit significantly enhances the `find_examples` MCP tool to improve its usability and the quality of its output, primarily from an LLM interaction perspective.

Key changes include:

1.  **Structured Output:** The tool's output schema is updated to return rich metadata for each example, including its `title`, `summary`, `keywords`, and `required_packages`. This allows the AI to present results more intelligently and check for prerequisites.

2.  **Prescriptive Schema Descriptions:** The descriptions for both the input and output schemas have been rewritten to be more prescriptive. They now guide the AI on *how* and *why* to use specific fields, acting as a form of prompt engineering to elicit more precise queries and better-formatted responses.

3.  **Code Refactoring:** The output schema definition has been moved to a module-level constant to improve code readability and consistency, reducing nesting in the main tool declaration.
This commit introduces a feature to mark and filter code examples that use experimental APIs, ensuring that the `find_examples` tool provides production-safe results by default.

Key changes:
- The example format now supports an optional `experimental: true` flag in the front matter.
- The database schema is updated with an `experimental` column. Both the build-time and runtime database generators now parse and store this flag.
- The `find_examples` tool's input schema is enhanced with an `includeExperimental` boolean flag, which defaults to `false`.
- The query logic is updated to filter out experimental examples unless `includeExperimental` is explicitly set to `true`.
- The schema description for the new flag includes a strong prescriptive guardrail, instructing the AI to warn the user when it shows an experimental example.
This commit enhances the `find_examples` tool by adding support for contextual snippets in the search results.

Key changes:
- The SQL query now uses the FTS5 `snippet()` function to generate a snippet of the matched content, with search terms highlighted.
- The tool's output schema is updated with a new optional `snippet` field.
- The description for the new `snippet` field is highly prescriptive, teaching the AI how to use snippets to enable more sophisticated and efficient agentic workflows, such as summarizing results for the user or performing internal evaluation before selecting the best result.
@clydin clydin added the target: major This PR is targeted for the next major release label Sep 9, 2025
@clydin clydin requested a review from alan-agius4 September 9, 2025 12:43
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 9, 2025
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 9, 2025
@alan-agius4 alan-agius4 merged commit dbf1aaf into angular:main Sep 9, 2025
34 of 35 checks passed
@clydin clydin deleted the mcp/find-examples-frontmatter branch September 9, 2025 13:22
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants