/** * get_index_status Tool * * MCP tool to retrieve diagnostic information about the current project's index. * Returns status, file counts, chunk counts, storage size, timestamps, and * watcher status. Useful for debugging and understanding the index state. * * Features: * - Reports index existence status ('ready' | 'indexing' | 'not_found') * - Shows total files and chunks indexed * - Displays human-readable storage size * - Includes last update timestamp * - Reports file watcher active status (when available) */ import { z } from 'zod'; import type { ToolContext } from './searchCode.js'; import type { StrategyName } from '../engines/indexingStrategy.js'; /** * Input schema for get_index_status tool * * No required inputs - uses current project context from the MCP client. */ export declare const GetIndexStatusInputSchema: z.ZodObject<{}, z.core.$strip>; /** * Inferred input type from schema */ export type GetIndexStatusInput = z.infer; /** * Index status enum values */ export type IndexStatus = 'ready' | 'indexing' | 'not_found' | 'incomplete' | 'failed'; /** * Hybrid search information for status output (SMCP-061) */ export interface HybridSearchStatus { /** Whether hybrid search is enabled */ enabled: boolean; /** FTS engine type: 'js' or 'native' */ ftsEngine?: string; /** Reason for FTS engine selection */ ftsEngineReason?: string; /** Default alpha weight for hybrid search */ defaultAlpha?: number; /** Number of chunks in the FTS index */ ftsChunkCount?: number; } /** * Embedding model information for status output (SMCP-074) */ export interface EmbeddingModelsStatus { /** Code model information */ code?: { /** Model name (e.g., 'Xenova/bge-small-en-v1.5') */ modelName: string | null; /** Model dimension (e.g., 384) */ dimension: number | null; }; /** Docs model information */ docs?: { /** Model name (e.g., 'Xenova/bge-base-en-v1.5') */ modelName: string | null; /** Model dimension (e.g., 768) */ dimension: number | null; }; /** Current version model info (for comparison) */ current?: { /** Current code model name */ codeModelName: string; /** Current code model dimension */ codeModelDimension: number; /** Current docs model name */ docsModelName: string; /** Current docs model dimension */ docsModelDimension: number; }; } /** * Compute device information for status output (SMCP-083) */ export interface ComputeStatus { /** The compute device being used: 'webgpu', 'dml', or 'cpu' */ device: 'webgpu' | 'dml' | 'cpu'; /** GPU name/model if GPU is being used */ gpuName?: string; /** Reason for falling back to CPU (if device is 'cpu') */ fallbackReason?: string; } /** * Vector index information for status output (SMCP-091) */ export interface VectorIndexStatus { /** Whether a vector index exists */ hasIndex: boolean; /** The type of index: 'ivf_pq' or 'none' */ indexType?: string; /** Number of IVF partitions (for ivf_pq index) */ numPartitions?: number; /** Number of sub-vectors for PQ compression */ numSubVectors?: number; /** Distance metric used */ distanceType?: string; /** Time taken to create the index in milliseconds */ indexCreationTimeMs?: number; /** Total chunks at time of index creation */ chunkCount?: number; /** ISO 8601 timestamp when index was created */ createdAt?: string; } /** * Output structure for get_index_status tool */ export interface GetIndexStatusOutput { /** Current index status */ status: IndexStatus; /** Absolute path to the project root (if index exists) */ projectPath?: string; /** Absolute path to the index directory */ indexPath?: string; /** Absolute path to the config file */ configPath?: string; /** Absolute path to the log file (for debugging) */ logPath?: string; /** Total number of files indexed */ totalFiles?: number; /** Total number of chunks in the index */ totalChunks?: number; /** ISO 8601 datetime of last index update */ lastUpdated?: string; /** Human-readable storage size (e.g., "45MB", "1.2GB") */ storageSize?: string; /** Whether the file watcher is currently active */ watcherActive?: boolean; /** Warning message if index is in a problematic state */ warning?: string; /** Number of failed embeddings (if any) */ failedEmbeddings?: number; /** Indexing progress info (if in progress) */ indexingProgress?: { expectedFiles?: number; processedFiles?: number; startedAt?: string; }; /** Current indexing strategy (realtime, lazy, git) */ indexingStrategy?: StrategyName; /** Number of files pending indexing (for lazy strategy) */ pendingFiles?: number; /** Hybrid search / FTS information (SMCP-061) */ hybridSearch?: HybridSearchStatus; /** Embedding model information (SMCP-074) */ embeddingModels?: EmbeddingModelsStatus; /** Model mismatch warning (non-blocking for status, unlike search) */ modelMismatchWarning?: string; /** Compute device information (SMCP-083) */ compute?: ComputeStatus; /** Vector index information (SMCP-091) */ vectorIndex?: VectorIndexStatus; } /** * Format bytes to human-readable string * * Converts a byte count to a human-readable format with appropriate units. * * @param bytes - Size in bytes * @returns Human-readable string like "45MB", "1.2GB", etc. * * @example * ```typescript * formatStorageSize(1024); // "1KB" * formatStorageSize(1536); // "1.5KB" * formatStorageSize(1048576); // "1MB" * formatStorageSize(1073741824); // "1GB" * formatStorageSize(500); // "500B" * ``` */ export declare function formatStorageSize(bytes: number): string; /** * Collect index status information * * Gathers all statistics and status information about the current project's index. * * @param context - Tool context containing the project path * @returns Index status output * * @example * ```typescript * const status = await collectStatus({ projectPath: '/path/to/project' }); * console.log(status.status); // 'ready' * console.log(status.totalFiles); // 150 * console.log(status.storageSize); // '45MB' * ``` */ export declare function collectStatus(context: ToolContext): Promise; /** * Get index status for the current project * * Returns diagnostic information about the project's search index including * file counts, chunk counts, storage size, and watcher status. * * @param input - The input (empty object, uses project context) * @param context - Tool context containing the project path * @returns Index status information * * @example * ```typescript * const status = await getIndexStatus( * {}, * { projectPath: '/path/to/project' } * ); * * console.log(status.status); // 'ready' | 'indexing' | 'not_found' * console.log(status.totalFiles); // 150 * console.log(status.storageSize); // '45MB' * ``` */ export declare function getIndexStatus(input: GetIndexStatusInput, context: ToolContext): Promise; /** * MCP tool definition for get_index_status * * This tool provides diagnostic information about the index. * It does NOT require confirmation as it's a read-only operation. */ export declare const getIndexStatusTool: { name: string; description: string; inputSchema: { type: "object"; properties: {}; required: string[]; }; requiresConfirmation: boolean; }; //# sourceMappingURL=getIndexStatus.d.ts.map