Skip to main content
Glama

query_ontology

Read-only

Run typed graph queries on a compiled ontology to trace relationships, assess impact, and plan costly operations before execution.

Instructions

Analysis archive: analysis_history reads immutable diagnostic Markdown summaries without compiling the graph; use analysisMode, project, limit (1–100 scanned files, default 30), and analysisCursor. analysis_record reads one exact run or review with recordId (UUID). Records retain raw answers, full-body evidence when available, request scope and uncertainty. They are not approved ontology facts; stored qualification describes captured evidence, never current source validity. Reviews are joined to their exact run/finding id. Follow pagination even if a filtered page is empty. These archive operations do not support query_plan. Run graph-engine queries over the freshly compiled ontology artifact. Operations: neighbors (local graph neighborhood), path (one compiled-edge route between two nodes with aligned nodes[] summaries), all_paths (bounded simple paths between two nodes with per-path nodes[] summaries plus limit/searchBudget/exhaustive/truncatedByBudget/totalPathsExact metadata and evidence guidance), query_plan (EXPLAIN-style side-effect-free cost/index estimate plus execution advice before a target operation, filter-preserving suggestedQuery, and filter-aware estimate.totalMatches for match_nodes/match_edges), centrality (PageRank-style core-node ranking plus bridge/authority/hub lists), communities (label-propagation clusters inside the graph), similar_nodes (duplicate/overlap candidates before writes), explain_relation (direct edges, shortest path, and shared-neighbor explanation between two nodes), reachability (transitive graph closure from a start node), pattern_walk (explicit relation-sequence paths such as project → domains → capabilities), impact (incoming by default: what depends on this node), blast_radius (impact grouped by kind/domain with cross-domain edge risk), subgraph (bounded N-hop graph slice for UI/agent views), builder_context (persisted Workshop focus, layout positions, direct graph slice, and safe write handoff; unsaved UI drafts are explicitly excluded; operation name retained for compatibility), overview (counts, relation distribution, and hubs), schema (kind-relation-kind patterns), facets (filter/dashboard aggregates), match_nodes (graph DB-style node rows with degree filters plus a followUp packet for the first returned row), match_edges (graph DB-style edge pattern rows plus a followUp packet for the first returned real edge), node_profile (single node detail dashboard), domain_profile (domain detail dashboard), domain_matrix (domain-to-domain coupling), project_scope (project-contained graph slice), project_map (domain-by-domain project map), relation_check (schema-aware preflight before add_relation), components (connected graph islands), lineage and containment_tree (project/domain/capability containment), cycles (directed dependency-cycle checks), topological_order (prerequisite-first dependency ordering), recommend_relations (safe domain-containment suggestions), growth_plan (side-effect-free ontology expansion candidates), maintenance_plan (ordered post-write graph cleanup/repair actions with stable action id, count-safe summary fields, byPhase / bySeverity / byKind remaining-queue buckets, ready cursor cursor.found=true / cursor.reason=null, cursor nextAfterActionId/hasMore pagination metadata, afterActionId resume, unknown-cursor empty page with cursor.nextAfterActionId=null / cursor.hasMore=false, kind filters, executable graph-array canonicalization, executable flags, and current-page nextExecutableAction / nextReviewAction pointers), agent_brief (Claude Code/Codex handoff prompt, structured businessOntologyLens with business-first outcome → domain → capability → element read order, graphDbQueryPack for facets, schema, match_nodes, match_edges, domain_matrix, centrality, all_paths, explain_relation, and business_questions scans for outcome / domain boundary / capability claim nodes / implementation evidence edges, structured cliFallbackCommands, recipes, graph entrypoints, graph_traversal playbook, traversalStrategy plan_before_enumeration/bounded_path_evidence/containment_cross_check guidance, playbook evidence/stopWhen checklists, write guardrails, relationDecisionGuide, resultContracts for all_paths completeness and match_nodes/match_edges followUp evidence, and read-first write policy), meaning_repair_review (provenance-bound, byte-bounded typed evidence pages and literal full-body read calls for the compact meaning repair manifest), workspace_brief (first-contact status + next actions), and health (one-shot graph integrity dashboard whose relationCensus labels compiler declaration counts and the nonnumeric canonical app-map comparison unit). For agent_brief, select project explicitly when the vault has more than one project. Omitted detail and detail:"full" return the complete project-scoped diagnostic contract. For a known coding task, call detail:"compact" directly after connection_info; do not precede it with workspace_brief or a full inventory unless the question needs whole-vault health. Compact v2 requires a nonblank request-local task (max 2000 characters) and returns at most 12000 UTF-8 JSON bytes: final source/meaning currentness, claim-compatible broad capability selection, persisted element/path evidence, explicit unknown impact and verification, exact full-body next reads, and a detail:"full" follow-up. Definition and Includes support desired work; Excludes may align with explicit non-goals, while a desired/negative boundary conflict, an unsupported claim, or a tied top claim returns no capability. Its content[0].text is the bounded handoff prompt while structuredContent carries the typed facts once. When the selected element Markdown contains reviewed Primary implementation / Supporting implementation / Focused test coordinates and the bound source is current, taskNavigation verifies only those named files and returns exact current lines plus the reviewed non-exhaustive IN/OUT boundary. After those reads, Atlas rechecks the same source identity, fingerprint, revision, and graph hash; any mismatch removes the exact target and downgrades the complete outer currentness contract. A ready prompt reads primary, supporting, focused tests, and a verified manifest together; requires named positive and negative regression tests with exact observable output; and runs the focused check once followed by one non-overlapping full check. Missing, ambiguous, stale, unsafe, or unrecorded coordinates emit no exact target. Task matching selects evidence only; it never searches the repository, never proves source behavior, never persists task text, never approves meaning, and never writes the vault. For impact and blast_radius, only declared depends_on is allowed; use reachability/subgraph for structure. Blast radius reports unknown risk/completeness plus review_required or declared_with_rationale edge qualification until relation-level source receipts exist. A missing depends_on preflight is schema-only: relation_check returns proposedAction:null plus a non-writing approvalGate until the agent explains the observable ability and semantic rationale and receives explicit human approval. Accepts canonical slugs or unique aliases. side effect 0. Use this when you need graph-database-like answers without pulling the full compile_ontology payload.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNoTarget node slug or unique alias. Required for path, all_paths, and explain_relation.
fromNoSource node slug or unique alias. Required for path, all_paths, and explain_relation.
kindNomatch_nodes: optional node kind filter (project, domain, capability, element, document, vault-readme). recommend_relations currently supports capability or element.
seedNoAlias for slug when operation is subgraph or builder_context.
slugNoCenter/root node slug or unique alias. builder_context also accepts its own canonical Workshop focusParam (for example domain:auth). Required for neighbors, reachability, pattern_walk, impact, blast_radius, subgraph, builder_context, lineage, node_profile, and domain_profile; optional root for containment_tree.
sortNomatch_nodes only: sort rows by degree, inDegree, outDegree, or slug. Defaults to degree.
taskNoagent_brief detail:"compact" only: request-local coding task used to select persisted capability, element, and reviewed navigation evidence after Definition/Includes/Excludes compatibility. Conflicting, unsupported, or tied claims return no capability. Never persisted, never used to invent a coordinate, and never treated as behavior proof or semantic approval.
typeNoRelation type for relation_check/match_edges, e.g. depends_on, relates, contains, describes, domains, capabilities, elements, or domain.
depthNoreachability/impact/blast_radius/subgraph/lineage/containment_tree traversal depth. Defaults to 3 for reachability, 2 for impact/blast_radius/subgraph, and 20 for lineage/containment_tree; capped at 20.
kindsNomaintenance_plan only: optional action-kind filter, e.g. ["add_missing_relation", "canonicalize_graph_arrays"].
limitNoPositive integer max rows/components/order entries to return. Defaults to 100, capped at 500.
titleNosimilar_nodes only: proposed title for a not-yet-written concept candidate.
typesNoOptional relation types to include, e.g. ["dependencies"] or ["depends_on"].
cursorNomeaning_repair_review only: opaque stateless cursor returned as pagination.nextCursor. Omit for the first page.
detailNoagent_brief only: compact v2 returns a task-scoped, selected-project handoff capped at 12000 UTF-8 JSON bytes, including exact reviewed taskNavigation only when the bound source is current; full returns the complete diagnostic manuals and graph packs. Omit to keep the current full response while compact is being qualified.
domainNomatch_nodes: optional exact domain filter. domain_profile: domain root slug or unique alias.
phasesNomaintenance_plan only: optional phase filter, e.g. ["repair", "link", "materialize"].
toKindNomatch_edges only: optional target kind filter (project, domain, capability, element, document, vault-readme, external, unresolved). Use external or unresolved for non-node refs.
maxHopsNopath/all_paths/explain_relation traversal hop cap or cycles max depth. Defaults to 5 for path/all_paths/explain_relation and 8 for cycles; capped at 20.
patternNopattern_walk only: required relation sequence to follow, e.g. ["domains", "capabilities", "elements"]. depends_on is normalized to dependencies.
projectNodomain_matrix/project_scope/project_map/agent_brief/meaning_repair_review: project root slug or unique alias. Required for meaning_repair_review; optional when exactly one kind: project node exists for the other operations.
fromKindNomatch_edges only: optional source node kind filter (project, domain, capability, element, document, vault-readme). Source must be a real ontology node, not external/unresolved.
recordIdNoanalysis_record only: immutable analysis or diagnostic-review UUID.
relationNoAlias for type when operation is relation_check.
directionNoneighbors/reachability/impact/blast_radius/subgraph/builder_context: incoming, outgoing, or both. path/all_paths/explain_relation/reachability also accepts undirected.
itemLimitNoproject_map only: positive integer max capability/element/hotspot summaries per domain. Defaults to 20, capped at 500.
maxDegreeNomatch_nodes only: non-negative integer maximum total graph degree.
minDegreeNomatch_nodes only: non-negative integer minimum total graph degree.
nodeLimitNocomponents/communities/health/workspace_brief/agent_brief only: positive integer max node summaries per component/community group. Defaults to 25 for components/communities and 10 for health, capped at 500.
operationYesQuery operation to run.
cycleLimitNohealth/workspace_brief/agent_brief only: positive integer max dependency cycles to inspect. Defaults to 5, capped at 500.
iterationsNocentrality/communities only: positive integer PageRank or label-propagation iteration count. Defaults to 20, max 100.
orderLimitNohealth/workspace_brief/agent_brief only: positive integer max topological-order rows to inspect. Defaults to 20, capped at 500.
severitiesNomaintenance_plan only: optional severity filter, e.g. ["fail", "warn"].
hasIncomingNomatch_nodes only: require presence or absence of incoming graph edges.
hasOutgoingNomatch_nodes only: require presence or absence of outgoing graph edges.
minInDegreeNomatch_nodes only: non-negative integer minimum incoming graph degree.
analysisModeNoanalysis_history only: optional analysis subject filter.
minOutDegreeNomatch_nodes only: non-negative integer minimum outgoing graph degree.
searchBudgetNoall_paths, query_plan(all_paths), and cycles: maximum DFS states to expand before returning partial results. Defaults to 5000. For cycles this is the only bound that fires on an ACYCLIC graph — when truncatedByBudget is true, zero cycles does NOT mean acyclic (check totalCyclesExact).
slugContainsNomatch_nodes only: optional case-insensitive substring filter on canonical slug.
afterActionIdNomaintenance_plan only: stable action id cursor; return actions after this id. Without afterActionId the ready page reports cursor.found=true and cursor.reason=null; cursor.nextAfterActionId matches the last returned action id (or null for an empty page), and cursor.hasMore matches whether more remaining actions exist after this page. nextExecutableAction/nextReviewAction point only at the first executable/review action in the current returned page and preserve that action id, executable flag, phase, kind, and severity. Bucket totals (byPhase, bySeverity, byKind) match remainingActions for the returned cursor. Unknown cursors return an empty page with cursor.found=false, cursor.reason, zero remaining actions, cursor.nextAfterActionId=null, cursor.hasMore=false, and no next actions.
candidateSlugNosimilar_nodes only: proposed slug for a not-yet-written concept candidate.
analysisCursorNoanalysis_history only: nextCursor from the preceding scanned-file page.
componentLimitNohealth/workspace_brief/agent_brief only: positive integer max connected components to inspect. Defaults to 5, capped at 500.
componentTypesNohealth/workspace_brief/agent_brief only: relation types used for connected-component checks. Defaults to the full graph relation set.
executableOnlyNomaintenance_plan only: when true, return only actions with a proposed tool call.
includeOrphansNocontainment_tree only: include ancestorless nodes not reached from project roots. Defaults false.
reviewRevisionNomeaning_repair_review only: sha256 revision from meaningRepair:v2, binding graph/source/typed rows/target mtimes.
dependencyTypesNohealth/workspace_brief/agent_brief only: dependency relation types used for cycle and topological-order checks. Defaults to ["dependencies"].
includeExternalNoneighbors only: include external path-like element refs. Defaults false.
includeIsolatedNotopological_order only: include nodes that are not connected by the selected relation types. Defaults false.
targetOperationNoquery_plan only: read-only graph operation to explain before execution. Excludes query_plan, meaning_repair_review, analysis_history and analysis_record.
expectedGraphHashNomeaning_repair_review first page: exact graphHash from meaningRepair:v2 provenance. Later nextCall values are revision-bound and omit it.
includeUnresolvedNoneighbors only: include dangling unresolved refs. Defaults false.
recommendationLimitNohealth/workspace_brief/agent_brief only: positive integer max relation recommendations to inspect. Defaults to 20, capped at 500.
expectedSourceFingerprintNomeaning_repair_review first page: exact current sourceFingerprint from meaningRepair:v2 provenance. Later nextCall values are revision-bound and omit it.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes
compiledSummaryNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.13.0

