Skip to main content
Glama

waypath_health

Diagnose system health with a single, read-only call: checks SQLite connectivity, migration version, FTS5 index sync, source adapter probe results, and truth-kernel row counts. Use as a diagnostic entrypoint before opening a support issue.

Instructions

Read-only end-to-end health check: SQLite connectivity and migration version, FTS5 index sync status, source adapter probe results, and truth-kernel row counts. Safe to call any time and from any context. Use as a single diagnostic entrypoint before opening a support issue; for adapter-specific detail call waypath_source_status. Takes no parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core health check logic: performs SQLite integrity check, FTS5 sync verification, temporal coherence analysis, source adapter probes (JCP + mempalace), and aggregates row counts/stale pages/pending reviews into a WaypathHealthResult.
    export function healthCheck(store: SqliteTruthKernelStorage, options: HealthCheckOptions = {}): WaypathHealthResult {
      const truthKernel = store.health();
      const integrityCheck = readIntegrityCheck(store);
      const sources = sourceStatus(options).sources;
      const jcpStatus = buildJcpStatus(
        getSourceStatusItem(sources, 'jarvis-memory-db'),
        options.jcpLiveReader ?? createJcpLiveReader(),
      );
      const mempalaceStatus = buildProbeStatus(getSourceStatusItem(sources, 'mempalace'), 'mempalace');
      const expectedRows = store.countTable('entities')
        + store.countTable('decisions')
        + store.countTable('preferences')
        + store.countTable('promoted_memories');
      const indexedRows = store.countTable('waypath_fts');
      const ftsSync = {
        ok: indexedRows === expectedRows,
        indexed_rows: indexedRows,
        expected_rows: expectedRows,
        missing_rows: Math.max(expectedRows - indexedRows, 0),
      };
      // valid_until is stored as ISO 8601 (e.g. '2026-04-16T10:30:00.000Z').
      // Pass current time in same format for correct string comparison.
      const nowIsoStr = new Date().toISOString();
      const tables = ['entities', 'decisions', 'preferences', 'relationships', 'promoted_memories'] as const;
      let expiredButActive = 0;
      for (const table of tables) {
        expiredButActive += store.get<{ count: number }>(
          `SELECT COUNT(*) AS count FROM ${table} WHERE valid_until IS NOT NULL AND valid_until < :now AND status = 'active'`,
          { now: nowIsoStr },
        )?.count ?? 0;
      }
      const temporalCoherence = {
        expired_but_active: expiredButActive,
        warning: expiredButActive > 0
          ? `${expiredButActive} records have valid_until in the past but are still active`
          : null,
      };
      const stalePages = store.get<{ count: number }>(
        `SELECT COUNT(*) AS count FROM knowledge_pages WHERE status = 'stale'`,
      )?.count ?? 0;
      const pendingReviews = store.get<{ count: number }>(
        `SELECT COUNT(*) AS count FROM promotion_candidates WHERE review_status IN ('pending', 'needs_more_evidence')`,
      )?.count ?? 0;
      const ok = truthKernel.ok && integrityCheck === 'ok' && ftsSync.ok;
    
      return {
        operation: 'health',
        status: 'ready',
        ok,
        truth_kernel: {
          ...truthKernel,
          integrity_check: integrityCheck,
        },
        fts_sync: ftsSync,
        stale_pages: stalePages,
        pending_reviews: pendingReviews,
        temporal_coherence: temporalCoherence,
        jcp_status: jcpStatus,
        mempalace_status: mempalaceStatus,
        db_size_bytes: dbFileSizeBytes(store.location),
        message: ok ? 'waypath health check passed' : 'waypath health check failed',
      };
    }
  • WaypathHealthResult interface defining the shape of the health check response including truth_kernel, fts_sync, stale_pages, pending_reviews, temporal_coherence, jcp_status, mempalace_status, and db_size_bytes.
    export interface WaypathHealthResult {
      operation: 'health';
      status: 'ready';
      ok: boolean;
      truth_kernel: WaypathTruthKernelStatus;
      fts_sync: WaypathFtsSyncStatus;
      stale_pages: number;
      pending_reviews: number;
      temporal_coherence: WaypathTemporalCoherenceStatus;
      jcp_status: WaypathSourceHealthStatus;
      mempalace_status: WaypathSourceHealthStatus;
      db_size_bytes: number;
      message: string;
    }
  • MCP tool registration for 'waypath_health' including its description, empty inputSchema, and handler that delegates to facade.health().
    {
      name: 'waypath_health',
      description:
        'Read-only end-to-end health check: SQLite connectivity and migration version, FTS5 index sync status, source adapter probe results, and truth-kernel row counts. Safe to call any time and from any context. Use as a single diagnostic entrypoint before opening a support issue; for adapter-specific detail call waypath_source_status. Takes no parameters.',
      inputSchema: {
        type: 'object',
        properties: {},
        additionalProperties: false,
      },
      handler(_args, facade) {
        return facade.health();
      },
    },
  • Facade's health() method that imports and calls the healthCheck function from health.ts, passing the store and options.
    health(): WaypathHealthResult {
      return healthCheck(store, {
        sourceAdaptersEnabled: options.sourceAdaptersEnabled,
        jcpLiveReader,
      });
    },
  • Supporting type interfaces: WaypathTruthKernelStatus, WaypathFtsSyncStatus, and WaypathTemporalCoherenceStatus used within WaypathHealthResult.
    export interface WaypathTruthKernelStatus {
      ok: boolean;
      location: string;
      schema_version: number;
      message: string;
      integrity_check: string;
    }
Behavior4/5

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

Declares read-only nature and safety to call any time, listing checks performed. Without annotations, description carries full burden; missing specification of return format (e.g., JSON status object) is a minor gap.

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

Conciseness5/5

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

Three sentences, front-loaded with purpose, no fluff. Every sentence adds value.

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?

Covers purpose, usage, safety, and sibling distinction. However, given no output schema, description could specify what the tool returns (e.g., a status object). Still adequate for a simple health check.

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?

No parameters, so schema coverage is 100%. Baseline set at 4. Description confirms zero parameters but adds no extra value beyond schema.

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?

Clearly states it is a read-only health check listing specific components (SQLite, FTS5 sync, source adapters, truth-kernel row counts). Distinguishes from sibling waypath_source_status by noting it's a single diagnostic entrypoint vs adapter-specific detail.

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 says 'Safe to call any time and from any context' and 'Use as a single diagnostic entrypoint before opening a support issue; for adapter-specific detail call waypath_source_status.' Provides clear when and when-not to use.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheStack-ai/waypath'

If you have feedback or need assistance with the MCP directory API, please join our Discord server