Skip to content

feat(mcp): improve VFromType with filter support#871

Open
nodfans wants to merge 2 commits intoHelixDB:mainfrom
nodfans:feat/mcp-vfromtype
Open

feat(mcp): improve VFromType with filter support#871
nodfans wants to merge 2 commits intoHelixDB:mainfrom
nodfans:feat/mcp-vfromtype

Conversation

@nodfans
Copy link
Copy Markdown

@nodfans nodfans commented Feb 19, 2026

Description

This PR enhances the MCP toolset by improving the VFromType tool and removing redundant functionality:

  • VFromType Improvement: Added optional filter: Option support. This allows for metadata-based filtering of vectors during initial retrieval, consistently aligning with the functionality of NFromType and EFromType.

Checklist when merging to main

  • No compiler warnings (if applicable)
  • Code is formatted with rustfmt
  • No useless or dead code (if applicable)
  • Code is easy to understand
  • Doc comments are used for all functions, enums, structs, and fields (where appropriate)
  • All tests pass
  • Performance has not regressed (assuming change was not to fix a bug)
  • Version number has been updated in helix-cli/Cargo.toml and helixdb/Cargo.toml

Greptile Summary

This PR adds a new VFromType MCP tool that retrieves vectors by type label with optional metadata filtering support. The implementation follows the existing pattern used by OutStep, InStep, and other tools that support optional filters by wrapping the base traversal with apply_filter when a filter is provided. The code is well-structured and integrates cleanly with the existing traversal system.

Key changes:

  • Added VFromTypeAdapter import from the source module
  • Added VFromType variant to the ToolArgs enum with vector_type: String and filter: Option<FilterTraversal> fields
  • Implemented the VFromType case in apply_step that calls v_from_type(label, true) to retrieve vector data and conditionally applies filtering

The implementation is correct and follows established patterns in the codebase.

Important Files Changed

Filename Overview
helix-db/src/helix_gateway/mcp/tools.rs Adds VFromType tool with optional filter support for retrieving vectors by type

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[VFromType Tool Args] --> B{Parse vector_type and filter}
    B --> C[Allocate label in arena]
    C --> D[Call G.v_from_type with label and get_vector_data=true]
    D --> E[Create TraversalStream from iterator]
    E --> F{Filter provided?}
    F -->|Yes| G[apply_filter with FilterTraversal]
    F -->|No| H[Return unfiltered stream]
    G --> I[Filter by properties and/or sub-traversals]
    I --> J[Return filtered TraversalStream]
    H --> J
    J --> K[Results ready for consumption]
Loading

Last reviewed commit: dbcdf25

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@xav-db
Copy link
Copy Markdown
Member

xav-db commented Feb 19, 2026

thanks for this will review

@xav-db
Copy link
Copy Markdown
Member

xav-db commented Feb 19, 2026

@greptile

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.

2 participants