TDQS

A3.9/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, but the description goes far beyond that: 'side effect 0,' 'never writes the vault,' records are 'not approved ontology facts,' complement excludes unclear/unsupported claims, and missing depends_on preflight yields a 'non-writing approvalGate.' It also exposes operational caveats like cursors being stateless, unknown cursors returning empty pages, and 'truncatedByBudget=true ... zero cycles does NOT mean acyclic.' This is rich behavioral disclosure on its own and fully consistent with the annotations.

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

Conciseness2/5

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

The description is a wall of text: a 39-operation enumeration with extensive cursor and contract details and no headings, lists, or clear front-loaded purpose. Useful guidance such as 'call detail:"compact" directly after connection_info' and even the closing 'Use this when...' is buried by the end of a giant paragraph. It is information-dense, but that density without structure makes it less scannable for an LLM performing a tool selection.

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?

For a 57-parameter, 39-operation tool, the description is almost everything but the schema: it explains pagination modes, completion (mutual for unfiltered pages), side-effect boundaries, auth/exclusions per operation, output slots ('content[0].text' vs 'structuredContent'), and operation-specific limits. An output schema is present and carries the return-type contract, so that omission is reasonable. The main shortfall is not missing subjects but a readability/structural deficit that reduces the practical completeness of 4 rather than 5.

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

