Paths from a node
query_graph_pathsFollow stored relations from one node along paths of up to four hops, optionally to a target, when the user asks what a node leads to; find_shortest_paths answers how two named nodes connect. Input: the start as source_node_id (this room's opaque node id) or source_ref (as get_node takes it: external id, alt id, IRI, exact name or node_id), one of the two required; the end as target_node_id or target_ref; namespace_id, max_hops, limit. Returns bounded, ordered paths of EXISTING edges, each step with its stable id, stored orientation, type and evidence references (fetch accepts the ids). An indirect A->B->C path is not an asserted A->C relation; label any such hypothesis NOT_CONFIRMED and cite the observed path. An empty result with truncated=true means not found within the budget, never that no connection exists. When truncated, pass next_cursor as cursor until search_complete is true. No model, embedding, Graphiti or write call. Each step is a persisted edge with semantic type and authorized evidence references. Paths are bounded to the authorized Meaning-Space and come in one fixed, deterministic length-major order: every path of h hops before any of h+1, each group in the order of its prefix (every one-hop path, then the two-hop paths grouped by their first edge), so a page of three- or four-hop paths is reached with min_hops or by paging. Read page 1 as the strongest paths, not as all of them. A frontier three hops out is thousands of paths on an ontology: how two named nodes are connected is the question of find_shortest_paths, which searches from both ends and returns every shortest path in one call; this tool enumerates the paths from one node. min_hops lists a frontier alone: 2 lists only the paths through one node to the nodes beyond it, in the same order and pages as the full enumeration, which a first page of a node with more direct partners than limit never reaches (a page of a vault linking a hundred sites: the other pages that share one); 1, the default, lists the one-hop paths first; greater than max_hops is INVALID_GRAPH_BOUND. hop_relation_types names the types each hop may use (a meta-path), one entry per hop from the first; an empty entry means any type, and the hops beyond its length take relation_types: OCCURS_IN then HAS_AYAH walks from a lemma to its verses and on to their surahs. More entries than max_hops is INVALID_GRAPH_BOUND. relation_types restricts every hop to the given types (for example CO_OCCURS or OCCURS_IN), as query_graph_neighbors filters them. sort_by is the order edges are followed in at every node, which is the order paths are enumerated and paged in: weight, the default, follows the heaviest edge first (the bundle's weight, else count, else occurrences; unweighted edges last) with the edge id as the tie-breaker; id follows edge ids. Deterministic per generation. direction: OUTGOING follows a directed edge in its stored orientation, and an edge its bundle declares undirected from either end, as query_graph_neighbors treats it; INCOMING follows a directed edge against its stored orientation and BOTH either way, at every hop, so a node many edges end at (a class its subclasses point to) is a start too. Each relationship reports its stored orientation (source_id, target_id) and direction flag, whichever way it was walked, and carries its weight and the bundle's edge properties (weight_semantics when the bundle states it). data_mode: one physical edge model per request; AUTO resolves the room's single data mode and fails with DATA_MODE_SELECTOR_REQUIRED when ambiguous. When no path exists because an end node lacks edges, warnings say so (ISOLATED_NODE, NO_OUTGOING_EDGES, NO_INCOMING_EDGES) instead of a silent empty result. Curated relations are followed too (layer CURATED, unweighted, so after the weighted edges at a node), each with its curation (author, version, evidence) and source_refs to the room sources its evidence names. source_node_id is the node_id of a search or fetch result, or an id from overview, neighbors or paths, never a physical graph key; with target_node_id only observed paths ending at that node are returned. One of source_ref and source_node_id is required, not both, and at most one of target_ref and target_node_id: a reference resolves as get_node resolves ref (its external id as the bundle states it, such as GO:0008150, one of its alt_ids, its IRI, a name a property of exactly one node states, or a node_id), with NODE_REF_AMBIGUOUS and its candidates when several nodes match and GRAPH_NODE_NOT_FOUND when none does, and the response's source_node_id is the node it resolved to. A node_id from another room is GRAPH_NODE_NOT_FOUND with a message saying so: a node_id belongs to one room. limit is the name every tool uses for the size of its answer (max_paths is its deprecated alias; passing both is SCHEMA_VALIDATION_FAILED). Example: {"source_ref": "GO:0005739", "max_hops": 2, "namespace_id": "obo-go"}. Since contract 4.2.0 paths follow the heaviest edge first and an undirected edge is followed from either end. Since contract 4.3.0 paths also follow curated relations. Since contract revision 4.5.0 min_hops lists a frontier alone. Since contract revision 4.6.0 max_hops goes to 4, hop_relation_types types each hop, INCOMING and BOTH walk against the stored orientation, and a cursor carries one edge id per hop. Since contract revision 4.9.0 either end may be given by reference (source_ref, target_ref), and limit is the name of max_paths (which stays as a deprecated alias). The contract revision in force is the one every response repeats in _meta.contract_revision and server_info reports; a revision note (Added in, Since) says when a field or a tool appeared, never which revision is current.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "query_graph_paths"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Paths per page. | |
| cursor | No | next_cursor of the previous page of the same request. | |
| sort_by | No | weight: heaviest edge first. id: by edge id. | weight |
| max_hops | No | Longest path listed. | |
| min_hops | No | Shortest path listed; 2 skips the one-hop paths. | |
| data_mode | No | Edge model to read; AUTO resolves the room's single mode. | AUTO |
| direction | No | How a directed edge is walked at every hop. | OUTGOING |
| max_paths | No | Deprecated since contract revision 4.9.0: pass limit instead (one name for every answer's size); still accepted. | |
| source_ref | No | Start node by reference, as get_node's ref. | |
| target_ref | No | End node by reference, as get_node's ref. | |
| namespace_id | No | Room name; omitted: the default room. | |
| relation_types | No | Only these relation types, at every hop. | |
| source_node_id | No | Start node's node_id, or pass source_ref. | |
| target_node_id | No | End node's node_id, or pass target_ref. | |
| hop_relation_types | No | Relation types per hop, from the first; an empty entry means any. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodes | Yes | ||
| paths | Yes | ||
| stats | Yes | ||
| sort_by | No | Added in contract revision 4.2.0. The order the paths were enumerated in. | |
| max_hops | Yes | ||
| min_hops | No | Added in contract revision 4.5.0. The request's min_hops (1 when it gave none). | |
| warnings | No | Added in contract revision 4.1.0. Set when no path exists because an end node has no edge (ISOLATED_NODE) or only edges the other way round (NO_OUTGOING_EDGES for the source, NO_INCOMING_EDGES for the target); empty otherwise. | |
| data_mode | Yes | ||
| direction | Yes | The request's direction (OUTGOING when it gave none); INCOMING and BOTH since contract revision 4.6.0. | |
| read_only | Yes | ||
| truncated | Yes | ||
| generation | Yes | ||
| next_cursor | No | Added in contract revision 3.1.0. Set exactly when truncated is true; send it as cursor with the same request for the next page. Pages of one generation never overlap or skip. | |
| namespace_id | Yes | ||
| source_node_id | Yes | ||
| target_node_id | Yes | ||
| search_complete | Yes | ||
| truncation_reasons | Yes |