Skip to main content
Glama

BYOKG

Neighbors of a node

query_graph_neighbors
Read-onlyIdempotent

List the stored relations around one node, one page at a time, when you need the edges themselves (get_node_stats first when the node has many). Input: node_id (required: this room's opaque node id from search, get_node, explore or paths, never an external id) and namespace_id; limit pages. Returns each edge with its relation type, stored direction, weight (the bundle's strength, such as the shared-ayah count on CO_OCCURS) and properties, and the node it reaches; total counts every match. Filter by relation_types, labels of the far node and direction; sort_by weight (the default), degree or id. Pass next_cursor as cursor to page until it is null. Deterministic for one generation, no model call. A node without any edge returns warning ISOLATED_NODE with the reason its record gives (LEMMA_WITHOUT_ROOT), so an empty page is never silent. No answer synthesis. 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. depth walks 1 or 2 hops. sort_by: weight lists the heaviest first (unweighted last), degree the best-connected far nodes first, id by far node id; ties by edge id, and hop 1 before hop 2; the same request on the same generation returns the same pages. direction is seen from the near node; an undirected edge has no direction and matches OUT and IN. labels are a bundle node's own labels, such as Root, Lemma, Ayah or Surah; relation_types for example CO_OCCURS or OCCURS_IN. Example: {"node_id": "<node_id>", "namespace_id": "obo-go", "limit": 20}. Since contract 4.3.0 curated relations (typed, versioned, evidence-backed edges kept over the imported graph, made with curate_relation) appear among the edges with layer CURATED and their curation: author, version, status and evidence. 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

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": {
      "node_id": "<node_id>"
    },
    "name": "query_graph_neighbors"
  }
}

Input Schema

NameRequiredDescriptionDefault
depthNoHops to walk from the node, 1 or 2.
limitNoRelations per page.
cursorNonext_cursor of the previous page of the same request.
labelsNoOnly relations whose far node has one of these labels.
node_idYesThis room's opaque node id, never an external id.
sort_byNoweight: heaviest first. degree: best-connected far nodes first. id: by far node id.weight
directionNoSeen from the near node; an undirected edge matches OUT and IN.BOTH
namespace_idNoRoom name; omitted: the default room.
relation_typesNoOnly relations of these types.

Output Schema

NameRequiredDescriptionDefault
edgesYes
nodesYes
totalNoAdded in contract revision 3.1.0. Every relation the request matches, over all pages.
sort_byNo
warningsNoAdded in contract revision 4.1.0. Set when the node has no edge at all (ISOLATED_NODE with the reason its record gives), so an empty answer reflects missing data rather than the request; empty otherwise.
truncatedYes
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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, closed-world and non-destructive, so the safety profile is covered. The description nonetheless adds genuinely non-obvious behavior beyond them: determinism per generation, no model call, the ISOLATED_NODE warning with its reason code, CURSOR paging until next_cursor is null, and the CURATED layer metadata. However, it buries the return-shape and pagination details inside a dense paragraph rather than surfacing them cleanly, so the added context is present but not well-delivered.

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?

Front-loaded with the core purpose and the get_node_stats alternative, which is good, but it then runs as a single very long block that repeats node_id provenance twice and detours into contract-revision policy. Much of the content earns its place, but the packaging makes it hard to scan and some clauses are redundant.

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

Completeness4/5

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

An output schema exists, so return values did not need spelling out, yet the description covers edge fields, total counts, warnings and curation metadata anyway, leaving little ambiguity for a 9-parameter paginated query. It is complete for correct invocation, with only minor overshoot into revision bookkeeping.

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

Parameters4/5

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

Schema coverage is 100%, so the schema already documents each of the 9 parameters, setting a baseline of 3. The description still adds real meaning the schema lacks: tie-breaking by edge id and hop-1-before-hop-2 ordering, undirected edges matching both OUT and IN, and that labels/relation_types apply to the far node.

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?

Opens with a specific verb and resource ("List the stored relations around one node, one page at a time") and immediately carves out its niche versus get_node_stats and, implicitly, get_node/paths. An agent can tell from the first sentence that this returns edges, not the node itself and not a path.

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?

Explicitly routes the agent: use get_node_stats first when the node has many edges, and use this when "you need the edges themselves." It also names the valid sources for node_id (search, get_node, explore, paths) and rules out external ids, and states "No answer synthesis" so the agent knows this is a retrieval, not a reasoning, step.

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