Parameters3/5

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

Schema coverage is 100% and its parameter descriptions are already very detailed, so the baseline is 3. The description does add per-operation semantics, e.g., depth defaults varying by operation ('3 for reachability, 2 for impact/blast_radius/subgraph, 20 for lineage/containment_tree') and 'depends_on is normalized to dependencies' for pattern. But much of the body repeats schema content (e.g., searchBudget caveat, afterActionId cursor contract), and one operation-specific statement confuses the schema ('limit (1–100 scanned files ... default 30)' vs schema default 100 cap 500).

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

Purpose4/5

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

The description identifies a concrete resource and verb: query the freshly compiled ontology graph, with an explicit contrast against 'pulling the full compile_ontology payload' and a separate analysis archive mode. It also states 'side effect 0' and enumerates operations, so an agent can tell what the tool is for. However, it never differentiates itself from siblings like query_concepts, find_path, find_neighbors, or get_concept, leaving cross-tool discrimination to the agent.

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

Usage Guidelines4/5

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

There is explicit when-to-use guidance: use it when you need graph-database-like answers without compiling the full payload, and 'these archive operations do not support query_plan; run graph-engine queries on the freshly compiled artifact.' It also includes routing rules, e.g., impact/blast_radius only use declared depends_on while reachability/subgraph handle structure, and agent_brief compact should follow connection_info directly rather than workspace_brief. Alternatives are named (compile_ontology, workspace_brief), but sibling query tools are never exclusions, so some boundary work remains.

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