GraphQueryTools

class GraphQueryTools(graphQuery: GraphQuery)

LLM-invocable tools for exploring the graph view over proposition data.

Wraps the GraphQuery facade as @LlmTool methods so an LLM agent can walk entity neighbourhoods, find paths between entities, and ask why a proposition holds — without any graph backend, since the facade derives edges from proposition mentions.

Scope is inherited from the delegate: the GraphQuery is constructed with its own contextId, so every tool call is confined to that context. The tools deliberately expose no contextId argument, so an agent cannot read across context boundaries (mirroring how Memory bakes the context in at construction).

All calls return read-only, human-readable Tool.Result.text. Empty results yield graceful text ("No related entities found ...", "No path found ...") rather than throwing, and an unknown proposition id yields Tool.Result.error.

Usage — registered by the consuming application alongside Memory:

val graphQuery = GraphQuery(propositionStore, contextId)
val tools: List<Tool> = GraphQueryTools.asTools(graphQuery)
// Add to the agent's tool set, e.g. together with Memory.forContext(contextId)...

Parameters

graphQuery

the graph-query facade to delegate to; its contextId scope is inherited

Constructors

Link copied to clipboard
constructor(graphQuery: GraphQuery)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun entityNeighborhood(entityId: String, depth: Int = 1): <Error class: unknown class>

Explore the entities directly or transitively related to a given entity.

Link copied to clipboard
fun pathBetween(entityIdA: String, entityIdB: String): <Error class: unknown class>

Find how two entities are connected, as a chain of intermediate entities and facts.

Link copied to clipboard
fun whyExplain(propositionId: String): <Error class: unknown class>

Explain why a stored fact holds: its grounding, sources, reinforcement, status and validity.