execute_gql
Run one GQL statement in the graph database to match multi-hop patterns, filter, aggregate, or upsert with MERGE. Use it to read and write nodes and edges in a single call.
Instructions
Run one GQL statement: multi-hop patterns, filters, aggregations, MERGE upserts, label changes.
Cypher syntax (CREATE, MERGE, OPTIONAL MATCH, DETACH DELETE) runs as written. Rules:
One statement per call; chain clauses instead (MATCH ... INSERT ...).
Put values in params as $name, not in the text. Embeddings too: a list literal is stored as a list, which vector indexes skip.
1.5 is an exact decimal (0.1 + 0.2 = 0.3); 1.5e0 is a float. Overflow and division by zero fail.
No WHERE right after INSERT, CREATE, MERGE or DELETE: filter before the write, or WITH ... WHERE after it.
A path pattern in WHERE needs EXISTS: WHERE EXISTS { (p)-[:WORKS_AT]->(:Company) }, not WHERE (p)-->(..).
DELETE takes variables: MATCH (b)-[w:WORKS_AT]->(c) DELETE w, not DELETE (b)-[:WORKS_AT]->(c).
ORDER BY puts nulls last.
Returns {columns, rows, total_rows}; a node in a row is a map with _id, _labels and its properties, an edge has _id, _type, _source, _target. Writes add counters. A read that finds nothing, or only nulls, gets a hint naming the labels, edge types or properties that do not exist.
Example: MERGE (p:Person {name: $name}) SET p += $props RETURN id(p) AS id with params={"name": "Ada", "props": {"born": 1815}}
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "execute_gql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Most rows to return; LIMIT in the query also works. | |
| query | Yes | One GQL statement. | |
| params | No | Values for $name in the query: {"name": "Ada"}. |