Skip to main content
Glama

BYOKG

Paths from a node

query_graph_paths
Read-onlyIdempotent

Follow 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

NameRequiredDescriptionDefault
limitNoPaths per page.
cursorNonext_cursor of the previous page of the same request.
sort_byNoweight: heaviest edge first. id: by edge id.weight
max_hopsNoLongest path listed.
min_hopsNoShortest path listed; 2 skips the one-hop paths.
data_modeNoEdge model to read; AUTO resolves the room's single mode.AUTO
directionNoHow a directed edge is walked at every hop.OUTGOING
max_pathsNoDeprecated since contract revision 4.9.0: pass limit instead (one name for every answer's size); still accepted.
source_refNoStart node by reference, as get_node's ref.
target_refNoEnd node by reference, as get_node's ref.
namespace_idNoRoom name; omitted: the default room.
relation_typesNoOnly these relation types, at every hop.
source_node_idNoStart node's node_id, or pass source_ref.
target_node_idNoEnd node's node_id, or pass target_ref.
hop_relation_typesNoRelation types per hop, from the first; an empty entry means any.

Output Schema

NameRequiredDescriptionDefault
nodesYes
pathsYes
statsYes
sort_byNoAdded in contract revision 4.2.0. The order the paths were enumerated in.
max_hopsYes
min_hopsNoAdded in contract revision 4.5.0. The request's min_hops (1 when it gave none).
warningsNoAdded 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_modeYes
directionYesThe request's direction (OUTGOING when it gave none); INCOMING and BOTH since contract revision 4.6.0.
read_onlyYes
truncatedYes
generationYes
next_cursorNoAdded 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_idYes
source_node_idYes
target_node_idYes
search_completeYes
truncation_reasonsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnlyHint/idempotentHint annotations, the description discloses deterministic length-major ordering, truncation semantics ('an empty result with truncated=true means not found within the budget, never that no connection exists'), warning codes such as ISOLATED_NODE, data_mode failure behavior, and the rule that indirect paths are not asserted relations. That is unusually rich behavioral context for an agent invoking or interpreting the tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and key contrasts are front-loaded, but the description is extremely dense and repeats min_hops semantics in multiple places. The closing contract-revision history from 4.2.0 through 4.9.0 is lengthy and mostly irrelevant to selecting or invoking the tool, and many sentences are multi-clause run-ons that reduce scannability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 15-parameter graph traversal tool with an output schema, the description covers purpose, sibling differentiation, parameter resolution rules, pagination, ordering, truncation, warnings, and error codes. Nothing an agent needs in order to call it correctly appears to be missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100% and the baseline would be 3, the description adds substantial meaning beyond the schema: source_ref resolves as get_node resolves ref, source_node_id is never a physical graph key, max_paths is a deprecated alias for limit, hop_relation_types is a per-hop meta-path with a concrete OCCURS_IN/HAS_AYAH example, and min_hops lists a frontier alone. These are semantic rules an agent cannot infer from the schema alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening states a specific verb and resource — 'Follow stored relations from one node along paths of up to four hops' — and immediately distinguishes the tool from find_shortest_paths. An agent can tell what this tool does and what it does not do without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly contrasts this tool with find_shortest_paths: this one enumerates paths from one node, while find_shortest_paths answers how two named nodes connect by searching from both ends. It also explains when to use min_hops, when to page with cursor, and how direction and sort_by change the result, leaving little to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources