Introduction
Build agentic graph queries that evolve step-by-step without rebuilding from scratch. HelixDBβs MCP endpoints provide a stateful, incremental query session via aconnection_id
, so each call extends the same traversal. This allows agents to chain and build complex traversal and filter queries over time while being able to view intermediate results. Stream results with mcp/next
or batch with mcp/collect
.
You can also dynamically pass lists created at runtime, toggle AND/OR property groups, and filter by temporary traversals. Run multiple traversals in concurrently and asynchronously using multiple connection IDs by initializing each traversal with its own connection_id
to keep them separate and easy to manage.
MCP Tools
These tools are used to manage the MCP connection and interact with the MCP endpoints.Initialization init
Endpoint "mcp/init"
Creates a new MCP connection, which is a blank traversal.
The request for this endpoint is empty ({}
).
Response Format
Iterate Results next
Endpoint "mcp/next"
Returns the next item in the MCP traversal results.
Request Format
Connection ID of the MCP connection
Collect Results collect
Endpoint "mcp/collect"
Collects all the results from the MCP traversal.
Request Format
Connection ID of the MCP connection
Range of results to collect (default:
{"start": 0, "end": -1}
)Resets the traversal after collecting results (default:
true
)Reset Connection reset
Endpoint "mcp/reset"
Resets the MCP connection with the given connection ID to a blank traversal.
Request Format
Connection ID of the MCP connection
Schema Context schema_resource
Endpoint "mcp/schema_resource"
Returns the schema and query information of the database for LLM context.
Request Format
Connection ID of the MCP connection
MCP Traversals
These tools are used to dynamically traverse the graph and retrieve nodes and edges. However, they do not return the results of the traversal.Retrieve Nodes n_from_type
Endpoint "mcp/n_from_type"
Retrieves all nodes of a given type.
Request Format
Connection ID of the MCP connection
The label of node to retrieve (name in schema)
Retrieve Edges e_from_type
Endpoint "mcp/e_from_type"
Retrieves all edges of a given type.
Request Format
Connection ID of the MCP connection
The label of edge to retrieve (name in schema)
Out out_step
Endpoint "mcp/out_step"
Traverses out from current nodes or vectors in the traversal with the given edge type to nodes or vectors.
Assumes that the current state of the traversal is a collection of nodes or vectors that is the source of the given edge type and label.
Request Format
Connection ID of the MCP connection
The target entity (
node
or vec
)The label of edge to traverse out (name in schema)
OutE out_e_step
Endpoint "mcp/out_e_step"
Traverses out from current edges to their target nodes or vectors.
Assumes that the current state of the traversal is a collection of edges with the target of the given edge label.
Request Format
Connection ID of the MCP connection
The label of edge to traverse out (name in schema)
In in_step
Endpoint "mcp/in_step"
Traverses into the current nodes or vectors in the traversal with the given edge type to nodes or vectors.
Assumes that the current state of the traversal is a collection of nodes or vectors that is the target of the given edge type and label.
Request Format
Connection ID of the MCP connection
The source entity (
node
or vec
)The label of edge to traverse into (name in schema)
InE in_e_step
Endpoint "mcp/in_e_step"
Traverses into the current edges to their source nodes or vectors.
Assumes that the current state of the traversal is a collection of edges with the source of the given edge label.
Request Format
Connection ID of the MCP connection
The label of edge to traverse into (name in schema)
MCP Filter Tool
Filter filter_items
Endpoint "mcp/filter_items"
Filters the current state of the traversal.
Request Format
filters
is a list of filters to apply to the current state of the traversal.
The format of the filters is as follows:
Property Filter
The property filter is used to filter the current state of the traversal by the properties of the entity. The outer list is theOR
operation and the inner list is the AND
operation.
The name of the property to filter on
The operator to use for the filter
The value to filter on
Operators
Operator | Description | Operator | Description |
---|---|---|---|
== | equals | != | not equals |
> | greater than | >= | greater than or equal to |
< | less than | <= | less than or equal to |
List to value and value to list comparisons will use the OR operator for each element in the list.
List to list comparisons will also use the OR operator for each element in each list.This allows for using
List to list comparisons will also use the OR operator for each element in each list.This allows for using
contains
and not_contains
operators by using the ==
and !=
operator with a list of values.Traversal Filter
The traversal filter is used to filter the current state of the traversal by the results of a traversal. It doesnβt actually change the state of the current traversal, it just temporarily traverses and checks the results of the traversal. You can have nested filters in the inner filter layer, which can include property and traversal filters with the same structure. The traversal filter only has anAND
operation.
MCP Aggregation Tools
Group group_by
Endpoint "mcp/group_by"
Groups the current state of the traversal by the given properties.
It returns a list of unique property combinations and their count.
Request Format
Connection ID of the MCP connection
The properties to group by
Aggregate aggregate_by
Endpoint "mcp/aggregate_by"
Aggregates the current state of the traversal by the given properties.
It returns a list of groups of jsons each with a count and data as a list of items in that group.
Request Format
Connection ID of the MCP connection
The properties to aggregate by
Order order_by
Endpoint "mcp/order_by"
Orders the current state of the traversal by a given property in ascending or descending order.
Request Format
Connection ID of the MCP connection
The property to order by
The order to use for the property (asc or desc)
MCP Search Tools
SearchV search_vector
Endpoint "mcp/search_vector"
Searches for vectors by their vector representation with the given vector.
It returns the top k
results with a minimum score of min_score
.
Additionally, you can continue the traversal from the search results by using the traversal tools.
Request Format
Connection ID of the MCP connection
The vector to search for
The number of results to return
The minimum score to return (default:
0.0
)SearchV Text search_vector_text
Endpoint "mcp/search_vector_text"
Searches for vectors by their vector representation with given text.
It uses the embedding inside the database to embed the text and then does HNSW search for the vector.
It returns the top 5 results of the vectors with the label
.
Request Format
Connection ID of the MCP connection
The text to search for
The label of the vectors to search for (name in schema)
Search BM25 search_keyword
Endpoint "mcp/search_keyword"
Searches for nodes of the given label by their keyword representation using BM25.
Request Format
Connection ID of the MCP connection
The text to search for
The label of the node, edge, or vector to search for (name in schema)
The number of results to return
Knowledge Graph Examples
In this example, we will be using the Python SDK to interact with the MCP endpoints on a local instance of HelixDB. We will use a knowledge graph with the schema below, which has a triplet node to represent a fact and an entity node to represent the subject and object of the triplet. We will also have an embedding of the tripletβs summary defined as a vector node. Schema.hxClick here for more information about the Python SDK.
1. Filter properties by a list of values.
We will filter the entities with the names βJohnβ or βJaneβ.2. Filter multiple properties by a list of values.
We will filter the entities with the names βJohnβ or βJaneβ and the created_at property between 2025-01-01 and 2025-01-31.3. Filter properties by multiple lists of values.
We will filter by date range of thecreated_at
property from January to March or June to September.
3. Filter by traversal result properties.
We will filter the triplets connected to the subject name βJohnβ.This example has 2 answers:
4. Filter by multiple traversal results.
We will filter the triplets connected to the subject name βJohnβ and the object name βJaneβ.5. Collecting intermediate results.
We will get all triplets and their embeddings in one MCP connection.6. Search by vector.
We will search for the top 10 triplets that are most similar to an example embedding of[0.1, 0.2, 0.3, 0.4, 0.5]
with a minimum score of 0.7.