@utaba/deep-memory-local-mcp-server 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -595,7 +595,7 @@ var FindEntitiesTool = class extends BaseToolController {
|
|
|
595
595
|
conversationId: { type: "string", description: "Filter to entities from this conversation" },
|
|
596
596
|
actor: { type: "string", description: "Filter to entities created/modified by this actor" },
|
|
597
597
|
dateRange: { type: "object", properties: { from: { type: "string" }, to: { type: "string" } }, description: "Filter by date range (ISO 8601)" },
|
|
598
|
-
includeRelationshipSummary: { type: "boolean", description: "Attach a relationship count summary (
|
|
598
|
+
includeRelationshipSummary: { type: "boolean", description: "Attach a relationship count summary (out/in by type) to each entity (default false)" }
|
|
599
599
|
},
|
|
600
600
|
required: ["repositoryId"]
|
|
601
601
|
};
|
|
@@ -797,7 +797,7 @@ var GetRelationshipsTool = class extends BaseToolController {
|
|
|
797
797
|
repositoryId: { type: "string", description: "Repository containing the entity" },
|
|
798
798
|
entityId: { type: "string", description: "Entity ID (GUID) or slug" },
|
|
799
799
|
relationshipTypes: { type: "array", items: { type: "string" }, description: "Filter by relationship type(s)" },
|
|
800
|
-
direction: { type: "string", enum: ["
|
|
800
|
+
direction: { type: "string", enum: ["out", "in", "both"], description: "Direction filter relative to the queried entity (default: both)" },
|
|
801
801
|
limit: { type: "number", description: "Max results (default 20, max 100)" },
|
|
802
802
|
offset: { type: "number", description: "Pagination offset (default 0)" },
|
|
803
803
|
propertyFilters: { type: "array", items: { type: "object", properties: { key: { type: "string" }, operator: { type: "string", enum: ["eq", "neq", "isNull", "isNotNull", "gt", "lt", "gte", "lte", "contains"] }, value: {} }, required: ["key", "operator"] }, description: "Filter by relationship property values (AND)" }
|
|
@@ -838,7 +838,7 @@ var ExploreNeighborhoodTool = class extends BaseToolController {
|
|
|
838
838
|
depth: { type: "number", enum: [1, 2, 3], description: "Exploration depth (default: 1)" },
|
|
839
839
|
relationshipTypes: { type: "array", items: { type: "string" }, description: "Filter by relationship type(s)" },
|
|
840
840
|
entityTypes: { type: "array", items: { type: "string" }, description: "Filter result entity types" },
|
|
841
|
-
direction: { type: "string", enum: ["
|
|
841
|
+
direction: { type: "string", enum: ["out", "in", "both"], description: "Direction filter relative to the queried entity (default: both)" },
|
|
842
842
|
limitPerType: { type: "number", description: "Max entities per relationship type (default 10, max 50)" },
|
|
843
843
|
offsetPerType: { type: "number", description: "Pagination offset per relationship type (default 0)" },
|
|
844
844
|
detailLevel: { type: "string", enum: ["brief", "summary", "full"], description: "Detail level for returned entities (default: summary)" },
|
|
@@ -1028,7 +1028,7 @@ Projection works with traversals too \u2014 add \`projection\` to aggregate prop
|
|
|
1028
1028
|
items: {
|
|
1029
1029
|
type: "object",
|
|
1030
1030
|
properties: {
|
|
1031
|
-
direction: { type: "string", enum: ["out", "in", "both"], description: "Direction to traverse" },
|
|
1031
|
+
direction: { type: "string", enum: ["out", "in", "both"], description: "Direction to traverse, relative to the entity at the start of the hop" },
|
|
1032
1032
|
relationshipTypes: { type: "array", items: { type: "string" }, description: "Relationship types to follow (omit for all)" },
|
|
1033
1033
|
entityTypes: { type: "array", items: { type: "string" }, description: "Filter target entities by type" },
|
|
1034
1034
|
relationshipFilter: { type: "array", items: propertyFilterSchema, description: "Filter relationships by property values" },
|
|
@@ -1063,7 +1063,7 @@ Projection works with traversals too \u2014 add \`projection\` to aggregate prop
|
|
|
1063
1063
|
offset: { type: "number", description: "Pagination offset (default: 0)" },
|
|
1064
1064
|
detailLevel: { type: "string", enum: ["brief", "summary", "full"], description: "Detail level for entities (default: summary)" },
|
|
1065
1065
|
dedup: { type: "boolean", description: "Deduplicate entities (default: true)" },
|
|
1066
|
-
includeRelationshipSummary: { type: "boolean", description: "Attach
|
|
1066
|
+
includeRelationshipSummary: { type: "boolean", description: "Attach out/in relationship counts by type to each entity (default: true). Set false to reduce response size." }
|
|
1067
1067
|
},
|
|
1068
1068
|
required: ["repositoryId", "start"]
|
|
1069
1069
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/server/McpServer.ts","../src/tools/base/BaseToolController.ts","../src/tools/repository/CreateRepositoryTool.ts","../src/tools/repository/OpenRepositoryTool.ts","../src/tools/repository/ListRepositoriesTool.ts","../src/tools/repository/UpdateRepositoryTool.ts","../src/tools/repository/DeleteRepositoryTool.ts","../src/tools/repository/EnsureSchemaTool.ts","../src/tools/repository/ValidateEntitiesTool.ts","../src/tools/repository/ValidateRelationshipsTool.ts","../src/tools/entity/CreateEntitiesTool.ts","../src/tools/entity/UpdateEntityTool.ts","../src/tools/base/stripProvenance.ts","../src/tools/entity/GetEntityTool.ts","../src/tools/base/provenanceHelper.ts","../src/tools/entity/FindEntitiesTool.ts","../src/tools/entity/DeleteEntitiesTool.ts","../src/tools/entity/ReembedRepositoryTool.ts","../src/tools/relationship/CreateRelationshipsTool.ts","../src/tools/relationship/RemoveRelationshipsTool.ts","../src/tools/relationship/GetRelationshipsTool.ts","../src/tools/graph/ExploreNeighborhoodTool.ts","../src/tools/graph/FindPathsTool.ts","../src/tools/graph/GetGraphTool.ts","../src/tools/graph/QueryGraphTool.ts","../src/tools/search/SearchByConceptTool.ts","../src/tools/vocabulary/GetVocabularyTool.ts","../src/tools/vocabulary/ProposeVocabularyExtensionTool.ts","../src/tools/stats/GetStatsTool.ts","../src/tools/stats/GetTimelineTool.ts","../src/tools/portability/ExportRepositoryTool.ts","../src/tools/portability/zip.ts","../src/tools/portability/ImportRepositoryTool.ts","../src/server/ToolRegistry.ts","../src/server/McpHandler.ts","../src/interfaces/ILogger.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { McpServer } from './server/McpServer.js';\nimport { ConsoleLogger } from './interfaces/ILogger.js';\n\n// Load .env.local from the current working directory (workspace root when launched by an MCP host).\n// Values already present in process.env take precedence, so shell overrides still win.\nfunction loadEnvFile(path: string): void {\n if (!existsSync(path)) return;\n const content = readFileSync(path, 'utf8');\n for (const raw of content.split(/\\r?\\n/)) {\n let line = raw.trim();\n if (!line || line.startsWith('#')) continue;\n if (line.startsWith('export ')) line = line.slice('export '.length).trim();\n const eq = line.indexOf('=');\n if (eq === -1) continue;\n const key = line.slice(0, eq).trim();\n let value = line.slice(eq + 1).trim();\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n if (!(key in process.env)) {\n process.env[key] = value;\n }\n }\n}\nloadEnvFile(resolve(process.cwd(), '.env.local'));\n\nconst logger = new ConsoleLogger();\n\nconst storageSetting = process.env['DEEP_MEMORY_STORAGE'];\nconst storageType = storageSetting === 'sqlserver' ? 'sqlserver' as const\n : storageSetting === 'cosmosdb' ? 'cosmosdb' as const\n : 'memory' as const;\n\nconst server = new McpServer(\n {\n actorId: process.env['DEEP_MEMORY_ACTOR_ID'] ?? 'mcp-agent',\n actorType: process.env['DEEP_MEMORY_ACTOR_TYPE'] ?? 'agent',\n embeddingsBaseUrl: process.env['DEEP_MEMORY_EMBEDDINGS_BASE_URL'],\n embeddingsModel: process.env['DEEP_MEMORY_EMBEDDINGS_MODEL'],\n embeddingsDimensions: process.env['DEEP_MEMORY_EMBEDDINGS_DIMENSIONS']\n ? Number(process.env['DEEP_MEMORY_EMBEDDINGS_DIMENSIONS'])\n : undefined,\n embeddingsApiKey: process.env['DEEP_MEMORY_EMBEDDINGS_API_KEY'],\n storageType,\n sqlServerHost: process.env['DEEP_MEMORY_SQL_HOST'],\n sqlServerPort: process.env['DEEP_MEMORY_SQL_PORT'] ? Number(process.env['DEEP_MEMORY_SQL_PORT']) : undefined,\n sqlServerDatabase: process.env['DEEP_MEMORY_SQL_DATABASE'],\n sqlServerUser: process.env['DEEP_MEMORY_SQL_USER'],\n sqlServerPassword: process.env['DEEP_MEMORY_SQL_PASSWORD'],\n sqlServerSchema: process.env['DEEP_MEMORY_SQL_SCHEMA'],\n sqlServerTrustCert: process.env['DEEP_MEMORY_SQL_TRUST_CERT'] === 'true',\n cosmosDbEndpoint: process.env['DEEP_MEMORY_COSMOSDB_ENDPOINT'],\n cosmosDbRestEndpoint: process.env['DEEP_MEMORY_COSMOSDB_REST_ENDPOINT'],\n cosmosDbKey: process.env['DEEP_MEMORY_COSMOSDB_KEY'],\n cosmosDbDatabase: process.env['DEEP_MEMORY_COSMOSDB_DATABASE'],\n cosmosDbContainer: process.env['DEEP_MEMORY_COSMOSDB_CONTAINER'],\n cosmosDbRejectUnauthorized: process.env['DEEP_MEMORY_COSMOSDB_REJECT_UNAUTHORIZED'] !== 'false',\n exportDir: process.env['DEEP_MEMORY_EXPORT_DIR'] ?? './exports',\n },\n logger,\n);\n\n// Graceful shutdown\nprocess.on('SIGINT', async () => {\n await server.stop();\n process.exit(0);\n});\n\nprocess.on('SIGTERM', async () => {\n await server.stop();\n process.exit(0);\n});\n\nserver.start().catch((error) => {\n logger.error('main', 'Failed to start MCP server', error);\n process.exit(1);\n});\n","import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport {\n DeepMemory,\n InMemoryStorageProvider,\n InMemorySearchProvider,\n type MemoryRepository,\n type StorageProvider,\n type GraphTraversalProvider,\n} from '@utaba/deep-memory';\nimport { OpenAIEmbeddingProvider } from '@utaba/deep-memory-embeddings-openai';\nimport { SqlServerStorageProvider } from '@utaba/deep-memory-storage-sqlserver';\nimport { CosmosDbProvider } from '@utaba/deep-memory-storage-cosmosdb';\nimport type { ILogger } from '../interfaces/ILogger.js';\nimport { ToolRegistry } from './ToolRegistry.js';\nimport { McpHandler } from './McpHandler.js';\nimport type { ToolContext } from '../tools/base/BaseToolController.js';\n\nexport interface McpServerConfig {\n /** Actor ID for provenance tracking (default: 'mcp-agent') */\n actorId?: string;\n /** Actor type for provenance (default: 'agent') */\n actorType?: string;\n /** Embeddings API base URL (e.g. 'http://localhost:8010'). Enables semantic search when set. */\n embeddingsBaseUrl?: string;\n /** Default embeddings model for newly created repositories. Each repo stores its own model in metadata. */\n embeddingsModel?: string;\n /** Default embeddings dimensionality for newly created repositories. Each repo stores its own dimensions in metadata. */\n embeddingsDimensions?: number;\n /** Embeddings API key (optional, not needed for local servers) */\n embeddingsApiKey?: string;\n /** Storage type: 'memory' (default), 'sqlserver', or 'cosmosdb' */\n storageType?: 'memory' | 'sqlserver' | 'cosmosdb';\n /** SQL Server host (required when storageType is 'sqlserver') */\n sqlServerHost?: string;\n /** SQL Server port (default: 1433) */\n sqlServerPort?: number;\n /** SQL Server database name */\n sqlServerDatabase?: string;\n /** SQL Server username */\n sqlServerUser?: string;\n /** SQL Server password */\n sqlServerPassword?: string;\n /** SQL Server schema (default: 'dbo') */\n sqlServerSchema?: string;\n /** Trust server certificate for SQL Server (default: false) */\n sqlServerTrustCert?: boolean;\n /** CosmosDB Gremlin WebSocket endpoint (required when storageType is 'cosmosdb') */\n cosmosDbEndpoint?: string;\n /** CosmosDB REST endpoint — derived from Gremlin endpoint if omitted */\n cosmosDbRestEndpoint?: string;\n /** CosmosDB primary key */\n cosmosDbKey?: string;\n /** CosmosDB database name */\n cosmosDbDatabase?: string;\n /** CosmosDB container (graph) name */\n cosmosDbContainer?: string;\n /** Reject unauthorized TLS certs — set false for emulator (default: true) */\n cosmosDbRejectUnauthorized?: boolean;\n /** Directory where exported zip files are written (default: './exports') */\n exportDir?: string;\n}\n\nexport class McpServer {\n private server: Server;\n private handler: McpHandler;\n private deepMemory: DeepMemory;\n private repositories: Map<string, MemoryRepository> = new Map();\n\n constructor(\n config: McpServerConfig,\n private logger: ILogger,\n ) {\n let storage: StorageProvider;\n let graphTraversal: GraphTraversalProvider | undefined;\n if (config.storageType === 'sqlserver') {\n storage = new SqlServerStorageProvider({\n connection: {\n server: config.sqlServerHost!,\n port: config.sqlServerPort ?? 1433,\n database: config.sqlServerDatabase!,\n user: config.sqlServerUser,\n password: config.sqlServerPassword,\n options: {\n encrypt: false,\n trustServerCertificate: config.sqlServerTrustCert ?? false,\n },\n },\n schema: config.sqlServerSchema ?? 'dbo',\n });\n } else if (config.storageType === 'cosmosdb') {\n const cosmos = new CosmosDbProvider({\n endpoint: config.cosmosDbEndpoint!,\n restEndpoint: config.cosmosDbRestEndpoint,\n key: config.cosmosDbKey!,\n database: config.cosmosDbDatabase!,\n container: config.cosmosDbContainer!,\n rejectUnauthorized: config.cosmosDbRejectUnauthorized ?? true,\n });\n storage = cosmos;\n graphTraversal = cosmos;\n } else {\n storage = new InMemoryStorageProvider();\n }\n\n const search = config.storageType === 'memory' || !config.storageType ? new InMemorySearchProvider() : undefined;\n\n // Build a factory — model + dimensions come from the repository's stored metadata\n // at open time, so repositories with different embedding configurations can coexist\n // against the same embeddings endpoint.\n const embeddingFactory = config.embeddingsBaseUrl\n ? ({ model, dimensions }: { model: string; dimensions: number }) =>\n new OpenAIEmbeddingProvider({\n baseUrl: config.embeddingsBaseUrl!,\n model,\n dimensions,\n apiKey: config.embeddingsApiKey,\n })\n : undefined;\n\n this.deepMemory = new DeepMemory({\n storage,\n search,\n embeddingFactory,\n defaultEmbeddingModel: config.embeddingsModel,\n defaultEmbeddingDimensions: config.embeddingsDimensions,\n graphTraversal,\n provenance: {\n actorId: config.actorId ?? 'mcp-agent',\n actorType: (config.actorType ?? 'agent') as 'agent' | 'user',\n },\n });\n\n const toolContext: ToolContext = {\n deepMemory: this.deepMemory,\n storage,\n getRepository: this.getRepository.bind(this),\n evictRepository: this.evictRepository.bind(this),\n exportDir: config.exportDir ?? './exports',\n };\n\n const toolRegistry = new ToolRegistry(toolContext, this.logger);\n this.handler = new McpHandler(toolRegistry, this.logger);\n\n this.server = new Server(\n {\n name: '@utaba/deep-memory-local-mcp-server',\n version: '0.1.0',\n },\n {\n capabilities: {\n tools: {},\n },\n },\n );\n\n this.setupHandlers();\n }\n\n private setupHandlers(): void {\n this.server.setRequestHandler(ListToolsRequestSchema, this.handler.handleToolsList.bind(this.handler));\n this.server.setRequestHandler(CallToolRequestSchema, this.handler.handleToolCall.bind(this.handler));\n }\n\n private async getRepository(repositoryId: string): Promise<MemoryRepository> {\n let repo = this.repositories.get(repositoryId);\n if (!repo) {\n repo = await this.deepMemory.openRepository(repositoryId);\n this.repositories.set(repositoryId, repo);\n }\n return repo;\n }\n\n private evictRepository(repositoryId: string): void {\n this.repositories.delete(repositoryId);\n }\n\n async start(): Promise<void> {\n const transport = new StdioServerTransport();\n await this.server.connect(transport);\n this.logger.info('McpServer', 'Deep Memory MCP server started on stdio');\n // Schema check is best-effort and must not block the transport handshake.\n // Tools that need storage will fail individually with a clear error at call time.\n this.deepMemory.ensureSchema().catch((error: unknown) => {\n this.logger.warn('McpServer', `Storage unavailable on startup — repository tools will fail until storage is reachable: ${error instanceof Error ? error.message : String(error)}`);\n });\n }\n\n async stop(): Promise<void> {\n this.repositories.clear();\n await this.deepMemory.dispose();\n await this.server.close();\n this.logger.info('McpServer', 'Deep Memory MCP server stopped');\n }\n}\n","import type { IMcpTool } from '../../interfaces/IMcpTool.js';\nimport type { ILogger } from '../../interfaces/ILogger.js';\nimport type { DeepMemory, MemoryRepository } from '@utaba/deep-memory';\nimport type { StorageProvider } from '@utaba/deep-memory/providers';\nimport { isValidUuid, EntityNotFoundError } from '@utaba/deep-memory';\n\nexport interface ToolContext {\n deepMemory: DeepMemory;\n storage: StorageProvider;\n getRepository: (repositoryId: string) => Promise<MemoryRepository>;\n evictRepository: (repositoryId: string) => void;\n /** Absolute or relative path where export zip files are written */\n exportDir: string;\n}\n\nexport abstract class BaseToolController implements IMcpTool {\n constructor(\n protected context: ToolContext,\n protected logger: ILogger,\n ) {}\n\n abstract get name(): string;\n abstract get description(): string;\n abstract get inputSchema(): Record<string, unknown>;\n\n async execute(params: Record<string, unknown>): Promise<unknown> {\n try {\n this.validateParams(params);\n return await this.handleExecute(params);\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n this.logger.error(this.name, `Execution failed: ${message}`);\n throw error;\n }\n }\n\n protected abstract handleExecute(params: Record<string, unknown>): Promise<unknown>;\n\n protected validateParams(params: Record<string, unknown>): void {\n const schema = this.inputSchema;\n const required = schema['required'] as string[] | undefined;\n if (required) {\n for (const field of required) {\n if (params[field] === undefined || params[field] === null) {\n throw new Error(`Required parameter '${field}' is missing`);\n }\n }\n }\n }\n\n /**\n * Resolve an entity identifier that may be either a GUID or a slug.\n * Returns the GUID.\n */\n protected async resolveEntityId(repo: MemoryRepository, entityIdOrSlug: string): Promise<string> {\n if (isValidUuid(entityIdOrSlug)) {\n return entityIdOrSlug;\n }\n // Treat as slug — resolve to GUID\n const entity = await repo.getBySlug(entityIdOrSlug);\n if (!entity) {\n throw new EntityNotFoundError(entityIdOrSlug);\n }\n return entity.id;\n }\n}\n","import type { VocabularyInput, GovernanceMode } from '@utaba/deep-memory';\nimport { BaseToolController } from '../base/BaseToolController.js';\n\nexport class CreateRepositoryTool extends BaseToolController {\n get name() { return 'memory_create_repository'; }\n get description() { return 'Create a new memory repository with an optional vocabulary definition and governance mode'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Unique identifier for the repository' },\n label: { type: 'string', description: 'Human-readable name' },\n description: { type: 'string', description: 'Purpose of this repository' },\n type: { type: 'string', description: 'Repository type (optional classifier)' },\n legal: { type: 'string', description: 'Legal or compliance notes for this repository' },\n owner: { type: 'string', description: 'Owner of the repository (person, team, or org)' },\n governanceMode: { type: 'string', enum: ['locked', 'managed', 'open'], description: 'Vocabulary governance mode (default: open)' },\n defaultSimilarityThreshold: { type: 'number', description: 'Default similarity threshold for semantic search (0.0-1.0, default: 0.5). Lower for local embedding models, higher for OpenAI.' },\n metadata: {\n type: 'object',\n description: 'Extensible metadata object. Embedding model info (embeddingModelId, embeddingDimensions) is auto-detected from the configured provider if omitted.',\n },\n vocabulary: {\n type: 'object',\n description: 'Initial vocabulary with entityTypes and relationshipTypes arrays',\n properties: {\n entityTypes: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: { type: 'string' },\n description: { type: 'string' },\n properties: { type: 'array', items: { type: 'object' } },\n },\n required: ['type', 'description'],\n },\n },\n relationshipTypes: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: { type: 'string' },\n description: { type: 'string' },\n allowedSourceTypes: { type: 'array', items: { type: 'string' } },\n allowedTargetTypes: { type: 'array', items: { type: 'string' } },\n bidirectional: { type: 'boolean' },\n properties: { type: 'array', items: { type: 'object' } },\n },\n required: ['type', 'description', 'allowedSourceTypes', 'allowedTargetTypes'],\n },\n },\n },\n },\n },\n required: ['repositoryId', 'label'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const mode = (params['governanceMode'] as GovernanceMode | undefined) ?? 'open';\n const repo = await this.context.deepMemory.createRepository({\n repositoryId: params['repositoryId'] as string,\n label: params['label'] as string,\n description: params['description'] as string | undefined,\n type: params['type'] as string | undefined,\n legal: params['legal'] as string | undefined,\n owner: params['owner'] as string | undefined,\n vocabulary: params['vocabulary'] as VocabularyInput | undefined,\n governance: {\n mode,\n defaultSimilarityThreshold: params['defaultSimilarityThreshold'] as number | undefined,\n },\n metadata: params['metadata'] as import('@utaba/deep-memory').RepositoryMetadata | undefined,\n });\n return { repositoryId: repo.repositoryId, message: `Repository '${params['label']}' created` };\n }\n}\n","import type { ResolvedVocabulary } from '@utaba/deep-memory';\nimport { BaseToolController } from '../base/BaseToolController.js';\n\nexport class OpenRepositoryTool extends BaseToolController {\n get name() { return 'memory_open_repository'; }\n get description() { return 'Open a memory repository by ID or label. Call this first before any entity, relationship, or graph operations. Returns vocabulary and stats.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'ID of the repository to open' },\n label: { type: 'string', description: 'Repository label — use as alternative to repositoryId' },\n },\n required: [],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string | undefined;\n const label = params['label'] as string | undefined;\n\n if (!repositoryId && !label) {\n throw new Error('Provide either repositoryId or label');\n }\n\n let resolvedId: string;\n\n if (repositoryId) {\n resolvedId = repositoryId;\n } else {\n // Look up by label\n const allRepos = await this.context.deepMemory.listRepositories();\n const matches = allRepos.items.filter(\n (r) => r.label.toLowerCase() === label!.toLowerCase(),\n );\n\n if (matches.length === 0) {\n throw new Error(`No repository found with label '${label}'`);\n }\n if (matches.length > 1) {\n return {\n error: 'ambiguous_label',\n message: `Multiple repositories match label '${label}'. Provide a repositoryId.`,\n candidates: matches.map((r) => ({ repositoryId: r.repositoryId, label: r.label })),\n };\n }\n resolvedId = matches[0]!.repositoryId;\n }\n\n const repo = await this.context.getRepository(resolvedId);\n const [vocabulary, stats] = await Promise.all([\n repo.getVocabulary(),\n repo.getStats(),\n ]);\n\n return {\n repositoryId: repo.repositoryId,\n message: `Repository '${resolvedId}' opened`,\n vocabulary: OpenRepositoryTool.stripAuditFields(vocabulary),\n stats,\n agentInstructions: repo.getQueryGuide(),\n };\n }\n\n /** Strip audit/versioning fields from vocabulary to reduce response size for AI consumers */\n private static stripAuditFields(resolved: ResolvedVocabulary) {\n const { vocabulary, governanceMode, governanceConfig } = resolved;\n\n return {\n governanceMode,\n governanceConfig,\n entityTypes: vocabulary.entityTypes.map(({ type, description, properties }) => ({\n type,\n description,\n properties,\n })),\n relationshipTypes: vocabulary.relationshipTypes.map(({ type, description, allowedSourceTypes, allowedTargetTypes, bidirectional, properties }) => ({\n type,\n description,\n allowedSourceTypes,\n allowedTargetTypes,\n bidirectional,\n ...(properties?.length ? { properties } : {}),\n })),\n };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ListRepositoriesTool extends BaseToolController {\n get name() { return 'memory_list_repositories'; }\n get description() { return 'List all available memory repositories'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n type: { type: 'string', description: 'Filter by repository type' },\n limit: { type: 'number', description: 'Max results (default 20)' },\n offset: { type: 'number', description: 'Pagination offset (default 0)' },\n },\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const filter: Record<string, unknown> = {};\n if (params['type']) filter['type'] = params['type'] as string;\n filter['limit'] = (params['limit'] as number | undefined) ?? 20;\n filter['offset'] = (params['offset'] as number | undefined) ?? 0;\n return this.context.deepMemory.listRepositories(filter as Parameters<typeof this.context.deepMemory.listRepositories>[0]);\n }\n}\n","import type { GovernanceMode } from '@utaba/deep-memory';\nimport { BaseToolController } from '../base/BaseToolController.js';\n\nexport class UpdateRepositoryTool extends BaseToolController {\n get name() { return 'memory_update_repository'; }\n get description() { return 'Update repository metadata and settings — label, description, governance mode, similarity threshold, etc.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to update' },\n label: { type: 'string', description: 'New label' },\n description: { type: 'string', description: 'New description' },\n type: { type: 'string', description: 'New repository type' },\n owner: { type: 'string', description: 'New owner' },\n governanceMode: { type: 'string', enum: ['locked', 'managed', 'open'], description: 'New governance mode' },\n defaultSimilarityThreshold: { type: 'number', description: 'Default similarity threshold for semantic search (0.0-1.0). Model-dependent — lower for local models, higher for OpenAI.' },\n requireApproval: { type: 'boolean', description: 'Managed mode: if true, all vocabulary proposals queue for human approval' },\n deduplicationEnabled: { type: 'boolean', description: 'Open mode: whether vocabulary deduplication is enforced (default true)' },\n autoApproveThreshold: { type: 'number', description: 'Managed mode: similarity score below which vocabulary proposals auto-approve (default 0.3)' },\n metadata: { type: 'object', description: 'Metadata updates (shallow-merged with existing). E.g. { \"embeddingModelId\": \"...\", \"embeddingDimensions\": 4096 }' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n\n // Build governance config update if any governance fields provided\n const governanceMode = params['governanceMode'] as GovernanceMode | undefined;\n const defaultSimilarityThreshold = params['defaultSimilarityThreshold'] as number | undefined;\n const requireApproval = params['requireApproval'] as boolean | undefined;\n const deduplicationEnabled = params['deduplicationEnabled'] as boolean | undefined;\n const autoApproveThreshold = params['autoApproveThreshold'] as number | undefined;\n\n const hasGovernanceUpdate = governanceMode !== undefined\n || defaultSimilarityThreshold !== undefined\n || requireApproval !== undefined\n || deduplicationEnabled !== undefined\n || autoApproveThreshold !== undefined;\n\n let governanceConfig: Record<string, unknown> | undefined;\n if (hasGovernanceUpdate) {\n // Fetch current governance to merge with\n const repo = await this.context.getRepository(repositoryId);\n const current = (await repo.getVocabulary()).governanceConfig;\n governanceConfig = {\n ...current,\n ...(governanceMode !== undefined ? { mode: governanceMode } : {}),\n ...(defaultSimilarityThreshold !== undefined ? { defaultSimilarityThreshold } : {}),\n ...(requireApproval !== undefined ? { requireApproval } : {}),\n ...(deduplicationEnabled !== undefined ? { deduplicationEnabled } : {}),\n ...(autoApproveThreshold !== undefined ? { autoApproveThreshold } : {}),\n };\n }\n\n const updated = await this.context.deepMemory.updateRepository(repositoryId, {\n label: params['label'] as string | undefined,\n description: params['description'] as string | undefined,\n type: params['type'] as string | undefined,\n owner: params['owner'] as string | undefined,\n governanceConfig: governanceConfig as import('@utaba/deep-memory').GovernanceConfig | undefined,\n metadata: params['metadata'] as import('@utaba/deep-memory').RepositoryMetadata | undefined,\n });\n\n // Evict cached repository so it reloads with new settings\n this.context.evictRepository(repositoryId);\n\n return { repositoryId: updated.repositoryId, message: `Repository '${updated.label}' updated` };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class DeleteRepositoryTool extends BaseToolController {\n get name() { return 'memory_delete_repository'; }\n get description() { return 'Delete a memory repository and all its data permanently. Use deleteContentsOnly to remove all entities and relationships while keeping the repository and vocabulary intact.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'ID of the repository to delete' },\n deleteContentsOnly: { type: 'boolean', description: 'When true, only delete entities and relationships — the repository and vocabulary are preserved. Defaults to false.' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const deleteContentsOnly = params['deleteContentsOnly'] === true;\n\n if (deleteContentsOnly) {\n const result = await this.context.deepMemory.deleteAllContents(repositoryId);\n this.context.evictRepository(repositoryId);\n return {\n message: `Repository '${repositoryId}' contents deleted (${result.deletedEntities} entities, ${result.deletedRelationships} relationships removed). Repository and vocabulary preserved.`,\n deletedEntities: result.deletedEntities,\n deletedRelationships: result.deletedRelationships,\n };\n }\n\n await this.context.deepMemory.deleteRepository(repositoryId);\n this.context.evictRepository(repositoryId);\n return { message: `Repository '${repositoryId}' deleted` };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class EnsureSchemaTool extends BaseToolController {\n get name() { return 'memory_ensure_schema'; }\n get description() { return 'Ensure the storage provider schema exists (creates tables/indexes if needed). Idempotent — safe to call multiple times. Only relevant for persistent storage providers (e.g., SQL Server); no-op for in-memory storage.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {},\n };\n }\n\n protected async handleExecute(_params: Record<string, unknown>) {\n const result = await this.context.deepMemory.ensureSchema();\n return { success: true, ...result };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ValidateEntitiesTool extends BaseToolController {\n get name() { return 'memory_validate_entities'; }\n get description() {\n return 'Audit entities in the repository against the current vocabulary. Paging is issue-based: `take` caps how many issues are returned, `offset` skips that many issues. Typical workflow: call with offset=0, fix the returned issues, call again with offset=0. `offset` is only for inspecting a later slice without mutating. Loop until `done` is true. Returns issues fixable with memory_update_entity. Use memory_validate_relationships for relationships.';\n }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to validate' },\n offset: { type: 'number', description: 'Number of issues to skip before returning (default 0). The normal fix-and-retry workflow always uses 0; pass nextOffset only to inspect a later slice without fixing.' },\n take: { type: 'number', description: 'Maximum issues to return in this call (default 200)' },\n delayBetweenChunksMs: { type: 'number', description: 'Pause between export chunks for manual rate limiting (default 0)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.validateEntities({\n offset: params['offset'] as number | undefined,\n take: params['take'] as number | undefined,\n delayBetweenChunksMs: params['delayBetweenChunksMs'] as number | undefined,\n });\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ValidateRelationshipsTool extends BaseToolController {\n get name() { return 'memory_validate_relationships'; }\n get description() {\n return 'Audit relationships in the repository against the current vocabulary. Paging is issue-based: `take` caps how many issues are returned, `offset` skips that many issues. Typical workflow: call with offset=0, fix the returned issues, call again with offset=0. `offset` is only for inspecting a later slice without mutating. Loop until `done` is true. The full entity set is loaded once per call to resolve orphan and type-mismatch checks. Returns issues fixable with memory_remove_relationships / memory_create_relationships.';\n }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to validate' },\n offset: { type: 'number', description: 'Number of issues to skip before returning (default 0). The normal fix-and-retry workflow always uses 0; pass nextOffset only to inspect a later slice without fixing.' },\n take: { type: 'number', description: 'Maximum issues to return in this call (default 200)' },\n delayBetweenChunksMs: { type: 'number', description: 'Pause between export chunks for manual rate limiting (default 0)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.validateRelationships({\n offset: params['offset'] as number | undefined,\n take: params['take'] as number | undefined,\n delayBetweenChunksMs: params['delayBetweenChunksMs'] as number | undefined,\n });\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\ninterface EntityInput {\n entityType: string;\n label: string;\n summary?: string;\n properties?: Record<string, unknown>;\n data?: string;\n dataFormat?: string;\n}\n\nexport class CreateEntitiesTool extends BaseToolController {\n get name() { return 'memory_create_entities'; }\n get description() { return 'Create one or more entities (nodes) in a repository. Entity types and properties must match the repository vocabulary — call memory_open_repository first to see valid types.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to create the entities in' },\n entities: {\n type: 'array',\n description: 'Array of entities to create',\n items: {\n type: 'object',\n properties: {\n entityType: { type: 'string', description: 'Entity type (must exist in vocabulary)' },\n label: { type: 'string', description: 'Human-readable label' },\n summary: { type: 'string', description: 'Brief description of the entity' },\n properties: { type: 'object', description: 'Typed properties per vocabulary schema' },\n data: { type: 'string', description: 'Raw content/data for the entity' },\n dataFormat: { type: 'string', description: 'Format of the data field (e.g. text/plain, text/markdown)' },\n },\n required: ['entityType', 'label'],\n },\n minItems: 1,\n },\n },\n required: ['repositoryId', 'entities'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const entities = params['entities'] as EntityInput[];\n return repo.createEntities(entities.map((e) => ({\n entityType: e.entityType,\n label: e.label,\n summary: e.summary,\n properties: e.properties,\n data: e.data,\n dataFormat: e.dataFormat,\n })));\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class UpdateEntityTool extends BaseToolController {\n get name() { return 'memory_update_entity'; }\n get description() { return 'Update an existing entity — entityType, label, summary, properties, or data. Accepts entity ID (GUID) or slug. Changing entityType must be valid in the vocabulary and regenerates the slug with the new type prefix. To clear an optional field, pass null: summary/data/dataFormat set to null are cleared, and property values set to null are removed from the entity (RFC 7396 JSON Merge Patch). Omitting a field leaves it unchanged.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Entity ID (GUID) or slug' },\n entityType: { type: 'string', description: 'New entity type — must exist in the vocabulary. Regenerates the slug and re-validates properties against the new type.' },\n label: { type: 'string', description: 'New label' },\n summary: { type: ['string', 'null'], description: 'New summary. Pass null to clear the existing summary.' },\n properties: { type: 'object', description: 'Properties to merge with existing. Property values set to null are removed from the entity (RFC 7396 JSON Merge Patch semantics).' },\n data: { type: ['string', 'null'], description: 'New raw content/data. Pass null to clear.' },\n dataFormat: { type: ['string', 'null'], description: 'Format of the data field. Pass null to clear.' },\n reembed: { type: 'boolean', description: 'Force regeneration of the embedding vector (e.g. after switching embedding models)' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n // `null` is meaningful for summary/data/dataFormat (clear sentinel). Preserve it;\n // only drop fields that were omitted (undefined).\n const updates: Record<string, unknown> = {};\n if (params['entityType'] !== undefined) updates['entityType'] = params['entityType'];\n if (params['label'] !== undefined) updates['label'] = params['label'];\n if (params['summary'] !== undefined) updates['summary'] = params['summary'];\n if (params['properties'] !== undefined) updates['properties'] = params['properties'];\n if (params['data'] !== undefined) updates['data'] = params['data'];\n if (params['dataFormat'] !== undefined) updates['dataFormat'] = params['dataFormat'];\n if (params['reembed'] !== undefined) updates['reembed'] = params['reembed'];\n return repo.updateEntity(resolvedId, updates as Parameters<typeof repo.updateEntity>[1]);\n }\n}\n","/** Strip provenance field from an entity or relationship object */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function stripProvenance<T>(obj: T): Omit<T & { provenance?: unknown }, 'provenance'> {\n const { provenance, ...rest } = obj as any;\n return rest;\n}\n\n/** Strip provenance from an array of objects */\nexport function stripProvenanceArray<T>(items: T[]): Omit<T & { provenance?: unknown }, 'provenance'>[] {\n return items.map(stripProvenance);\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { stripProvenance } from '../base/stripProvenance.js';\nimport type { DetailLevel } from '@utaba/deep-memory';\n\nexport class GetEntityTool extends BaseToolController {\n get name() { return 'memory_get_entity'; }\n get description() { return 'Retrieve a single entity by ID (GUID) or slug with configurable detail level (brief, summary, or full)'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Entity ID (GUID) or slug (e.g. \"person:john-smith\")' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Level of detail (default: full)' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n const detailLevel = (params['detailLevel'] as DetailLevel) ?? 'full';\n const entity = await repo.getEntity(resolvedId, detailLevel);\n if (!entity) {\n throw new Error(`Entity '${params['entityId'] as string}' not found`);\n }\n\n return detailLevel === 'full' ? stripProvenance(entity) : entity;\n }\n}\n","import type { ProvenanceFilter } from '@utaba/deep-memory';\n\n/** Build a ProvenanceFilter from MCP tool params (conversationId, actor, dateRange) */\nexport function buildProvenanceFilter(params: Record<string, unknown>): ProvenanceFilter | undefined {\n const conversationId = params['conversationId'] as string | undefined;\n const actor = params['actor'] as string | undefined;\n const dateRange = params['dateRange'] as { from: string; to: string } | undefined;\n\n if (!conversationId && !actor && !dateRange) return undefined;\n\n return {\n conversationIds: conversationId ? [conversationId] : undefined,\n actors: actor ? [actor] : undefined,\n dateRange,\n };\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { buildProvenanceFilter } from '../base/provenanceHelper.js';\nimport { stripProvenanceArray } from '../base/stripProvenance.js';\n\nexport class FindEntitiesTool extends BaseToolController {\n get name() { return 'memory_find_entities'; }\n get description() { return 'Search for entities by label, type, or properties with pagination. Requires a repository to be opened first via memory_open_repository.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to search in' },\n searchTerm: { type: 'string', description: 'Search term to match against entity labels' },\n entityType: { type: 'string', description: 'Filter by a single entity type (convenience alias for entityTypes)' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by entity type(s)' },\n properties: { type: 'object', description: 'Filter by property values' },\n limit: { type: 'number', description: 'Max results (default 10, max 50)' },\n offset: { type: 'number', description: 'Pagination offset' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: summary)' },\n conversationId: { type: 'string', description: 'Filter to entities from this conversation' },\n actor: { type: 'string', description: 'Filter to entities created/modified by this actor' },\n dateRange: { type: 'object', properties: { from: { type: 'string' }, to: { type: 'string' } }, description: 'Filter by date range (ISO 8601)' },\n includeRelationshipSummary: { type: 'boolean', description: 'Attach a relationship count summary (outbound/inbound by type) to each entity (default false)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n // Support both singular entityType and plural entityTypes\n let entityTypes = params['entityTypes'] as string[] | undefined;\n if (!entityTypes && params['entityType']) {\n entityTypes = [params['entityType'] as string];\n }\n\n let result = await repo.findEntities({\n searchTerm: params['searchTerm'] as string | undefined,\n entityTypes,\n properties: params['properties'] as Record<string, unknown> | undefined,\n limit: params['limit'] as number | undefined,\n offset: params['offset'] as number | undefined,\n detailLevel: params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined,\n provenance: buildProvenanceFilter(params),\n });\n\n if ((params['detailLevel'] as string) === 'full') {\n result = { ...result, items: stripProvenanceArray(result.items) };\n }\n\n if (!params['includeRelationshipSummary']) {\n return result;\n }\n\n const itemsWithSummary = await Promise.all(\n result.items.map(async (entity) => {\n const relationshipSummary = await repo.getRelationshipSummary(entity.id);\n return { ...entity, relationshipSummary };\n }),\n );\n\n return { ...result, items: itemsWithSummary };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class DeleteEntitiesTool extends BaseToolController {\n get name() { return 'memory_delete_entities'; }\n get description() { return 'Delete one or more entities and their associated relationships from the knowledge graph in a single batch operation. Accepts entity IDs (GUIDs) or slugs.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entities' },\n entityIds: {\n type: 'array',\n description: 'Entity IDs (GUIDs or slugs) to delete',\n items: { type: 'string' },\n minItems: 1,\n },\n },\n required: ['repositoryId', 'entityIds'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const rawIds = params['entityIds'] as string[];\n const resolvedIds = await Promise.all(rawIds.map((id) => this.resolveEntityId(repo, id)));\n return repo.deleteEntities(resolvedIds);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ReembedRepositoryTool extends BaseToolController {\n get name() { return 'memory_reembed_repository'; }\n get description() {\n return 'Re-embed all entities in a repository. Optionally switch to a different embedding model or dimensionality — the repository metadata is updated first so subsequent writes use the new configuration. Retries failed batches with exponential backoff. Aborts early if error threshold is reached.';\n }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to re-embed' },\n model: { type: 'string', description: 'New embedding model identifier to switch the repository to (e.g. \"Qwen/Qwen3-Embedding-8B\"). Omit to keep the current model.' },\n dimensions: { type: 'number', description: 'New embedding dimensionality to switch the repository to (e.g. 1024). Omit to keep the current dimensionality.' },\n batchSize: { type: 'number', description: 'Entities per batch (default 50, max 200)' },\n maxRetries: { type: 'number', description: 'Retries per batch on embedding API failure with exponential backoff (default 3)' },\n errorThresholdToAbort: { type: 'number', description: 'Abort after this many cumulative failures. Omit for no limit.' },\n delayBetweenBatchesMs: { type: 'number', description: 'Milliseconds to wait between batches for rate limiting (default 0)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const batchSize = Math.min((params['batchSize'] as number | undefined) ?? 50, 200);\n\n const result = await this.context.deepMemory.reembedAll(repositoryId, {\n model: params['model'] as string | undefined,\n dimensions: params['dimensions'] as number | undefined,\n batchSize,\n maxRetries: params['maxRetries'] as number | undefined,\n errorThresholdToAbort: params['errorThresholdToAbort'] as number | undefined,\n delayBetweenBatchesMs: params['delayBetweenBatchesMs'] as number | undefined,\n });\n\n return {\n processed: result.processed,\n failed: result.failed,\n errors: result.errors,\n modelId: result.modelId,\n dimensions: result.dimensions,\n };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\ninterface RelationshipInput {\n relationshipType: string;\n sourceEntityId: string;\n targetEntityId: string;\n properties?: Record<string, unknown>;\n}\n\nexport class CreateRelationshipsTool extends BaseToolController {\n get name() { return 'memory_create_relationships'; }\n get description() { return 'Create one or more relationships (edges) between entities. Relationship types must be in the vocabulary. Entity references accept either GUID or slug.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entities' },\n relationships: {\n type: 'array',\n description: 'Array of relationships to create',\n items: {\n type: 'object',\n properties: {\n relationshipType: { type: 'string', description: 'Relationship type (must exist in vocabulary)' },\n sourceEntityId: { type: 'string', description: 'Source entity ID (GUID) or slug' },\n targetEntityId: { type: 'string', description: 'Target entity ID (GUID) or slug' },\n properties: { type: 'object', description: 'Typed properties per vocabulary schema' },\n },\n required: ['relationshipType', 'sourceEntityId', 'targetEntityId'],\n },\n minItems: 1,\n },\n },\n required: ['repositoryId', 'relationships'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const relationships = params['relationships'] as RelationshipInput[];\n\n // Resolve all entity IDs (supports both GUID and slug)\n const resolved = await Promise.all(\n relationships.map(async (r) => ({\n relationshipType: r.relationshipType,\n sourceEntityId: await this.resolveEntityId(repo, r.sourceEntityId),\n targetEntityId: await this.resolveEntityId(repo, r.targetEntityId),\n properties: r.properties,\n })),\n );\n\n return repo.createRelationships(resolved);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class RemoveRelationshipsTool extends BaseToolController {\n get name() { return 'memory_remove_relationships'; }\n get description() { return 'Remove one or more relationships (edges) from the knowledge graph in a single batch operation'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the relationships' },\n relationshipIds: {\n type: 'array',\n description: 'IDs of relationships to remove',\n items: { type: 'string' },\n minItems: 1,\n },\n },\n required: ['repositoryId', 'relationshipIds'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.removeRelationships(params['relationshipIds'] as string[]);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { stripProvenanceArray } from '../base/stripProvenance.js';\n\nexport class GetRelationshipsTool extends BaseToolController {\n get name() { return 'memory_get_relationships'; }\n get description() { return 'Get all relationships for a given entity, with optional type and direction filters. Accepts entity ID (GUID) or slug.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Entity ID (GUID) or slug' },\n relationshipTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by relationship type(s)' },\n direction: { type: 'string', enum: ['outbound', 'inbound', 'both'], description: 'Direction filter (default: both)' },\n limit: { type: 'number', description: 'Max results (default 20, max 100)' },\n offset: { type: 'number', description: 'Pagination offset (default 0)' },\n propertyFilters: { type: 'array', items: { type: 'object', properties: { key: { type: 'string' }, operator: { type: 'string', enum: ['eq', 'neq', 'isNull', 'isNotNull', 'gt', 'lt', 'gte', 'lte', 'contains'] }, value: {} }, required: ['key', 'operator'] }, description: 'Filter by relationship property values (AND)' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n const rawLimit = params['limit'] as number | undefined;\n const limit = Math.min(rawLimit ?? 20, 100);\n const result = await repo.getRelationships(resolvedId, {\n relationshipTypes: params['relationshipTypes'] as string[] | undefined,\n direction: params['direction'] as 'outbound' | 'inbound' | 'both' | undefined,\n limit,\n offset: (params['offset'] as number | undefined) ?? 0,\n propertyFilters: params['propertyFilters'] as import('@utaba/deep-memory').PropertyFilter[] | undefined,\n });\n\n // Always strip provenance from relationships\n return { ...result, items: stripProvenanceArray(result.items) };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { stripProvenance, stripProvenanceArray } from '../base/stripProvenance.js';\n\nexport class ExploreNeighborhoodTool extends BaseToolController {\n get name() { return 'memory_explore_neighborhood'; }\n get description() { return 'Explore the neighborhood of an entity using BFS traversal (depth 1-3). Accepts entity ID (GUID) or slug.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Starting entity ID (GUID) or slug' },\n depth: { type: 'number', enum: [1, 2, 3], description: 'Exploration depth (default: 1)' },\n relationshipTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by relationship type(s)' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter result entity types' },\n direction: { type: 'string', enum: ['outbound', 'inbound', 'both'], description: 'Direction filter (default: both)' },\n limitPerType: { type: 'number', description: 'Max entities per relationship type (default 10, max 50)' },\n offsetPerType: { type: 'number', description: 'Pagination offset per relationship type (default 0)' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: summary)' },\n relationshipPropertyFilters: { type: 'array', items: { type: 'object', properties: { key: { type: 'string' }, operator: { type: 'string', enum: ['eq', 'neq', 'isNull', 'isNotNull', 'gt', 'lt', 'gte', 'lte', 'contains'] }, value: {} }, required: ['key', 'operator'] }, description: 'Filter relationships by property values (AND)' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n const rawLimitPerType = params['limitPerType'] as number | undefined;\n const limitPerType = Math.min(rawLimitPerType ?? 10, 50);\n const detailLevel = params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined;\n const result = await repo.exploreNeighborhood(resolvedId, {\n depth: params['depth'] as 1 | 2 | 3 | undefined,\n relationshipTypes: params['relationshipTypes'] as string[] | undefined,\n entityTypes: params['entityTypes'] as string[] | undefined,\n direction: params['direction'] as 'outbound' | 'inbound' | 'both' | undefined,\n limitPerType,\n offsetPerType: (params['offsetPerType'] as number | undefined) ?? 0,\n detailLevel,\n relationshipPropertyFilters: params['relationshipPropertyFilters'] as import('@utaba/deep-memory').PropertyFilter[] | undefined,\n });\n\n if (detailLevel === 'full') {\n result.center = stripProvenance(result.center);\n for (const layer of result.layers) {\n for (const key of Object.keys(layer)) {\n const bucket = layer[key];\n if (bucket && typeof bucket === 'object' && 'entities' in bucket) {\n const b = bucket as { entities: Array<{ provenance?: unknown }> };\n b.entities = stripProvenanceArray(b.entities) as typeof b.entities;\n }\n }\n }\n }\n\n return result;\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { stripProvenance, stripProvenanceArray } from '../base/stripProvenance.js';\n\nexport class FindPathsTool extends BaseToolController {\n get name() { return 'memory_find_paths'; }\n get description() { return 'Find paths between two entities in the knowledge graph. Accepts entity IDs (GUID) or slugs.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entities' },\n sourceEntityId: { type: 'string', description: 'Starting entity ID (GUID) or slug' },\n targetEntityId: { type: 'string', description: 'Destination entity ID (GUID) or slug' },\n maxDepth: { type: 'number', description: 'Maximum path depth (default: 3, max: 5)' },\n relationshipTypes: { type: 'array', items: { type: 'string' }, description: 'Filter allowed relationship types' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter entities in paths by type(s)' },\n limit: { type: 'number', description: 'Maximum number of paths to return (default: 5)' },\n offset: { type: 'number', description: 'Pagination offset (default: 0)' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: brief)' },\n relationshipPropertyFilters: { type: 'array', items: { type: 'object', properties: { key: { type: 'string' }, operator: { type: 'string', enum: ['eq', 'neq', 'isNull', 'isNotNull', 'gt', 'lt', 'gte', 'lte', 'contains'] }, value: {} }, required: ['key', 'operator'] }, description: 'Filter relationships by property values (AND)' },\n },\n required: ['repositoryId', 'sourceEntityId', 'targetEntityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const sourceId = await this.resolveEntityId(repo, params['sourceEntityId'] as string);\n const targetId = await this.resolveEntityId(repo, params['targetEntityId'] as string);\n const detailLevel = params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined;\n const result = await repo.findPaths(sourceId, targetId, {\n maxDepth: params['maxDepth'] as number | undefined,\n relationshipTypes: params['relationshipTypes'] as string[] | undefined,\n entityTypes: params['entityTypes'] as string[] | undefined,\n limit: params['limit'] as number | undefined,\n offset: params['offset'] as number | undefined,\n detailLevel,\n relationshipPropertyFilters: params['relationshipPropertyFilters'] as import('@utaba/deep-memory').PropertyFilter[] | undefined,\n });\n\n // Always strip provenance from entities and relationships\n if (detailLevel === 'full') {\n for (const path of result.paths) {\n path.entities = stripProvenanceArray(path.entities);\n path.relationships = path.relationships.map(r => stripProvenance(r));\n }\n } else {\n // Relationships always have provenance regardless of detail level\n for (const path of result.paths) {\n path.relationships = path.relationships.map(r => stripProvenance(r));\n }\n }\n\n return result;\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nconst PAGE_SIZE = 200;\n\nexport class GetGraphTool extends BaseToolController {\n get name() { return 'memory_get_graph'; }\n get description() { return 'Get the knowledge graph for a repository — entities, relationships, vocabulary, and stats. Returns up to 200 entities per page with a cursor for continuation. For large repositories, prefer memory_query_graph, memory_find_entities with filters and memory_explore_neighborhood for targeted exploration.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to get the graph for' },\n cursor: { type: 'string', description: 'Opaque cursor from a previous response to fetch the next page' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: summary)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const cursor = params['cursor'] as string | undefined;\n const repo = await this.context.getRepository(repositoryId);\n\n const offset = cursor ? parseInt(cursor.split(':')[1]!, 10) : 0;\n const detailLevel = params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined;\n const result = await repo.getGraph({ limit: PAGE_SIZE, offset, detailLevel });\n\n // Always strip provenance from relationships\n result.relationships = result.relationships.map(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ({ provenance, ...rest }) => rest,\n ) as typeof result.relationships;\n\n return result;\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport type { TraversalSpec } from '@utaba/deep-memory';\n\nconst propertyFilterSchema = {\n type: 'object',\n properties: {\n key: { type: 'string' },\n operator: { type: 'string', enum: ['eq', 'neq', 'isNull', 'isNotNull', 'gt', 'lt', 'gte', 'lte', 'contains'] },\n value: {},\n },\n required: ['key', 'operator'],\n};\n\nexport class QueryGraphTool extends BaseToolController {\n get name() { return 'memory_query_graph'; }\n get description() {\n return `Query the knowledge graph — vertex lookups, property projection, and multi-hop traversals in a single tool.\n\n## Projection (property extraction and aggregation)\n\nUse \\`projection\\` to extract property values from entities. When projection is present, only the aggregated values are returned (no entity objects) — this keeps responses lightweight. Set \\`projection.includeEntities: true\\` if you also need the full entity objects.\n\n- Distinct values: \\`{ start: { entityType: \"Equipment\" }, projection: { properties: [\"equipmentType\"], distinct: true }, limit: 200 }\\`\n- Count by value: \\`{ start: { entityType: \"Equipment\" }, projection: { properties: [\"equipmentType\"], mode: \"count\" }, limit: 200 }\\`\n- Multi-property: \\`{ start: { entityType: \"Equipment\" }, projection: { properties: [\"equipmentType\", \"tier\"], distinct: true }, limit: 200 }\\`\n\n## Vertex queries (no steps, no projection)\n\nQuery entities directly by type and properties — returns entity objects:\n- By type: \\`{ start: { entityType: \"Fluid\" }, limit: 50 }\\`\n- With filter: \\`{ start: { entityType: \"Fluid\", filter: [{ key: \"fluidType\", operator: \"eq\", value: \"hydraulic-oil\" }] }, limit: 50 }\\`\n\n## Traversals (with steps)\n\nFollow relationships through the graph:\n- 2-hop: \\`{ start: { entityId: \"Equipment:komatsu-pc7000-11\" }, steps: [{ direction: \"out\", relationshipTypes: [\"HAS_COMPONENT\"] }, { direction: \"out\", relationshipTypes: [\"REQUIRES_FLUID\"] }] }\\`\n- Filtered edges: \\`{ start: { entityId: \"Equipment:komatsu-pc7000-11\" }, steps: [{ direction: \"both\", relationshipTypes: [\"COMPATIBLE_WITH\"], relationshipFilter: [{ key: \"passCount\", operator: \"gte\", value: 3 }] }] }\\`\n- Variable depth: \\`{ start: { entityId: \"...\" }, steps: [{ direction: \"out\", relationshipTypes: [\"CONTAINS\"], repeat: { maxDepth: 5 } }] }\\`\n\nProjection works with traversals too — add \\`projection\\` to aggregate properties from the traversal results.`;\n }\n\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to query' },\n start: {\n type: 'object',\n description: 'Which entities to query or start traversing from',\n properties: {\n entityId: { type: 'string', description: 'Specific entity by ID (GUID) or slug' },\n entityType: { type: 'string', description: 'All entities of a given type (requires limit)' },\n filter: { type: 'array', items: propertyFilterSchema, description: 'Filter entities by property values' },\n },\n },\n steps: {\n type: 'array',\n description: 'Relationship hops to follow. Omit for vertex-only queries.',\n items: {\n type: 'object',\n properties: {\n direction: { type: 'string', enum: ['out', 'in', 'both'], description: 'Direction to traverse' },\n relationshipTypes: { type: 'array', items: { type: 'string' }, description: 'Relationship types to follow (omit for all)' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter target entities by type' },\n relationshipFilter: { type: 'array', items: propertyFilterSchema, description: 'Filter relationships by property values' },\n entityFilter: { type: 'array', items: propertyFilterSchema, description: 'Filter target entities by property values' },\n repeat: {\n type: 'object',\n description: 'Repeat this step for variable-depth traversal',\n properties: {\n maxDepth: { type: 'number', description: 'Maximum iterations (required)' },\n until: { type: 'array', items: propertyFilterSchema, description: 'Stop when entity matches these filters' },\n emitIntermediates: { type: 'boolean', description: 'Include intermediate entities (default: true)' },\n },\n required: ['maxDepth'],\n },\n },\n required: ['direction'],\n },\n },\n projection: {\n type: 'object',\n description: 'Property projection — extract and aggregate property values from result entities. When present, only aggregations are returned (no entity objects). Set includeEntities: true to also get entity objects.',\n properties: {\n properties: { type: 'array', items: { type: 'string' }, description: 'Property names to extract from entities' },\n distinct: { type: 'boolean', description: 'Return only distinct value combinations (default: false)' },\n mode: { type: 'string', enum: ['values', 'count'], description: 'values (default): raw property values. count: count entities per distinct combination' },\n includeEntities: { type: 'boolean', description: 'Also return full entity objects alongside projections (default: false)' },\n },\n required: ['properties'],\n },\n returnMode: { type: 'string', enum: ['terminal', 'path', 'all'], description: 'What to return (default: terminal)' },\n limit: { type: 'number', description: 'Maximum results (default: 50, max: 200)' },\n offset: { type: 'number', description: 'Pagination offset (default: 0)' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for entities (default: summary)' },\n dedup: { type: 'boolean', description: 'Deduplicate entities (default: true)' },\n includeRelationshipSummary: { type: 'boolean', description: 'Attach outbound/inbound relationship counts by type to each entity (default: true). Set false to reduce response size.' },\n },\n required: ['repositoryId', 'start'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n\n const start = params['start'] as TraversalSpec['start'];\n if (start.entityId) {\n start.entityId = await this.resolveEntityId(repo, start.entityId);\n }\n\n const spec: TraversalSpec = {\n start,\n steps: params['steps'] as TraversalSpec['steps'],\n returnMode: (params['returnMode'] as TraversalSpec['returnMode']) ?? 'terminal',\n projection: params['projection'] as TraversalSpec['projection'],\n limit: params['limit'] as number | undefined,\n offset: params['offset'] as number | undefined,\n detailLevel: params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined,\n dedup: params['dedup'] as boolean | undefined,\n includeRelationshipSummary: (params['includeRelationshipSummary'] as boolean | undefined) ?? true,\n includeProvenance: false,\n };\n\n return repo.traverse(spec);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class SearchByConceptTool extends BaseToolController {\n get name() { return 'memory_search_by_concept'; }\n get description() { return 'Semantic search for entities by concept similarity (requires an EmbeddingProvider)'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to search in' },\n query: { type: 'string', description: 'Natural language search query' },\n similarityThreshold: { type: 'number', description: 'Minimum similarity score 0.0-1.0 (default: 0.7)' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by entity type(s)' },\n limit: { type: 'number', description: 'Max results (default 10)' },\n offset: { type: 'number', description: 'Pagination offset' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: summary)' },\n },\n required: ['repositoryId', 'query'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.searchByConcept(params['query'] as string, {\n similarityThreshold: params['similarityThreshold'] as number | undefined,\n entityTypes: params['entityTypes'] as string[] | undefined,\n limit: params['limit'] as number | undefined,\n offset: params['offset'] as number | undefined,\n detailLevel: params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined,\n });\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\n/** Strip createdAt/createdBy/modifiedAt/modifiedBy from a vocabulary type definition */\nfunction stripVocabularyProvenance<T>(obj: T): Omit<T, 'createdAt' | 'createdBy' | 'modifiedAt' | 'modifiedBy'> {\n const { createdAt, createdBy, modifiedAt, modifiedBy, ...rest } = obj as Record<string, unknown>;\n return rest as Omit<T, 'createdAt' | 'createdBy' | 'modifiedAt' | 'modifiedBy'>;\n}\n\nexport class GetVocabularyTool extends BaseToolController {\n get name() { return 'memory_get_vocabulary'; }\n get description() { return 'Get the vocabulary definition for a repository — shows available entity types, relationship types, and governance mode'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to get vocabulary for' },\n includeProvenance: { type: 'boolean', description: 'Include createdAt/createdBy/modifiedAt/modifiedBy on type definitions (default: false)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const result = await repo.getVocabulary();\n const includeProvenance = params['includeProvenance'] === true;\n\n if (!includeProvenance) {\n return {\n ...result,\n vocabulary: {\n ...result.vocabulary,\n entityTypes: result.vocabulary.entityTypes.map(stripVocabularyProvenance),\n relationshipTypes: result.vocabulary.relationshipTypes.map(stripVocabularyProvenance),\n },\n };\n }\n\n return result;\n }\n}\n","import type { VocabularyProposal } from '@utaba/deep-memory';\nimport { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ProposeVocabularyExtensionTool extends BaseToolController {\n get name() { return 'memory_propose_vocabulary_extension'; }\n get description() { return 'Propose a new entity type or relationship type. Only needed when the vocabulary doesn\\'t already include the type you need — check memory_open_repository response first.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to modify' },\n proposalType: {\n type: 'string',\n enum: [\n 'entity_type',\n 'relationship_type',\n 'edit_entity_type',\n 'edit_relationship_type',\n 'delete_entity_type',\n 'delete_relationship_type',\n ],\n description: 'Type of vocabulary change',\n },\n entityType: {\n type: 'object',\n description: 'Entity type definition (when proposalType is entity_type)',\n properties: {\n type: { type: 'string', description: 'Type name' },\n description: { type: 'string', description: 'Type description' },\n properties: { type: 'array', items: { type: 'object' }, description: 'Property schema definitions' },\n },\n required: ['type', 'description'],\n },\n relationshipType: {\n type: 'object',\n description: 'Relationship type definition (when proposalType is relationship_type)',\n properties: {\n type: { type: 'string', description: 'Type name' },\n description: { type: 'string', description: 'Type description' },\n allowedSourceTypes: { type: 'array', items: { type: 'string' } },\n allowedTargetTypes: { type: 'array', items: { type: 'string' } },\n bidirectional: { type: 'boolean' },\n properties: { type: 'array', items: { type: 'object' }, description: 'Property schema definitions' },\n },\n required: ['type', 'description', 'allowedSourceTypes', 'allowedTargetTypes'],\n },\n editEntityType: {\n type: 'object',\n description: 'Edit an existing entity type (when proposalType is edit_entity_type)',\n properties: {\n type: { type: 'string', description: 'Name of the entity type to edit' },\n description: { type: 'string', description: 'New description (optional)' },\n addProperties: { type: 'array', items: { type: 'object' }, description: 'Properties to add' },\n removeProperties: { type: 'array', items: { type: 'string' }, description: 'Property names to remove' },\n updateProperties: { type: 'array', items: { type: 'object' }, description: 'Properties to update (matched by name)' },\n },\n required: ['type'],\n },\n editRelationshipType: {\n type: 'object',\n description: 'Edit an existing relationship type (when proposalType is edit_relationship_type)',\n properties: {\n type: { type: 'string', description: 'Name of the relationship type to edit' },\n description: { type: 'string', description: 'New description (optional)' },\n allowedSourceTypes: { type: 'array', items: { type: 'string' }, description: 'New allowed source types' },\n allowedTargetTypes: { type: 'array', items: { type: 'string' }, description: 'New allowed target types' },\n bidirectional: { type: 'boolean', description: 'New bidirectional flag' },\n addProperties: { type: 'array', items: { type: 'object' }, description: 'Properties to add' },\n removeProperties: { type: 'array', items: { type: 'string' }, description: 'Property names to remove' },\n updateProperties: { type: 'array', items: { type: 'object' }, description: 'Properties to update (matched by name)' },\n },\n required: ['type'],\n },\n deleteEntityType: {\n type: 'object',\n description: 'Delete an entity type and all its instances (when proposalType is delete_entity_type)',\n properties: {\n type: { type: 'string', description: 'Name of the entity type to delete' },\n },\n required: ['type'],\n },\n deleteRelationshipType: {\n type: 'object',\n description: 'Delete a relationship type and all its instances (when proposalType is delete_relationship_type)',\n properties: {\n type: { type: 'string', description: 'Name of the relationship type to delete' },\n },\n required: ['type'],\n },\n justification: { type: 'string', description: 'Why this vocabulary change is needed' },\n },\n required: ['repositoryId', 'proposalType'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n\n const proposal: VocabularyProposal = {\n proposalType: params['proposalType'] as VocabularyProposal['proposalType'],\n entityType: params['entityType'] as VocabularyProposal['entityType'],\n relationshipType: params['relationshipType'] as VocabularyProposal['relationshipType'],\n editEntityType: params['editEntityType'] as VocabularyProposal['editEntityType'],\n editRelationshipType: params['editRelationshipType'] as VocabularyProposal['editRelationshipType'],\n deleteEntityType: params['deleteEntityType'] as VocabularyProposal['deleteEntityType'],\n deleteRelationshipType: params['deleteRelationshipType'] as VocabularyProposal['deleteRelationshipType'],\n justification: (params['justification'] as string) ?? '',\n };\n\n return repo.proposeVocabularyChange(proposal);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class GetStatsTool extends BaseToolController {\n get name() { return 'memory_get_stats'; }\n get description() { return 'Get statistics for a repository — entity count, relationship count, type breakdowns'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to get stats for' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.getStats();\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { buildProvenanceFilter } from '../base/provenanceHelper.js';\n\nexport class GetTimelineTool extends BaseToolController {\n get name() { return 'memory_get_timeline'; }\n get description() { return 'Get the activity timeline for an entity — creation, updates, and relationship changes. Accepts entity ID (GUID) or slug.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Entity ID (GUID) or slug' },\n from: { type: 'string', description: 'Start of time range (ISO 8601)' },\n to: { type: 'string', description: 'End of time range (ISO 8601)' },\n eventTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by event types' },\n limit: { type: 'number', description: 'Max events (default 20, max 100)' },\n offset: { type: 'number', description: 'Pagination offset' },\n conversationId: { type: 'string', description: 'Filter to events from this conversation' },\n actor: { type: 'string', description: 'Filter to events by this actor' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n const timeRange = params['from'] && params['to']\n ? { from: params['from'] as string, to: params['to'] as string }\n : undefined;\n const rawLimit = params['limit'] as number | undefined;\n const limit = Math.min(rawLimit ?? 20, 100);\n return repo.getTimeline(resolvedId, {\n timeRange,\n eventTypes: params['eventTypes'] as string[] | undefined,\n limit,\n offset: (params['offset'] as number | undefined) ?? 0,\n provenance: buildProvenanceFilter(params),\n });\n }\n}\n","import { mkdirSync } from 'node:fs';\nimport { writeFile } from 'node:fs/promises';\nimport { join, resolve } from 'node:path';\nimport type { ExportLegalMetadata } from '@utaba/deep-memory';\nimport type { ILogger } from '../../interfaces/ILogger.js';\nimport { BaseToolController } from '../base/BaseToolController.js';\nimport type { ToolContext } from '../base/BaseToolController.js';\nimport { createZip, type ZipEntry } from './zip.js';\n\n/** Maximum entities or relationships per chunk file */\nconst CHUNK_SIZE = 500;\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction slugify(text: string): string {\n return (\n text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '') || 'repository'\n );\n}\n\nfunction formatDatetime(date: Date): string {\n const p = (n: number) => String(n).padStart(2, '0');\n return (\n `${date.getFullYear()}${p(date.getMonth() + 1)}${p(date.getDate())}` +\n `-${p(date.getHours())}${p(date.getMinutes())}${p(date.getSeconds())}`\n );\n}\n\nfunction toBuffer(obj: unknown): Buffer {\n return Buffer.from(JSON.stringify(obj, null, 2), 'utf8');\n}\n\n// ---------------------------------------------------------------------------\n// Tool\n// ---------------------------------------------------------------------------\n\nexport class ExportRepositoryTool extends BaseToolController {\n constructor(\n context: ToolContext,\n logger: ILogger,\n private exportDir: string,\n ) {\n super(context, logger);\n }\n\n get name() {\n return 'memory_export_repository';\n }\n\n get description() {\n return (\n 'Export a memory repository to a .dkg (Deep Knowledge Graph) file on the local filesystem. ' +\n 'The archive contains manifest.json, vocabulary.json, and chunked ' +\n 'entities/relationships files. Returns the path — no data is sent to the AI.'\n );\n }\n\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: {\n type: 'string',\n description: 'UUID of the repository to export',\n },\n legal: {\n type: 'object',\n description: 'Optional legal/copyright metadata to embed in the archive manifest',\n properties: {\n copyright: {\n type: 'string',\n description: 'Copyright holder (e.g. \"© 2026 Caterpillar Inc.\")',\n },\n license: {\n type: 'string',\n description: 'SPDX license identifier or custom license name (e.g. \"Apache-2.0\", \"LicenseRef-Proprietary\")',\n },\n licenseUrl: {\n type: 'string',\n description: 'Full license text or URL pointing to license terms',\n },\n terms: {\n type: 'string',\n description: 'Human-readable usage terms or restrictions summary',\n },\n publisher: {\n type: 'string',\n description: 'Organization that published this archive',\n },\n contact: {\n type: 'string',\n description: 'Contact for licensing questions (e.g. email address)',\n },\n },\n required: ['copyright'],\n },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const legal = params['legal'] as ExportLegalMetadata | undefined;\n\n this.logger.info(this.name, `Exporting repository ${repositoryId}`);\n const startTime = Date.now();\n\n const exportOptions = legal ? { legal } : undefined;\n\n const entries: ZipEntry[] = [];\n let entityCount = 0;\n let relationshipCount = 0;\n let entityChunkNum = 0;\n let relationshipChunkNum = 0;\n let label = '';\n let vocabVersion = '';\n let exportedAt = '';\n\n for await (const item of this.context.deepMemory.exportRepositoryStream(repositoryId, exportOptions)) {\n switch (item.type) {\n case 'manifest':\n entries.push({ name: 'manifest.json', data: toBuffer(item.data) });\n label = item.data.repository.label;\n vocabVersion = item.data.repository.vocabularyVersion;\n exportedAt = item.data.exportedAt;\n break;\n\n case 'vocabulary':\n entries.push({ name: 'vocabulary.json', data: toBuffer(item.data) });\n break;\n\n case 'entities': {\n const allEntities = item.data;\n for (let i = 0; i < allEntities.length; i += CHUNK_SIZE) {\n const chunk = allEntities.slice(i, i + CHUNK_SIZE);\n entityChunkNum++;\n entries.push({\n name: `entities-${String(entityChunkNum).padStart(4, '0')}.json`,\n data: toBuffer(chunk),\n });\n }\n entityCount += allEntities.length;\n break;\n }\n\n case 'relationships': {\n const allRels = item.data;\n for (let i = 0; i < allRels.length; i += CHUNK_SIZE) {\n const chunk = allRels.slice(i, i + CHUNK_SIZE);\n relationshipChunkNum++;\n entries.push({\n name: `relationships-${String(relationshipChunkNum).padStart(4, '0')}.json`,\n data: toBuffer(chunk),\n });\n }\n relationshipCount += allRels.length;\n break;\n }\n }\n }\n\n const slug = slugify(label);\n const datetime = formatDatetime(new Date(exportedAt));\n const zipName = `${slug}-v${vocabVersion}-${datetime}.dkg`;\n\n const exportDir = resolve(this.exportDir);\n mkdirSync(exportDir, { recursive: true });\n\n const filePath = join(exportDir, zipName);\n const zipBuffer = createZip(entries);\n await writeFile(filePath, zipBuffer);\n\n const elapsedMs = Date.now() - startTime;\n const elapsedSec = (elapsedMs / 1000).toFixed(1);\n\n this.logger.info(this.name, `Exported to ${filePath} (${entries.length} files) in ${elapsedSec}s`);\n\n return {\n path: filePath,\n filename: zipName,\n repository: label,\n vocabularyVersion: vocabVersion,\n statistics: {\n entities: entityCount,\n relationships: relationshipCount,\n files: entries.length,\n },\n timing: {\n elapsedMs,\n elapsedFormatted: `${elapsedSec}s`,\n },\n };\n }\n}\n","// Minimal multi-entry ZIP writer/reader using Node built-ins (no extra deps)\n\nimport { deflateRawSync, inflateRawSync } from 'node:zlib';\n\n// ---------------------------------------------------------------------------\n// CRC-32\n// ---------------------------------------------------------------------------\n\nconst crc32Table = new Uint32Array(256);\nfor (let i = 0; i < 256; i++) {\n let c = i;\n for (let j = 0; j < 8; j++) {\n c = c & 1 ? (0xedb88320 ^ (c >>> 1)) : c >>> 1;\n }\n crc32Table[i] = c;\n}\n\nfunction computeCrc32(data: Buffer): number {\n let crc = 0xffffffff;\n for (let i = 0; i < data.length; i++) {\n crc = (crc32Table[(crc ^ data[i]!) & 0xff]! ^ (crc >>> 8)) >>> 0;\n }\n return (crc ^ 0xffffffff) >>> 0;\n}\n\n// ---------------------------------------------------------------------------\n// ZIP writer — multiple entries\n// ---------------------------------------------------------------------------\n\nexport interface ZipEntry {\n name: string;\n data: Buffer;\n}\n\nexport function createZip(entries: ZipEntry[]): Buffer {\n const now = new Date();\n const dosTime =\n ((now.getHours() << 11) | (now.getMinutes() << 5) | (now.getSeconds() >> 1)) & 0xffff;\n const dosDate =\n ((((now.getFullYear() - 1980) & 0x7f) << 9) |\n (((now.getMonth() + 1) & 0x0f) << 5) |\n (now.getDate() & 0x1f)) &\n 0xffff;\n\n const localParts: Buffer[] = [];\n const centralParts: Buffer[] = [];\n let offset = 0;\n\n for (const entry of entries) {\n const nameBytes = Buffer.from(entry.name, 'utf8');\n const compressed = deflateRawSync(entry.data);\n const crc = computeCrc32(entry.data);\n\n // Local file header\n const local = Buffer.allocUnsafe(30 + nameBytes.length);\n local.writeUInt32LE(0x04034b50, 0);\n local.writeUInt16LE(20, 4);\n local.writeUInt16LE(0, 6);\n local.writeUInt16LE(8, 8);\n local.writeUInt16LE(dosTime, 10);\n local.writeUInt16LE(dosDate, 12);\n local.writeUInt32LE(crc, 14);\n local.writeUInt32LE(compressed.length, 18);\n local.writeUInt32LE(entry.data.length, 22);\n local.writeUInt16LE(nameBytes.length, 26);\n local.writeUInt16LE(0, 28);\n nameBytes.copy(local, 30);\n\n // Central directory header\n const central = Buffer.allocUnsafe(46 + nameBytes.length);\n central.writeUInt32LE(0x02014b50, 0);\n central.writeUInt16LE(20, 4);\n central.writeUInt16LE(20, 6);\n central.writeUInt16LE(0, 8);\n central.writeUInt16LE(8, 10);\n central.writeUInt16LE(dosTime, 12);\n central.writeUInt16LE(dosDate, 14);\n central.writeUInt32LE(crc, 16);\n central.writeUInt32LE(compressed.length, 20);\n central.writeUInt32LE(entry.data.length, 24);\n central.writeUInt16LE(nameBytes.length, 28);\n central.writeUInt16LE(0, 30);\n central.writeUInt16LE(0, 32);\n central.writeUInt16LE(0, 34);\n central.writeUInt16LE(0, 36);\n central.writeUInt32LE(0, 38);\n central.writeUInt32LE(offset, 42);\n nameBytes.copy(central, 46);\n\n localParts.push(local, compressed);\n centralParts.push(central);\n offset += local.length + compressed.length;\n }\n\n const centralDirOffset = offset;\n const centralDirBuf = Buffer.concat(centralParts);\n\n // End of central directory\n const eocd = Buffer.allocUnsafe(22);\n eocd.writeUInt32LE(0x06054b50, 0);\n eocd.writeUInt16LE(0, 4);\n eocd.writeUInt16LE(0, 6);\n eocd.writeUInt16LE(entries.length, 8);\n eocd.writeUInt16LE(entries.length, 10);\n eocd.writeUInt32LE(centralDirBuf.length, 12);\n eocd.writeUInt32LE(centralDirOffset, 16);\n eocd.writeUInt16LE(0, 20);\n\n return Buffer.concat([...localParts, centralDirBuf, eocd]);\n}\n\n// ---------------------------------------------------------------------------\n// ZIP reader — multiple entries, returned as a name→data map\n// ---------------------------------------------------------------------------\n\nexport function readZip(zipBuffer: Buffer): Map<string, Buffer> {\n // Find EOCD\n let eocdOffset = -1;\n for (let i = zipBuffer.length - 22; i >= 0; i--) {\n if (zipBuffer.readUInt32LE(i) === 0x06054b50) {\n eocdOffset = i;\n break;\n }\n }\n if (eocdOffset === -1) {\n throw new Error('Invalid ZIP file: end of central directory record not found');\n }\n\n const entryCount = zipBuffer.readUInt16LE(eocdOffset + 10);\n const centralDirOffset = zipBuffer.readUInt32LE(eocdOffset + 16);\n\n const entries = new Map<string, Buffer>();\n let pos = centralDirOffset;\n\n for (let i = 0; i < entryCount; i++) {\n if (zipBuffer.readUInt32LE(pos) !== 0x02014b50) {\n throw new Error('Invalid ZIP file: central directory header not found');\n }\n\n const compressionMethod = zipBuffer.readUInt16LE(pos + 10);\n const compressedSize = zipBuffer.readUInt32LE(pos + 20);\n const nameLength = zipBuffer.readUInt16LE(pos + 28);\n const extraLength = zipBuffer.readUInt16LE(pos + 30);\n const commentLength = zipBuffer.readUInt16LE(pos + 32);\n const localHeaderOffset = zipBuffer.readUInt32LE(pos + 42);\n\n const name = zipBuffer.subarray(pos + 46, pos + 46 + nameLength).toString('utf8');\n pos += 46 + nameLength + extraLength + commentLength;\n\n // Read from local file header\n const localNameLength = zipBuffer.readUInt16LE(localHeaderOffset + 26);\n const localExtraLength = zipBuffer.readUInt16LE(localHeaderOffset + 28);\n const dataOffset = localHeaderOffset + 30 + localNameLength + localExtraLength;\n const compressedData = zipBuffer.subarray(dataOffset, dataOffset + compressedSize);\n\n if (compressionMethod === 0) {\n entries.set(name, Buffer.from(compressedData));\n } else if (compressionMethod === 8) {\n entries.set(name, Buffer.from(inflateRawSync(compressedData)));\n } else {\n throw new Error(`Unsupported ZIP compression method: ${compressionMethod}`);\n }\n }\n\n return entries;\n}\n","import { readFile } from 'node:fs/promises';\nimport type {\n ExportManifest,\n StoredEntity,\n StoredRelationship,\n} from '@utaba/deep-memory';\nimport type {\n AdaptiveConcurrencyAdjustEvent,\n MemoryVocabulary,\n} from '@utaba/deep-memory/types';\nimport { BaseToolController } from '../base/BaseToolController.js';\nimport { readZip } from './zip.js';\n\n// ---------------------------------------------------------------------------\n// Tool\n// ---------------------------------------------------------------------------\n\nexport class ImportRepositoryTool extends BaseToolController {\n get name() {\n return 'memory_import_repository';\n }\n\n get description() {\n return (\n 'Import a .dkg (Deep Knowledge Graph) archive. ' +\n 'Also accepts legacy .zip archives. ' +\n 'Mode \"create\" creates a new repository and uses fast bulk inserts (no existence checks). ' +\n 'Mode \"merge\" (default) imports into an existing repository — entities with matching IDs are overwritten; new vocabulary types are added automatically. ' +\n 'Supports both multi-file (manifest.json + chunks) and legacy single-file archives.'\n );\n }\n\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: {\n type: 'string',\n description: 'UUID of the target repository to import into (merge) or for the new repository (create)',\n },\n path: {\n type: 'string',\n description: 'Absolute path to the .dkg or .zip archive to import',\n },\n mode: {\n type: 'string',\n enum: ['create', 'merge'],\n description: 'Import mode: \"create\" for a new repository (fast, no existence checks), \"merge\" to import into an existing repository (default: merge)',\n },\n },\n required: ['repositoryId', 'path'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const filePath = params['path'] as string;\n const mode = (params['mode'] as string) ?? 'merge';\n\n this.logger.info(this.name, `Importing ${filePath} into repository ${repositoryId} (mode: ${mode})`);\n const startTime = Date.now();\n\n const zipBuffer = await readFile(filePath);\n const files = readZip(zipBuffer);\n\n // Detect format: multi-file (has manifest.json) vs legacy single-file\n const manifestBuf = files.get('manifest.json');\n\n let manifest: ExportManifest;\n let vocabulary: MemoryVocabulary;\n const entities: StoredEntity[] = [];\n const relationships: StoredRelationship[] = [];\n\n if (manifestBuf) {\n // Multi-file format\n manifest = JSON.parse(manifestBuf.toString('utf8')) as ExportManifest;\n\n const vocabBuf = files.get('vocabulary.json');\n if (!vocabBuf) {\n throw new Error('Invalid archive: manifest.json present but vocabulary.json missing');\n }\n vocabulary = JSON.parse(vocabBuf.toString('utf8')) as MemoryVocabulary;\n\n // Collect entity and relationship chunks in sorted order\n const sortedNames = [...files.keys()].sort();\n for (const name of sortedNames) {\n if (name.startsWith('entities-') && name.endsWith('.json')) {\n const chunk = JSON.parse(files.get(name)!.toString('utf8')) as StoredEntity[];\n entities.push(...chunk);\n } else if (name.startsWith('relationships-') && name.endsWith('.json')) {\n const chunk = JSON.parse(files.get(name)!.toString('utf8')) as StoredRelationship[];\n relationships.push(...chunk);\n }\n }\n } else {\n // Legacy single-file format — first entry is the full archive JSON\n const firstEntry = files.values().next().value;\n if (!firstEntry) {\n throw new Error('Invalid archive: zip file is empty');\n }\n const legacy = JSON.parse(firstEntry.toString('utf8')) as {\n manifest: ExportManifest;\n vocabulary: MemoryVocabulary;\n entities: StoredEntity[];\n relationships: StoredRelationship[];\n };\n manifest = legacy.manifest;\n vocabulary = legacy.vocabulary;\n entities.push(...legacy.entities);\n relationships.push(...legacy.relationships);\n }\n\n const onAdjust = (event: AdaptiveConcurrencyAdjustEvent): void => {\n this.logger.info(\n this.name,\n `Adaptive concurrency ${event.reason}: ${event.previousConcurrency} -> ${event.concurrency} ` +\n `(tasks=${event.tasksCompleted}, throttled=${event.throttledCount})`,\n );\n };\n\n const importOptions = mode === 'create'\n ? {\n target: {\n mode: 'create' as const,\n repositoryId,\n config: {\n label: manifest.repository.label,\n type: manifest.repository.type,\n description: manifest.repository.description,\n governance: { mode: manifest.repository.governanceMode },\n },\n },\n bulk: {\n adaptiveConcurrency: { onAdjust },\n },\n }\n : {\n target: { mode: 'merge' as const, repositoryId },\n vocabularyConflict: 'extend' as const,\n entityConflict: 'overwrite' as const,\n bulk: {\n adaptiveConcurrency: { onAdjust },\n },\n };\n\n const result = await this.context.deepMemory.importRepository(\n { manifest, vocabulary, entities, relationships },\n importOptions,\n );\n\n const elapsedMs = Date.now() - startTime;\n const elapsedSec = (elapsedMs / 1000).toFixed(1);\n\n this.logger.info(\n this.name,\n `Import ${result.success ? 'succeeded' : 'failed'}: ` +\n `${result.statistics.entitiesImported} entities, ` +\n `${result.statistics.relationshipsImported} relationships ` +\n `in ${elapsedSec}s`,\n );\n\n return {\n success: result.success,\n repositoryId: result.repositoryId,\n statistics: result.statistics,\n warnings: result.warnings,\n timing: {\n elapsedMs,\n elapsedFormatted: `${elapsedSec}s`,\n },\n };\n }\n}\n","import type { ILogger } from '../interfaces/ILogger.js';\nimport type { IMcpTool } from '../interfaces/IMcpTool.js';\nimport type { ToolContext } from '../tools/base/BaseToolController.js';\n\n// Repository tools\nimport { CreateRepositoryTool } from '../tools/repository/CreateRepositoryTool.js';\nimport { OpenRepositoryTool } from '../tools/repository/OpenRepositoryTool.js';\nimport { ListRepositoriesTool } from '../tools/repository/ListRepositoriesTool.js';\nimport { UpdateRepositoryTool } from '../tools/repository/UpdateRepositoryTool.js';\nimport { DeleteRepositoryTool } from '../tools/repository/DeleteRepositoryTool.js';\nimport { EnsureSchemaTool } from '../tools/repository/EnsureSchemaTool.js';\nimport { ValidateEntitiesTool } from '../tools/repository/ValidateEntitiesTool.js';\nimport { ValidateRelationshipsTool } from '../tools/repository/ValidateRelationshipsTool.js';\n\n// Entity tools\nimport { CreateEntitiesTool } from '../tools/entity/CreateEntitiesTool.js';\nimport { UpdateEntityTool } from '../tools/entity/UpdateEntityTool.js';\nimport { GetEntityTool } from '../tools/entity/GetEntityTool.js';\nimport { FindEntitiesTool } from '../tools/entity/FindEntitiesTool.js';\nimport { DeleteEntitiesTool } from '../tools/entity/DeleteEntitiesTool.js';\nimport { ReembedRepositoryTool } from '../tools/entity/ReembedRepositoryTool.js';\n\n// Relationship tools\nimport { CreateRelationshipsTool } from '../tools/relationship/CreateRelationshipsTool.js';\nimport { RemoveRelationshipsTool } from '../tools/relationship/RemoveRelationshipsTool.js';\nimport { GetRelationshipsTool } from '../tools/relationship/GetRelationshipsTool.js';\n\n// Graph traversal tools\nimport { ExploreNeighborhoodTool } from '../tools/graph/ExploreNeighborhoodTool.js';\nimport { FindPathsTool } from '../tools/graph/FindPathsTool.js';\nimport { GetGraphTool } from '../tools/graph/GetGraphTool.js';\nimport { QueryGraphTool } from '../tools/graph/QueryGraphTool.js';\n\n// Search tools\nimport { SearchByConceptTool } from '../tools/search/SearchByConceptTool.js';\n\n// Vocabulary tools\nimport { GetVocabularyTool } from '../tools/vocabulary/GetVocabularyTool.js';\nimport { ProposeVocabularyExtensionTool } from '../tools/vocabulary/ProposeVocabularyExtensionTool.js';\n\n// Stats tools\nimport { GetStatsTool } from '../tools/stats/GetStatsTool.js';\nimport { GetTimelineTool } from '../tools/stats/GetTimelineTool.js';\n\n// Portability tools\nimport { ExportRepositoryTool } from '../tools/portability/ExportRepositoryTool.js';\nimport { ImportRepositoryTool } from '../tools/portability/ImportRepositoryTool.js';\n\nexport interface ToolInfo {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n}\n\nexport class ToolRegistry {\n private tools: Map<string, IMcpTool> = new Map();\n\n constructor(\n private context: ToolContext,\n private logger: ILogger,\n ) {\n this.registerTools();\n }\n\n private registerTools(): void {\n // Repository lifecycle\n this.register(new CreateRepositoryTool(this.context, this.logger));\n this.register(new OpenRepositoryTool(this.context, this.logger));\n this.register(new ListRepositoriesTool(this.context, this.logger));\n this.register(new UpdateRepositoryTool(this.context, this.logger));\n this.register(new DeleteRepositoryTool(this.context, this.logger));\n this.register(new EnsureSchemaTool(this.context, this.logger));\n this.register(new ValidateEntitiesTool(this.context, this.logger));\n this.register(new ValidateRelationshipsTool(this.context, this.logger));\n\n // Entity operations\n this.register(new CreateEntitiesTool(this.context, this.logger));\n this.register(new UpdateEntityTool(this.context, this.logger));\n this.register(new GetEntityTool(this.context, this.logger));\n this.register(new FindEntitiesTool(this.context, this.logger));\n this.register(new DeleteEntitiesTool(this.context, this.logger));\n this.register(new ReembedRepositoryTool(this.context, this.logger));\n\n // Relationship operations\n this.register(new CreateRelationshipsTool(this.context, this.logger));\n this.register(new RemoveRelationshipsTool(this.context, this.logger));\n this.register(new GetRelationshipsTool(this.context, this.logger));\n\n // Graph traversal\n this.register(new ExploreNeighborhoodTool(this.context, this.logger));\n this.register(new FindPathsTool(this.context, this.logger));\n this.register(new GetGraphTool(this.context, this.logger));\n this.register(new QueryGraphTool(this.context, this.logger));\n\n // Search\n this.register(new SearchByConceptTool(this.context, this.logger));\n\n // Vocabulary\n this.register(new GetVocabularyTool(this.context, this.logger));\n this.register(new ProposeVocabularyExtensionTool(this.context, this.logger));\n\n // Stats & timeline\n this.register(new GetStatsTool(this.context, this.logger));\n this.register(new GetTimelineTool(this.context, this.logger));\n\n // Portability\n this.register(new ExportRepositoryTool(this.context, this.logger, this.context.exportDir));\n this.register(new ImportRepositoryTool(this.context, this.logger));\n\n this.logger.info('ToolRegistry', `Registered ${this.tools.size} tools`);\n }\n\n private register(tool: IMcpTool): void {\n if (this.tools.has(tool.name)) {\n this.logger.warn('ToolRegistry', `Tool ${tool.name} already registered, overwriting`);\n }\n this.tools.set(tool.name, tool);\n }\n\n listTools(): ToolInfo[] {\n return Array.from(this.tools.values()).map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n }));\n }\n\n async executeTool(name: string, params: Record<string, unknown>): Promise<unknown> {\n const tool = this.tools.get(name);\n if (!tool) {\n throw new Error(`Tool '${name}' not found`);\n }\n\n this.logger.debug('ToolRegistry', `Executing tool: ${name}`);\n\n try {\n const result = await tool.execute(params);\n this.logger.debug('ToolRegistry', `Tool ${name} completed`);\n return result;\n } catch (error) {\n this.logger.error('ToolRegistry', `Tool ${name} failed`, error);\n throw error;\n }\n }\n\n getToolCount(): number {\n return this.tools.size;\n }\n}\n","import type { ILogger } from '../interfaces/ILogger.js';\nimport type { ToolRegistry } from './ToolRegistry.js';\n\nexport class McpHandler {\n constructor(\n private toolRegistry: ToolRegistry,\n private logger: ILogger,\n ) {}\n\n async handleToolsList(): Promise<{ tools: Array<{ name: string; description: string; inputSchema: Record<string, unknown> }> }> {\n this.logger.debug('McpHandler', 'Received tools/list request');\n\n const tools = this.toolRegistry.listTools();\n this.logger.info('McpHandler', `Returning ${tools.length} tools`);\n\n return {\n tools: tools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n })),\n };\n }\n\n async handleToolCall(request: { params: { name: string; arguments?: Record<string, unknown> } }): Promise<{\n content: Array<{ type: string; text: string }>;\n isError?: boolean;\n }> {\n const { name, arguments: args } = request.params;\n\n this.logger.debug('McpHandler', `Received tool call: ${name}`);\n\n try {\n if (!name) {\n throw new Error('Tool name is required');\n }\n\n const result = await this.toolRegistry.executeTool(name, args ?? {});\n\n this.logger.info('McpHandler', `Tool ${name} executed successfully`);\n\n // Pre-formatted MCP response passthrough\n if (result && typeof result === 'object' && 'content' in (result as Record<string, unknown>) && Array.isArray((result as Record<string, unknown>)['content'])) {\n return result as { content: Array<{ type: string; text: string }> };\n }\n\n // String results\n if (typeof result === 'string') {\n return { content: [{ type: 'text', text: result }] };\n }\n\n // Objects/arrays as JSON\n return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n this.logger.error('McpHandler', `Tool ${name} failed: ${message}`);\n\n return {\n content: [{ type: 'text', text: `Error: ${message}` }],\n isError: true,\n };\n }\n }\n}\n","export interface ILogger {\n debug(context: string, message: string): void;\n info(context: string, message: string): void;\n warn(context: string, message: string): void;\n error(context: string, message: string, detail?: unknown): void;\n}\n\nexport class ConsoleLogger implements ILogger {\n debug(context: string, message: string): void {\n console.error(`[DEBUG] [${context}] ${message}`);\n }\n\n info(context: string, message: string): void {\n console.error(`[INFO] [${context}] ${message}`);\n }\n\n warn(context: string, message: string): void {\n console.error(`[WARN] [${context}] ${message}`);\n }\n\n error(context: string, message: string, detail?: unknown): void {\n console.error(`[ERROR] [${context}] ${message}`, detail ?? '');\n }\n}\n"],"mappings":";;;AAAA,SAAS,cAAc,kBAAkB;AACzC,SAAS,WAAAA,gBAAe;;;ACDxB,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,+BAA+B;AACxC,SAAS,gCAAgC;AACzC,SAAS,wBAAwB;;;ACZjC,SAAS,aAAa,2BAA2B;AAW1C,IAAe,qBAAf,MAAsD;AAAA,EAC3D,YACY,SACAC,SACV;AAFU;AACA,kBAAAA;AAAA,EACT;AAAA,EAFS;AAAA,EACA;AAAA,EAOZ,MAAM,QAAQ,QAAmD;AAC/D,QAAI;AACF,WAAK,eAAe,MAAM;AAC1B,aAAO,MAAM,KAAK,cAAc,MAAM;AAAA,IACxC,SAAS,OAAgB;AACvB,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,WAAK,OAAO,MAAM,KAAK,MAAM,qBAAqB,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AAAA,EAIU,eA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AAM;AAAA,IAClE,kBAAkB,QAAQ,IAAI,+BAA+B;AAAA,IAC7D,sBAAsB,QAAQ,IAAI,oCAAoC;AAAA,IACtE,aAAa,QAAQ,IAAI,0BAA0B;AAAA,IACnD,kBAAkB,QAAQ,IAAI,+BAA+B;AAAA,IAC7D,mBAAmB,QAAQ,IAAI,gCAAgC;AAAA,IAC/D,4BAA4B,QAAQ,IAAI,0CAA0C,MAAM;AAAA,IACxF,WAAW,QAAQ,IAAI,wBAAwB,KAAK;AAAA,EACtD;AAAA,EACA;AACF;AAGA,QAAQ,GAAG,UAAU,YAAY;AAC/B,QAAM,OAAO,KAAK;AAClB,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,QAAQ,GAAG,WAAW,YAAY;AAChC,QAAM,OAAO,KAAK;AAClB,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,OAAO,MAAM,EAAE,MAAM,CAAC,UAAU;AAC9B,SAAO,MAAM,QAAQ,8BAA8B,KAAK;AACxD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["resolve","logger","logger","logger","logger","logger","resolve"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/server/McpServer.ts","../src/tools/base/BaseToolController.ts","../src/tools/repository/CreateRepositoryTool.ts","../src/tools/repository/OpenRepositoryTool.ts","../src/tools/repository/ListRepositoriesTool.ts","../src/tools/repository/UpdateRepositoryTool.ts","../src/tools/repository/DeleteRepositoryTool.ts","../src/tools/repository/EnsureSchemaTool.ts","../src/tools/repository/ValidateEntitiesTool.ts","../src/tools/repository/ValidateRelationshipsTool.ts","../src/tools/entity/CreateEntitiesTool.ts","../src/tools/entity/UpdateEntityTool.ts","../src/tools/base/stripProvenance.ts","../src/tools/entity/GetEntityTool.ts","../src/tools/base/provenanceHelper.ts","../src/tools/entity/FindEntitiesTool.ts","../src/tools/entity/DeleteEntitiesTool.ts","../src/tools/entity/ReembedRepositoryTool.ts","../src/tools/relationship/CreateRelationshipsTool.ts","../src/tools/relationship/RemoveRelationshipsTool.ts","../src/tools/relationship/GetRelationshipsTool.ts","../src/tools/graph/ExploreNeighborhoodTool.ts","../src/tools/graph/FindPathsTool.ts","../src/tools/graph/GetGraphTool.ts","../src/tools/graph/QueryGraphTool.ts","../src/tools/search/SearchByConceptTool.ts","../src/tools/vocabulary/GetVocabularyTool.ts","../src/tools/vocabulary/ProposeVocabularyExtensionTool.ts","../src/tools/stats/GetStatsTool.ts","../src/tools/stats/GetTimelineTool.ts","../src/tools/portability/ExportRepositoryTool.ts","../src/tools/portability/zip.ts","../src/tools/portability/ImportRepositoryTool.ts","../src/server/ToolRegistry.ts","../src/server/McpHandler.ts","../src/interfaces/ILogger.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { McpServer } from './server/McpServer.js';\nimport { ConsoleLogger } from './interfaces/ILogger.js';\n\n// Load .env.local from the current working directory (workspace root when launched by an MCP host).\n// Values already present in process.env take precedence, so shell overrides still win.\nfunction loadEnvFile(path: string): void {\n if (!existsSync(path)) return;\n const content = readFileSync(path, 'utf8');\n for (const raw of content.split(/\\r?\\n/)) {\n let line = raw.trim();\n if (!line || line.startsWith('#')) continue;\n if (line.startsWith('export ')) line = line.slice('export '.length).trim();\n const eq = line.indexOf('=');\n if (eq === -1) continue;\n const key = line.slice(0, eq).trim();\n let value = line.slice(eq + 1).trim();\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n if (!(key in process.env)) {\n process.env[key] = value;\n }\n }\n}\nloadEnvFile(resolve(process.cwd(), '.env.local'));\n\nconst logger = new ConsoleLogger();\n\nconst storageSetting = process.env['DEEP_MEMORY_STORAGE'];\nconst storageType = storageSetting === 'sqlserver' ? 'sqlserver' as const\n : storageSetting === 'cosmosdb' ? 'cosmosdb' as const\n : 'memory' as const;\n\nconst server = new McpServer(\n {\n actorId: process.env['DEEP_MEMORY_ACTOR_ID'] ?? 'mcp-agent',\n actorType: process.env['DEEP_MEMORY_ACTOR_TYPE'] ?? 'agent',\n embeddingsBaseUrl: process.env['DEEP_MEMORY_EMBEDDINGS_BASE_URL'],\n embeddingsModel: process.env['DEEP_MEMORY_EMBEDDINGS_MODEL'],\n embeddingsDimensions: process.env['DEEP_MEMORY_EMBEDDINGS_DIMENSIONS']\n ? Number(process.env['DEEP_MEMORY_EMBEDDINGS_DIMENSIONS'])\n : undefined,\n embeddingsApiKey: process.env['DEEP_MEMORY_EMBEDDINGS_API_KEY'],\n storageType,\n sqlServerHost: process.env['DEEP_MEMORY_SQL_HOST'],\n sqlServerPort: process.env['DEEP_MEMORY_SQL_PORT'] ? Number(process.env['DEEP_MEMORY_SQL_PORT']) : undefined,\n sqlServerDatabase: process.env['DEEP_MEMORY_SQL_DATABASE'],\n sqlServerUser: process.env['DEEP_MEMORY_SQL_USER'],\n sqlServerPassword: process.env['DEEP_MEMORY_SQL_PASSWORD'],\n sqlServerSchema: process.env['DEEP_MEMORY_SQL_SCHEMA'],\n sqlServerTrustCert: process.env['DEEP_MEMORY_SQL_TRUST_CERT'] === 'true',\n cosmosDbEndpoint: process.env['DEEP_MEMORY_COSMOSDB_ENDPOINT'],\n cosmosDbRestEndpoint: process.env['DEEP_MEMORY_COSMOSDB_REST_ENDPOINT'],\n cosmosDbKey: process.env['DEEP_MEMORY_COSMOSDB_KEY'],\n cosmosDbDatabase: process.env['DEEP_MEMORY_COSMOSDB_DATABASE'],\n cosmosDbContainer: process.env['DEEP_MEMORY_COSMOSDB_CONTAINER'],\n cosmosDbRejectUnauthorized: process.env['DEEP_MEMORY_COSMOSDB_REJECT_UNAUTHORIZED'] !== 'false',\n exportDir: process.env['DEEP_MEMORY_EXPORT_DIR'] ?? './exports',\n },\n logger,\n);\n\n// Graceful shutdown\nprocess.on('SIGINT', async () => {\n await server.stop();\n process.exit(0);\n});\n\nprocess.on('SIGTERM', async () => {\n await server.stop();\n process.exit(0);\n});\n\nserver.start().catch((error) => {\n logger.error('main', 'Failed to start MCP server', error);\n process.exit(1);\n});\n","import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport {\n DeepMemory,\n InMemoryStorageProvider,\n InMemorySearchProvider,\n type MemoryRepository,\n type StorageProvider,\n type GraphTraversalProvider,\n} from '@utaba/deep-memory';\nimport { OpenAIEmbeddingProvider } from '@utaba/deep-memory-embeddings-openai';\nimport { SqlServerStorageProvider } from '@utaba/deep-memory-storage-sqlserver';\nimport { CosmosDbProvider } from '@utaba/deep-memory-storage-cosmosdb';\nimport type { ILogger } from '../interfaces/ILogger.js';\nimport { ToolRegistry } from './ToolRegistry.js';\nimport { McpHandler } from './McpHandler.js';\nimport type { ToolContext } from '../tools/base/BaseToolController.js';\n\nexport interface McpServerConfig {\n /** Actor ID for provenance tracking (default: 'mcp-agent') */\n actorId?: string;\n /** Actor type for provenance (default: 'agent') */\n actorType?: string;\n /** Embeddings API base URL (e.g. 'http://localhost:8010'). Enables semantic search when set. */\n embeddingsBaseUrl?: string;\n /** Default embeddings model for newly created repositories. Each repo stores its own model in metadata. */\n embeddingsModel?: string;\n /** Default embeddings dimensionality for newly created repositories. Each repo stores its own dimensions in metadata. */\n embeddingsDimensions?: number;\n /** Embeddings API key (optional, not needed for local servers) */\n embeddingsApiKey?: string;\n /** Storage type: 'memory' (default), 'sqlserver', or 'cosmosdb' */\n storageType?: 'memory' | 'sqlserver' | 'cosmosdb';\n /** SQL Server host (required when storageType is 'sqlserver') */\n sqlServerHost?: string;\n /** SQL Server port (default: 1433) */\n sqlServerPort?: number;\n /** SQL Server database name */\n sqlServerDatabase?: string;\n /** SQL Server username */\n sqlServerUser?: string;\n /** SQL Server password */\n sqlServerPassword?: string;\n /** SQL Server schema (default: 'dbo') */\n sqlServerSchema?: string;\n /** Trust server certificate for SQL Server (default: false) */\n sqlServerTrustCert?: boolean;\n /** CosmosDB Gremlin WebSocket endpoint (required when storageType is 'cosmosdb') */\n cosmosDbEndpoint?: string;\n /** CosmosDB REST endpoint — derived from Gremlin endpoint if omitted */\n cosmosDbRestEndpoint?: string;\n /** CosmosDB primary key */\n cosmosDbKey?: string;\n /** CosmosDB database name */\n cosmosDbDatabase?: string;\n /** CosmosDB container (graph) name */\n cosmosDbContainer?: string;\n /** Reject unauthorized TLS certs — set false for emulator (default: true) */\n cosmosDbRejectUnauthorized?: boolean;\n /** Directory where exported zip files are written (default: './exports') */\n exportDir?: string;\n}\n\nexport class McpServer {\n private server: Server;\n private handler: McpHandler;\n private deepMemory: DeepMemory;\n private repositories: Map<string, MemoryRepository> = new Map();\n\n constructor(\n config: McpServerConfig,\n private logger: ILogger,\n ) {\n let storage: StorageProvider;\n let graphTraversal: GraphTraversalProvider | undefined;\n if (config.storageType === 'sqlserver') {\n storage = new SqlServerStorageProvider({\n connection: {\n server: config.sqlServerHost!,\n port: config.sqlServerPort ?? 1433,\n database: config.sqlServerDatabase!,\n user: config.sqlServerUser,\n password: config.sqlServerPassword,\n options: {\n encrypt: false,\n trustServerCertificate: config.sqlServerTrustCert ?? false,\n },\n },\n schema: config.sqlServerSchema ?? 'dbo',\n });\n } else if (config.storageType === 'cosmosdb') {\n const cosmos = new CosmosDbProvider({\n endpoint: config.cosmosDbEndpoint!,\n restEndpoint: config.cosmosDbRestEndpoint,\n key: config.cosmosDbKey!,\n database: config.cosmosDbDatabase!,\n container: config.cosmosDbContainer!,\n rejectUnauthorized: config.cosmosDbRejectUnauthorized ?? true,\n });\n storage = cosmos;\n graphTraversal = cosmos;\n } else {\n storage = new InMemoryStorageProvider();\n }\n\n const search = config.storageType === 'memory' || !config.storageType ? new InMemorySearchProvider() : undefined;\n\n // Build a factory — model + dimensions come from the repository's stored metadata\n // at open time, so repositories with different embedding configurations can coexist\n // against the same embeddings endpoint.\n const embeddingFactory = config.embeddingsBaseUrl\n ? ({ model, dimensions }: { model: string; dimensions: number }) =>\n new OpenAIEmbeddingProvider({\n baseUrl: config.embeddingsBaseUrl!,\n model,\n dimensions,\n apiKey: config.embeddingsApiKey,\n })\n : undefined;\n\n this.deepMemory = new DeepMemory({\n storage,\n search,\n embeddingFactory,\n defaultEmbeddingModel: config.embeddingsModel,\n defaultEmbeddingDimensions: config.embeddingsDimensions,\n graphTraversal,\n provenance: {\n actorId: config.actorId ?? 'mcp-agent',\n actorType: (config.actorType ?? 'agent') as 'agent' | 'user',\n },\n });\n\n const toolContext: ToolContext = {\n deepMemory: this.deepMemory,\n storage,\n getRepository: this.getRepository.bind(this),\n evictRepository: this.evictRepository.bind(this),\n exportDir: config.exportDir ?? './exports',\n };\n\n const toolRegistry = new ToolRegistry(toolContext, this.logger);\n this.handler = new McpHandler(toolRegistry, this.logger);\n\n this.server = new Server(\n {\n name: '@utaba/deep-memory-local-mcp-server',\n version: '0.1.0',\n },\n {\n capabilities: {\n tools: {},\n },\n },\n );\n\n this.setupHandlers();\n }\n\n private setupHandlers(): void {\n this.server.setRequestHandler(ListToolsRequestSchema, this.handler.handleToolsList.bind(this.handler));\n this.server.setRequestHandler(CallToolRequestSchema, this.handler.handleToolCall.bind(this.handler));\n }\n\n private async getRepository(repositoryId: string): Promise<MemoryRepository> {\n let repo = this.repositories.get(repositoryId);\n if (!repo) {\n repo = await this.deepMemory.openRepository(repositoryId);\n this.repositories.set(repositoryId, repo);\n }\n return repo;\n }\n\n private evictRepository(repositoryId: string): void {\n this.repositories.delete(repositoryId);\n }\n\n async start(): Promise<void> {\n const transport = new StdioServerTransport();\n await this.server.connect(transport);\n this.logger.info('McpServer', 'Deep Memory MCP server started on stdio');\n // Schema check is best-effort and must not block the transport handshake.\n // Tools that need storage will fail individually with a clear error at call time.\n this.deepMemory.ensureSchema().catch((error: unknown) => {\n this.logger.warn('McpServer', `Storage unavailable on startup — repository tools will fail until storage is reachable: ${error instanceof Error ? error.message : String(error)}`);\n });\n }\n\n async stop(): Promise<void> {\n this.repositories.clear();\n await this.deepMemory.dispose();\n await this.server.close();\n this.logger.info('McpServer', 'Deep Memory MCP server stopped');\n }\n}\n","import type { IMcpTool } from '../../interfaces/IMcpTool.js';\nimport type { ILogger } from '../../interfaces/ILogger.js';\nimport type { DeepMemory, MemoryRepository } from '@utaba/deep-memory';\nimport type { StorageProvider } from '@utaba/deep-memory/providers';\nimport { isValidUuid, EntityNotFoundError } from '@utaba/deep-memory';\n\nexport interface ToolContext {\n deepMemory: DeepMemory;\n storage: StorageProvider;\n getRepository: (repositoryId: string) => Promise<MemoryRepository>;\n evictRepository: (repositoryId: string) => void;\n /** Absolute or relative path where export zip files are written */\n exportDir: string;\n}\n\nexport abstract class BaseToolController implements IMcpTool {\n constructor(\n protected context: ToolContext,\n protected logger: ILogger,\n ) {}\n\n abstract get name(): string;\n abstract get description(): string;\n abstract get inputSchema(): Record<string, unknown>;\n\n async execute(params: Record<string, unknown>): Promise<unknown> {\n try {\n this.validateParams(params);\n return await this.handleExecute(params);\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n this.logger.error(this.name, `Execution failed: ${message}`);\n throw error;\n }\n }\n\n protected abstract handleExecute(params: Record<string, unknown>): Promise<unknown>;\n\n protected validateParams(params: Record<string, unknown>): void {\n const schema = this.inputSchema;\n const required = schema['required'] as string[] | undefined;\n if (required) {\n for (const field of required) {\n if (params[field] === undefined || params[field] === null) {\n throw new Error(`Required parameter '${field}' is missing`);\n }\n }\n }\n }\n\n /**\n * Resolve an entity identifier that may be either a GUID or a slug.\n * Returns the GUID.\n */\n protected async resolveEntityId(repo: MemoryRepository, entityIdOrSlug: string): Promise<string> {\n if (isValidUuid(entityIdOrSlug)) {\n return entityIdOrSlug;\n }\n // Treat as slug — resolve to GUID\n const entity = await repo.getBySlug(entityIdOrSlug);\n if (!entity) {\n throw new EntityNotFoundError(entityIdOrSlug);\n }\n return entity.id;\n }\n}\n","import type { VocabularyInput, GovernanceMode } from '@utaba/deep-memory';\nimport { BaseToolController } from '../base/BaseToolController.js';\n\nexport class CreateRepositoryTool extends BaseToolController {\n get name() { return 'memory_create_repository'; }\n get description() { return 'Create a new memory repository with an optional vocabulary definition and governance mode'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Unique identifier for the repository' },\n label: { type: 'string', description: 'Human-readable name' },\n description: { type: 'string', description: 'Purpose of this repository' },\n type: { type: 'string', description: 'Repository type (optional classifier)' },\n legal: { type: 'string', description: 'Legal or compliance notes for this repository' },\n owner: { type: 'string', description: 'Owner of the repository (person, team, or org)' },\n governanceMode: { type: 'string', enum: ['locked', 'managed', 'open'], description: 'Vocabulary governance mode (default: open)' },\n defaultSimilarityThreshold: { type: 'number', description: 'Default similarity threshold for semantic search (0.0-1.0, default: 0.5). Lower for local embedding models, higher for OpenAI.' },\n metadata: {\n type: 'object',\n description: 'Extensible metadata object. Embedding model info (embeddingModelId, embeddingDimensions) is auto-detected from the configured provider if omitted.',\n },\n vocabulary: {\n type: 'object',\n description: 'Initial vocabulary with entityTypes and relationshipTypes arrays',\n properties: {\n entityTypes: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: { type: 'string' },\n description: { type: 'string' },\n properties: { type: 'array', items: { type: 'object' } },\n },\n required: ['type', 'description'],\n },\n },\n relationshipTypes: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: { type: 'string' },\n description: { type: 'string' },\n allowedSourceTypes: { type: 'array', items: { type: 'string' } },\n allowedTargetTypes: { type: 'array', items: { type: 'string' } },\n bidirectional: { type: 'boolean' },\n properties: { type: 'array', items: { type: 'object' } },\n },\n required: ['type', 'description', 'allowedSourceTypes', 'allowedTargetTypes'],\n },\n },\n },\n },\n },\n required: ['repositoryId', 'label'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const mode = (params['governanceMode'] as GovernanceMode | undefined) ?? 'open';\n const repo = await this.context.deepMemory.createRepository({\n repositoryId: params['repositoryId'] as string,\n label: params['label'] as string,\n description: params['description'] as string | undefined,\n type: params['type'] as string | undefined,\n legal: params['legal'] as string | undefined,\n owner: params['owner'] as string | undefined,\n vocabulary: params['vocabulary'] as VocabularyInput | undefined,\n governance: {\n mode,\n defaultSimilarityThreshold: params['defaultSimilarityThreshold'] as number | undefined,\n },\n metadata: params['metadata'] as import('@utaba/deep-memory').RepositoryMetadata | undefined,\n });\n return { repositoryId: repo.repositoryId, message: `Repository '${params['label']}' created` };\n }\n}\n","import type { ResolvedVocabulary } from '@utaba/deep-memory';\nimport { BaseToolController } from '../base/BaseToolController.js';\n\nexport class OpenRepositoryTool extends BaseToolController {\n get name() { return 'memory_open_repository'; }\n get description() { return 'Open a memory repository by ID or label. Call this first before any entity, relationship, or graph operations. Returns vocabulary and stats.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'ID of the repository to open' },\n label: { type: 'string', description: 'Repository label — use as alternative to repositoryId' },\n },\n required: [],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string | undefined;\n const label = params['label'] as string | undefined;\n\n if (!repositoryId && !label) {\n throw new Error('Provide either repositoryId or label');\n }\n\n let resolvedId: string;\n\n if (repositoryId) {\n resolvedId = repositoryId;\n } else {\n // Look up by label\n const allRepos = await this.context.deepMemory.listRepositories();\n const matches = allRepos.items.filter(\n (r) => r.label.toLowerCase() === label!.toLowerCase(),\n );\n\n if (matches.length === 0) {\n throw new Error(`No repository found with label '${label}'`);\n }\n if (matches.length > 1) {\n return {\n error: 'ambiguous_label',\n message: `Multiple repositories match label '${label}'. Provide a repositoryId.`,\n candidates: matches.map((r) => ({ repositoryId: r.repositoryId, label: r.label })),\n };\n }\n resolvedId = matches[0]!.repositoryId;\n }\n\n const repo = await this.context.getRepository(resolvedId);\n const [vocabulary, stats] = await Promise.all([\n repo.getVocabulary(),\n repo.getStats(),\n ]);\n\n return {\n repositoryId: repo.repositoryId,\n message: `Repository '${resolvedId}' opened`,\n vocabulary: OpenRepositoryTool.stripAuditFields(vocabulary),\n stats,\n agentInstructions: repo.getQueryGuide(),\n };\n }\n\n /** Strip audit/versioning fields from vocabulary to reduce response size for AI consumers */\n private static stripAuditFields(resolved: ResolvedVocabulary) {\n const { vocabulary, governanceMode, governanceConfig } = resolved;\n\n return {\n governanceMode,\n governanceConfig,\n entityTypes: vocabulary.entityTypes.map(({ type, description, properties }) => ({\n type,\n description,\n properties,\n })),\n relationshipTypes: vocabulary.relationshipTypes.map(({ type, description, allowedSourceTypes, allowedTargetTypes, bidirectional, properties }) => ({\n type,\n description,\n allowedSourceTypes,\n allowedTargetTypes,\n bidirectional,\n ...(properties?.length ? { properties } : {}),\n })),\n };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ListRepositoriesTool extends BaseToolController {\n get name() { return 'memory_list_repositories'; }\n get description() { return 'List all available memory repositories'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n type: { type: 'string', description: 'Filter by repository type' },\n limit: { type: 'number', description: 'Max results (default 20)' },\n offset: { type: 'number', description: 'Pagination offset (default 0)' },\n },\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const filter: Record<string, unknown> = {};\n if (params['type']) filter['type'] = params['type'] as string;\n filter['limit'] = (params['limit'] as number | undefined) ?? 20;\n filter['offset'] = (params['offset'] as number | undefined) ?? 0;\n return this.context.deepMemory.listRepositories(filter as Parameters<typeof this.context.deepMemory.listRepositories>[0]);\n }\n}\n","import type { GovernanceMode } from '@utaba/deep-memory';\nimport { BaseToolController } from '../base/BaseToolController.js';\n\nexport class UpdateRepositoryTool extends BaseToolController {\n get name() { return 'memory_update_repository'; }\n get description() { return 'Update repository metadata and settings — label, description, governance mode, similarity threshold, etc.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to update' },\n label: { type: 'string', description: 'New label' },\n description: { type: 'string', description: 'New description' },\n type: { type: 'string', description: 'New repository type' },\n owner: { type: 'string', description: 'New owner' },\n governanceMode: { type: 'string', enum: ['locked', 'managed', 'open'], description: 'New governance mode' },\n defaultSimilarityThreshold: { type: 'number', description: 'Default similarity threshold for semantic search (0.0-1.0). Model-dependent — lower for local models, higher for OpenAI.' },\n requireApproval: { type: 'boolean', description: 'Managed mode: if true, all vocabulary proposals queue for human approval' },\n deduplicationEnabled: { type: 'boolean', description: 'Open mode: whether vocabulary deduplication is enforced (default true)' },\n autoApproveThreshold: { type: 'number', description: 'Managed mode: similarity score below which vocabulary proposals auto-approve (default 0.3)' },\n metadata: { type: 'object', description: 'Metadata updates (shallow-merged with existing). E.g. { \"embeddingModelId\": \"...\", \"embeddingDimensions\": 4096 }' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n\n // Build governance config update if any governance fields provided\n const governanceMode = params['governanceMode'] as GovernanceMode | undefined;\n const defaultSimilarityThreshold = params['defaultSimilarityThreshold'] as number | undefined;\n const requireApproval = params['requireApproval'] as boolean | undefined;\n const deduplicationEnabled = params['deduplicationEnabled'] as boolean | undefined;\n const autoApproveThreshold = params['autoApproveThreshold'] as number | undefined;\n\n const hasGovernanceUpdate = governanceMode !== undefined\n || defaultSimilarityThreshold !== undefined\n || requireApproval !== undefined\n || deduplicationEnabled !== undefined\n || autoApproveThreshold !== undefined;\n\n let governanceConfig: Record<string, unknown> | undefined;\n if (hasGovernanceUpdate) {\n // Fetch current governance to merge with\n const repo = await this.context.getRepository(repositoryId);\n const current = (await repo.getVocabulary()).governanceConfig;\n governanceConfig = {\n ...current,\n ...(governanceMode !== undefined ? { mode: governanceMode } : {}),\n ...(defaultSimilarityThreshold !== undefined ? { defaultSimilarityThreshold } : {}),\n ...(requireApproval !== undefined ? { requireApproval } : {}),\n ...(deduplicationEnabled !== undefined ? { deduplicationEnabled } : {}),\n ...(autoApproveThreshold !== undefined ? { autoApproveThreshold } : {}),\n };\n }\n\n const updated = await this.context.deepMemory.updateRepository(repositoryId, {\n label: params['label'] as string | undefined,\n description: params['description'] as string | undefined,\n type: params['type'] as string | undefined,\n owner: params['owner'] as string | undefined,\n governanceConfig: governanceConfig as import('@utaba/deep-memory').GovernanceConfig | undefined,\n metadata: params['metadata'] as import('@utaba/deep-memory').RepositoryMetadata | undefined,\n });\n\n // Evict cached repository so it reloads with new settings\n this.context.evictRepository(repositoryId);\n\n return { repositoryId: updated.repositoryId, message: `Repository '${updated.label}' updated` };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class DeleteRepositoryTool extends BaseToolController {\n get name() { return 'memory_delete_repository'; }\n get description() { return 'Delete a memory repository and all its data permanently. Use deleteContentsOnly to remove all entities and relationships while keeping the repository and vocabulary intact.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'ID of the repository to delete' },\n deleteContentsOnly: { type: 'boolean', description: 'When true, only delete entities and relationships — the repository and vocabulary are preserved. Defaults to false.' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const deleteContentsOnly = params['deleteContentsOnly'] === true;\n\n if (deleteContentsOnly) {\n const result = await this.context.deepMemory.deleteAllContents(repositoryId);\n this.context.evictRepository(repositoryId);\n return {\n message: `Repository '${repositoryId}' contents deleted (${result.deletedEntities} entities, ${result.deletedRelationships} relationships removed). Repository and vocabulary preserved.`,\n deletedEntities: result.deletedEntities,\n deletedRelationships: result.deletedRelationships,\n };\n }\n\n await this.context.deepMemory.deleteRepository(repositoryId);\n this.context.evictRepository(repositoryId);\n return { message: `Repository '${repositoryId}' deleted` };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class EnsureSchemaTool extends BaseToolController {\n get name() { return 'memory_ensure_schema'; }\n get description() { return 'Ensure the storage provider schema exists (creates tables/indexes if needed). Idempotent — safe to call multiple times. Only relevant for persistent storage providers (e.g., SQL Server); no-op for in-memory storage.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {},\n };\n }\n\n protected async handleExecute(_params: Record<string, unknown>) {\n const result = await this.context.deepMemory.ensureSchema();\n return { success: true, ...result };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ValidateEntitiesTool extends BaseToolController {\n get name() { return 'memory_validate_entities'; }\n get description() {\n return 'Audit entities in the repository against the current vocabulary. Paging is issue-based: `take` caps how many issues are returned, `offset` skips that many issues. Typical workflow: call with offset=0, fix the returned issues, call again with offset=0. `offset` is only for inspecting a later slice without mutating. Loop until `done` is true. Returns issues fixable with memory_update_entity. Use memory_validate_relationships for relationships.';\n }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to validate' },\n offset: { type: 'number', description: 'Number of issues to skip before returning (default 0). The normal fix-and-retry workflow always uses 0; pass nextOffset only to inspect a later slice without fixing.' },\n take: { type: 'number', description: 'Maximum issues to return in this call (default 200)' },\n delayBetweenChunksMs: { type: 'number', description: 'Pause between export chunks for manual rate limiting (default 0)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.validateEntities({\n offset: params['offset'] as number | undefined,\n take: params['take'] as number | undefined,\n delayBetweenChunksMs: params['delayBetweenChunksMs'] as number | undefined,\n });\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ValidateRelationshipsTool extends BaseToolController {\n get name() { return 'memory_validate_relationships'; }\n get description() {\n return 'Audit relationships in the repository against the current vocabulary. Paging is issue-based: `take` caps how many issues are returned, `offset` skips that many issues. Typical workflow: call with offset=0, fix the returned issues, call again with offset=0. `offset` is only for inspecting a later slice without mutating. Loop until `done` is true. The full entity set is loaded once per call to resolve orphan and type-mismatch checks. Returns issues fixable with memory_remove_relationships / memory_create_relationships.';\n }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to validate' },\n offset: { type: 'number', description: 'Number of issues to skip before returning (default 0). The normal fix-and-retry workflow always uses 0; pass nextOffset only to inspect a later slice without fixing.' },\n take: { type: 'number', description: 'Maximum issues to return in this call (default 200)' },\n delayBetweenChunksMs: { type: 'number', description: 'Pause between export chunks for manual rate limiting (default 0)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.validateRelationships({\n offset: params['offset'] as number | undefined,\n take: params['take'] as number | undefined,\n delayBetweenChunksMs: params['delayBetweenChunksMs'] as number | undefined,\n });\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\ninterface EntityInput {\n entityType: string;\n label: string;\n summary?: string;\n properties?: Record<string, unknown>;\n data?: string;\n dataFormat?: string;\n}\n\nexport class CreateEntitiesTool extends BaseToolController {\n get name() { return 'memory_create_entities'; }\n get description() { return 'Create one or more entities (nodes) in a repository. Entity types and properties must match the repository vocabulary — call memory_open_repository first to see valid types.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to create the entities in' },\n entities: {\n type: 'array',\n description: 'Array of entities to create',\n items: {\n type: 'object',\n properties: {\n entityType: { type: 'string', description: 'Entity type (must exist in vocabulary)' },\n label: { type: 'string', description: 'Human-readable label' },\n summary: { type: 'string', description: 'Brief description of the entity' },\n properties: { type: 'object', description: 'Typed properties per vocabulary schema' },\n data: { type: 'string', description: 'Raw content/data for the entity' },\n dataFormat: { type: 'string', description: 'Format of the data field (e.g. text/plain, text/markdown)' },\n },\n required: ['entityType', 'label'],\n },\n minItems: 1,\n },\n },\n required: ['repositoryId', 'entities'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const entities = params['entities'] as EntityInput[];\n return repo.createEntities(entities.map((e) => ({\n entityType: e.entityType,\n label: e.label,\n summary: e.summary,\n properties: e.properties,\n data: e.data,\n dataFormat: e.dataFormat,\n })));\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class UpdateEntityTool extends BaseToolController {\n get name() { return 'memory_update_entity'; }\n get description() { return 'Update an existing entity — entityType, label, summary, properties, or data. Accepts entity ID (GUID) or slug. Changing entityType must be valid in the vocabulary and regenerates the slug with the new type prefix. To clear an optional field, pass null: summary/data/dataFormat set to null are cleared, and property values set to null are removed from the entity (RFC 7396 JSON Merge Patch). Omitting a field leaves it unchanged.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Entity ID (GUID) or slug' },\n entityType: { type: 'string', description: 'New entity type — must exist in the vocabulary. Regenerates the slug and re-validates properties against the new type.' },\n label: { type: 'string', description: 'New label' },\n summary: { type: ['string', 'null'], description: 'New summary. Pass null to clear the existing summary.' },\n properties: { type: 'object', description: 'Properties to merge with existing. Property values set to null are removed from the entity (RFC 7396 JSON Merge Patch semantics).' },\n data: { type: ['string', 'null'], description: 'New raw content/data. Pass null to clear.' },\n dataFormat: { type: ['string', 'null'], description: 'Format of the data field. Pass null to clear.' },\n reembed: { type: 'boolean', description: 'Force regeneration of the embedding vector (e.g. after switching embedding models)' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n // `null` is meaningful for summary/data/dataFormat (clear sentinel). Preserve it;\n // only drop fields that were omitted (undefined).\n const updates: Record<string, unknown> = {};\n if (params['entityType'] !== undefined) updates['entityType'] = params['entityType'];\n if (params['label'] !== undefined) updates['label'] = params['label'];\n if (params['summary'] !== undefined) updates['summary'] = params['summary'];\n if (params['properties'] !== undefined) updates['properties'] = params['properties'];\n if (params['data'] !== undefined) updates['data'] = params['data'];\n if (params['dataFormat'] !== undefined) updates['dataFormat'] = params['dataFormat'];\n if (params['reembed'] !== undefined) updates['reembed'] = params['reembed'];\n return repo.updateEntity(resolvedId, updates as Parameters<typeof repo.updateEntity>[1]);\n }\n}\n","/** Strip provenance field from an entity or relationship object */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function stripProvenance<T>(obj: T): Omit<T & { provenance?: unknown }, 'provenance'> {\n const { provenance, ...rest } = obj as any;\n return rest;\n}\n\n/** Strip provenance from an array of objects */\nexport function stripProvenanceArray<T>(items: T[]): Omit<T & { provenance?: unknown }, 'provenance'>[] {\n return items.map(stripProvenance);\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { stripProvenance } from '../base/stripProvenance.js';\nimport type { DetailLevel } from '@utaba/deep-memory';\n\nexport class GetEntityTool extends BaseToolController {\n get name() { return 'memory_get_entity'; }\n get description() { return 'Retrieve a single entity by ID (GUID) or slug with configurable detail level (brief, summary, or full)'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Entity ID (GUID) or slug (e.g. \"person:john-smith\")' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Level of detail (default: full)' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n const detailLevel = (params['detailLevel'] as DetailLevel) ?? 'full';\n const entity = await repo.getEntity(resolvedId, detailLevel);\n if (!entity) {\n throw new Error(`Entity '${params['entityId'] as string}' not found`);\n }\n\n return detailLevel === 'full' ? stripProvenance(entity) : entity;\n }\n}\n","import type { ProvenanceFilter } from '@utaba/deep-memory';\n\n/** Build a ProvenanceFilter from MCP tool params (conversationId, actor, dateRange) */\nexport function buildProvenanceFilter(params: Record<string, unknown>): ProvenanceFilter | undefined {\n const conversationId = params['conversationId'] as string | undefined;\n const actor = params['actor'] as string | undefined;\n const dateRange = params['dateRange'] as { from: string; to: string } | undefined;\n\n if (!conversationId && !actor && !dateRange) return undefined;\n\n return {\n conversationIds: conversationId ? [conversationId] : undefined,\n actors: actor ? [actor] : undefined,\n dateRange,\n };\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { buildProvenanceFilter } from '../base/provenanceHelper.js';\nimport { stripProvenanceArray } from '../base/stripProvenance.js';\n\nexport class FindEntitiesTool extends BaseToolController {\n get name() { return 'memory_find_entities'; }\n get description() { return 'Search for entities by label, type, or properties with pagination. Requires a repository to be opened first via memory_open_repository.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to search in' },\n searchTerm: { type: 'string', description: 'Search term to match against entity labels' },\n entityType: { type: 'string', description: 'Filter by a single entity type (convenience alias for entityTypes)' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by entity type(s)' },\n properties: { type: 'object', description: 'Filter by property values' },\n limit: { type: 'number', description: 'Max results (default 10, max 50)' },\n offset: { type: 'number', description: 'Pagination offset' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: summary)' },\n conversationId: { type: 'string', description: 'Filter to entities from this conversation' },\n actor: { type: 'string', description: 'Filter to entities created/modified by this actor' },\n dateRange: { type: 'object', properties: { from: { type: 'string' }, to: { type: 'string' } }, description: 'Filter by date range (ISO 8601)' },\n includeRelationshipSummary: { type: 'boolean', description: 'Attach a relationship count summary (out/in by type) to each entity (default false)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n // Support both singular entityType and plural entityTypes\n let entityTypes = params['entityTypes'] as string[] | undefined;\n if (!entityTypes && params['entityType']) {\n entityTypes = [params['entityType'] as string];\n }\n\n let result = await repo.findEntities({\n searchTerm: params['searchTerm'] as string | undefined,\n entityTypes,\n properties: params['properties'] as Record<string, unknown> | undefined,\n limit: params['limit'] as number | undefined,\n offset: params['offset'] as number | undefined,\n detailLevel: params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined,\n provenance: buildProvenanceFilter(params),\n });\n\n if ((params['detailLevel'] as string) === 'full') {\n result = { ...result, items: stripProvenanceArray(result.items) };\n }\n\n if (!params['includeRelationshipSummary']) {\n return result;\n }\n\n const itemsWithSummary = await Promise.all(\n result.items.map(async (entity) => {\n const relationshipSummary = await repo.getRelationshipSummary(entity.id);\n return { ...entity, relationshipSummary };\n }),\n );\n\n return { ...result, items: itemsWithSummary };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class DeleteEntitiesTool extends BaseToolController {\n get name() { return 'memory_delete_entities'; }\n get description() { return 'Delete one or more entities and their associated relationships from the knowledge graph in a single batch operation. Accepts entity IDs (GUIDs) or slugs.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entities' },\n entityIds: {\n type: 'array',\n description: 'Entity IDs (GUIDs or slugs) to delete',\n items: { type: 'string' },\n minItems: 1,\n },\n },\n required: ['repositoryId', 'entityIds'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const rawIds = params['entityIds'] as string[];\n const resolvedIds = await Promise.all(rawIds.map((id) => this.resolveEntityId(repo, id)));\n return repo.deleteEntities(resolvedIds);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ReembedRepositoryTool extends BaseToolController {\n get name() { return 'memory_reembed_repository'; }\n get description() {\n return 'Re-embed all entities in a repository. Optionally switch to a different embedding model or dimensionality — the repository metadata is updated first so subsequent writes use the new configuration. Retries failed batches with exponential backoff. Aborts early if error threshold is reached.';\n }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to re-embed' },\n model: { type: 'string', description: 'New embedding model identifier to switch the repository to (e.g. \"Qwen/Qwen3-Embedding-8B\"). Omit to keep the current model.' },\n dimensions: { type: 'number', description: 'New embedding dimensionality to switch the repository to (e.g. 1024). Omit to keep the current dimensionality.' },\n batchSize: { type: 'number', description: 'Entities per batch (default 50, max 200)' },\n maxRetries: { type: 'number', description: 'Retries per batch on embedding API failure with exponential backoff (default 3)' },\n errorThresholdToAbort: { type: 'number', description: 'Abort after this many cumulative failures. Omit for no limit.' },\n delayBetweenBatchesMs: { type: 'number', description: 'Milliseconds to wait between batches for rate limiting (default 0)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const batchSize = Math.min((params['batchSize'] as number | undefined) ?? 50, 200);\n\n const result = await this.context.deepMemory.reembedAll(repositoryId, {\n model: params['model'] as string | undefined,\n dimensions: params['dimensions'] as number | undefined,\n batchSize,\n maxRetries: params['maxRetries'] as number | undefined,\n errorThresholdToAbort: params['errorThresholdToAbort'] as number | undefined,\n delayBetweenBatchesMs: params['delayBetweenBatchesMs'] as number | undefined,\n });\n\n return {\n processed: result.processed,\n failed: result.failed,\n errors: result.errors,\n modelId: result.modelId,\n dimensions: result.dimensions,\n };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\ninterface RelationshipInput {\n relationshipType: string;\n sourceEntityId: string;\n targetEntityId: string;\n properties?: Record<string, unknown>;\n}\n\nexport class CreateRelationshipsTool extends BaseToolController {\n get name() { return 'memory_create_relationships'; }\n get description() { return 'Create one or more relationships (edges) between entities. Relationship types must be in the vocabulary. Entity references accept either GUID or slug.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entities' },\n relationships: {\n type: 'array',\n description: 'Array of relationships to create',\n items: {\n type: 'object',\n properties: {\n relationshipType: { type: 'string', description: 'Relationship type (must exist in vocabulary)' },\n sourceEntityId: { type: 'string', description: 'Source entity ID (GUID) or slug' },\n targetEntityId: { type: 'string', description: 'Target entity ID (GUID) or slug' },\n properties: { type: 'object', description: 'Typed properties per vocabulary schema' },\n },\n required: ['relationshipType', 'sourceEntityId', 'targetEntityId'],\n },\n minItems: 1,\n },\n },\n required: ['repositoryId', 'relationships'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const relationships = params['relationships'] as RelationshipInput[];\n\n // Resolve all entity IDs (supports both GUID and slug)\n const resolved = await Promise.all(\n relationships.map(async (r) => ({\n relationshipType: r.relationshipType,\n sourceEntityId: await this.resolveEntityId(repo, r.sourceEntityId),\n targetEntityId: await this.resolveEntityId(repo, r.targetEntityId),\n properties: r.properties,\n })),\n );\n\n return repo.createRelationships(resolved);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class RemoveRelationshipsTool extends BaseToolController {\n get name() { return 'memory_remove_relationships'; }\n get description() { return 'Remove one or more relationships (edges) from the knowledge graph in a single batch operation'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the relationships' },\n relationshipIds: {\n type: 'array',\n description: 'IDs of relationships to remove',\n items: { type: 'string' },\n minItems: 1,\n },\n },\n required: ['repositoryId', 'relationshipIds'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.removeRelationships(params['relationshipIds'] as string[]);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { stripProvenanceArray } from '../base/stripProvenance.js';\n\nexport class GetRelationshipsTool extends BaseToolController {\n get name() { return 'memory_get_relationships'; }\n get description() { return 'Get all relationships for a given entity, with optional type and direction filters. Accepts entity ID (GUID) or slug.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Entity ID (GUID) or slug' },\n relationshipTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by relationship type(s)' },\n direction: { type: 'string', enum: ['out', 'in', 'both'], description: 'Direction filter relative to the queried entity (default: both)' },\n limit: { type: 'number', description: 'Max results (default 20, max 100)' },\n offset: { type: 'number', description: 'Pagination offset (default 0)' },\n propertyFilters: { type: 'array', items: { type: 'object', properties: { key: { type: 'string' }, operator: { type: 'string', enum: ['eq', 'neq', 'isNull', 'isNotNull', 'gt', 'lt', 'gte', 'lte', 'contains'] }, value: {} }, required: ['key', 'operator'] }, description: 'Filter by relationship property values (AND)' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n const rawLimit = params['limit'] as number | undefined;\n const limit = Math.min(rawLimit ?? 20, 100);\n const result = await repo.getRelationships(resolvedId, {\n relationshipTypes: params['relationshipTypes'] as string[] | undefined,\n direction: params['direction'] as 'out' | 'in' | 'both' | undefined,\n limit,\n offset: (params['offset'] as number | undefined) ?? 0,\n propertyFilters: params['propertyFilters'] as import('@utaba/deep-memory').PropertyFilter[] | undefined,\n });\n\n // Always strip provenance from relationships\n return { ...result, items: stripProvenanceArray(result.items) };\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { stripProvenance, stripProvenanceArray } from '../base/stripProvenance.js';\n\nexport class ExploreNeighborhoodTool extends BaseToolController {\n get name() { return 'memory_explore_neighborhood'; }\n get description() { return 'Explore the neighborhood of an entity using BFS traversal (depth 1-3). Accepts entity ID (GUID) or slug.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Starting entity ID (GUID) or slug' },\n depth: { type: 'number', enum: [1, 2, 3], description: 'Exploration depth (default: 1)' },\n relationshipTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by relationship type(s)' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter result entity types' },\n direction: { type: 'string', enum: ['out', 'in', 'both'], description: 'Direction filter relative to the queried entity (default: both)' },\n limitPerType: { type: 'number', description: 'Max entities per relationship type (default 10, max 50)' },\n offsetPerType: { type: 'number', description: 'Pagination offset per relationship type (default 0)' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: summary)' },\n relationshipPropertyFilters: { type: 'array', items: { type: 'object', properties: { key: { type: 'string' }, operator: { type: 'string', enum: ['eq', 'neq', 'isNull', 'isNotNull', 'gt', 'lt', 'gte', 'lte', 'contains'] }, value: {} }, required: ['key', 'operator'] }, description: 'Filter relationships by property values (AND)' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n const rawLimitPerType = params['limitPerType'] as number | undefined;\n const limitPerType = Math.min(rawLimitPerType ?? 10, 50);\n const detailLevel = params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined;\n const result = await repo.exploreNeighborhood(resolvedId, {\n depth: params['depth'] as 1 | 2 | 3 | undefined,\n relationshipTypes: params['relationshipTypes'] as string[] | undefined,\n entityTypes: params['entityTypes'] as string[] | undefined,\n direction: params['direction'] as 'out' | 'in' | 'both' | undefined,\n limitPerType,\n offsetPerType: (params['offsetPerType'] as number | undefined) ?? 0,\n detailLevel,\n relationshipPropertyFilters: params['relationshipPropertyFilters'] as import('@utaba/deep-memory').PropertyFilter[] | undefined,\n });\n\n if (detailLevel === 'full') {\n result.center = stripProvenance(result.center);\n for (const layer of result.layers) {\n for (const key of Object.keys(layer)) {\n const bucket = layer[key];\n if (bucket && typeof bucket === 'object' && 'entities' in bucket) {\n const b = bucket as { entities: Array<{ provenance?: unknown }> };\n b.entities = stripProvenanceArray(b.entities) as typeof b.entities;\n }\n }\n }\n }\n\n return result;\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { stripProvenance, stripProvenanceArray } from '../base/stripProvenance.js';\n\nexport class FindPathsTool extends BaseToolController {\n get name() { return 'memory_find_paths'; }\n get description() { return 'Find paths between two entities in the knowledge graph. Accepts entity IDs (GUID) or slugs.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entities' },\n sourceEntityId: { type: 'string', description: 'Starting entity ID (GUID) or slug' },\n targetEntityId: { type: 'string', description: 'Destination entity ID (GUID) or slug' },\n maxDepth: { type: 'number', description: 'Maximum path depth (default: 3, max: 5)' },\n relationshipTypes: { type: 'array', items: { type: 'string' }, description: 'Filter allowed relationship types' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter entities in paths by type(s)' },\n limit: { type: 'number', description: 'Maximum number of paths to return (default: 5)' },\n offset: { type: 'number', description: 'Pagination offset (default: 0)' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: brief)' },\n relationshipPropertyFilters: { type: 'array', items: { type: 'object', properties: { key: { type: 'string' }, operator: { type: 'string', enum: ['eq', 'neq', 'isNull', 'isNotNull', 'gt', 'lt', 'gte', 'lte', 'contains'] }, value: {} }, required: ['key', 'operator'] }, description: 'Filter relationships by property values (AND)' },\n },\n required: ['repositoryId', 'sourceEntityId', 'targetEntityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const sourceId = await this.resolveEntityId(repo, params['sourceEntityId'] as string);\n const targetId = await this.resolveEntityId(repo, params['targetEntityId'] as string);\n const detailLevel = params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined;\n const result = await repo.findPaths(sourceId, targetId, {\n maxDepth: params['maxDepth'] as number | undefined,\n relationshipTypes: params['relationshipTypes'] as string[] | undefined,\n entityTypes: params['entityTypes'] as string[] | undefined,\n limit: params['limit'] as number | undefined,\n offset: params['offset'] as number | undefined,\n detailLevel,\n relationshipPropertyFilters: params['relationshipPropertyFilters'] as import('@utaba/deep-memory').PropertyFilter[] | undefined,\n });\n\n // Always strip provenance from entities and relationships\n if (detailLevel === 'full') {\n for (const path of result.paths) {\n path.entities = stripProvenanceArray(path.entities);\n path.relationships = path.relationships.map(r => stripProvenance(r));\n }\n } else {\n // Relationships always have provenance regardless of detail level\n for (const path of result.paths) {\n path.relationships = path.relationships.map(r => stripProvenance(r));\n }\n }\n\n return result;\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nconst PAGE_SIZE = 200;\n\nexport class GetGraphTool extends BaseToolController {\n get name() { return 'memory_get_graph'; }\n get description() { return 'Get the knowledge graph for a repository — entities, relationships, vocabulary, and stats. Returns up to 200 entities per page with a cursor for continuation. For large repositories, prefer memory_query_graph, memory_find_entities with filters and memory_explore_neighborhood for targeted exploration.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to get the graph for' },\n cursor: { type: 'string', description: 'Opaque cursor from a previous response to fetch the next page' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: summary)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const cursor = params['cursor'] as string | undefined;\n const repo = await this.context.getRepository(repositoryId);\n\n const offset = cursor ? parseInt(cursor.split(':')[1]!, 10) : 0;\n const detailLevel = params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined;\n const result = await repo.getGraph({ limit: PAGE_SIZE, offset, detailLevel });\n\n // Always strip provenance from relationships\n result.relationships = result.relationships.map(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ({ provenance, ...rest }) => rest,\n ) as typeof result.relationships;\n\n return result;\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport type { TraversalSpec } from '@utaba/deep-memory';\n\nconst propertyFilterSchema = {\n type: 'object',\n properties: {\n key: { type: 'string' },\n operator: { type: 'string', enum: ['eq', 'neq', 'isNull', 'isNotNull', 'gt', 'lt', 'gte', 'lte', 'contains'] },\n value: {},\n },\n required: ['key', 'operator'],\n};\n\nexport class QueryGraphTool extends BaseToolController {\n get name() { return 'memory_query_graph'; }\n get description() {\n return `Query the knowledge graph — vertex lookups, property projection, and multi-hop traversals in a single tool.\n\n## Projection (property extraction and aggregation)\n\nUse \\`projection\\` to extract property values from entities. When projection is present, only the aggregated values are returned (no entity objects) — this keeps responses lightweight. Set \\`projection.includeEntities: true\\` if you also need the full entity objects.\n\n- Distinct values: \\`{ start: { entityType: \"Equipment\" }, projection: { properties: [\"equipmentType\"], distinct: true }, limit: 200 }\\`\n- Count by value: \\`{ start: { entityType: \"Equipment\" }, projection: { properties: [\"equipmentType\"], mode: \"count\" }, limit: 200 }\\`\n- Multi-property: \\`{ start: { entityType: \"Equipment\" }, projection: { properties: [\"equipmentType\", \"tier\"], distinct: true }, limit: 200 }\\`\n\n## Vertex queries (no steps, no projection)\n\nQuery entities directly by type and properties — returns entity objects:\n- By type: \\`{ start: { entityType: \"Fluid\" }, limit: 50 }\\`\n- With filter: \\`{ start: { entityType: \"Fluid\", filter: [{ key: \"fluidType\", operator: \"eq\", value: \"hydraulic-oil\" }] }, limit: 50 }\\`\n\n## Traversals (with steps)\n\nFollow relationships through the graph:\n- 2-hop: \\`{ start: { entityId: \"Equipment:komatsu-pc7000-11\" }, steps: [{ direction: \"out\", relationshipTypes: [\"HAS_COMPONENT\"] }, { direction: \"out\", relationshipTypes: [\"REQUIRES_FLUID\"] }] }\\`\n- Filtered edges: \\`{ start: { entityId: \"Equipment:komatsu-pc7000-11\" }, steps: [{ direction: \"both\", relationshipTypes: [\"COMPATIBLE_WITH\"], relationshipFilter: [{ key: \"passCount\", operator: \"gte\", value: 3 }] }] }\\`\n- Variable depth: \\`{ start: { entityId: \"...\" }, steps: [{ direction: \"out\", relationshipTypes: [\"CONTAINS\"], repeat: { maxDepth: 5 } }] }\\`\n\nProjection works with traversals too — add \\`projection\\` to aggregate properties from the traversal results.`;\n }\n\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to query' },\n start: {\n type: 'object',\n description: 'Which entities to query or start traversing from',\n properties: {\n entityId: { type: 'string', description: 'Specific entity by ID (GUID) or slug' },\n entityType: { type: 'string', description: 'All entities of a given type (requires limit)' },\n filter: { type: 'array', items: propertyFilterSchema, description: 'Filter entities by property values' },\n },\n },\n steps: {\n type: 'array',\n description: 'Relationship hops to follow. Omit for vertex-only queries.',\n items: {\n type: 'object',\n properties: {\n direction: { type: 'string', enum: ['out', 'in', 'both'], description: 'Direction to traverse, relative to the entity at the start of the hop' },\n relationshipTypes: { type: 'array', items: { type: 'string' }, description: 'Relationship types to follow (omit for all)' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter target entities by type' },\n relationshipFilter: { type: 'array', items: propertyFilterSchema, description: 'Filter relationships by property values' },\n entityFilter: { type: 'array', items: propertyFilterSchema, description: 'Filter target entities by property values' },\n repeat: {\n type: 'object',\n description: 'Repeat this step for variable-depth traversal',\n properties: {\n maxDepth: { type: 'number', description: 'Maximum iterations (required)' },\n until: { type: 'array', items: propertyFilterSchema, description: 'Stop when entity matches these filters' },\n emitIntermediates: { type: 'boolean', description: 'Include intermediate entities (default: true)' },\n },\n required: ['maxDepth'],\n },\n },\n required: ['direction'],\n },\n },\n projection: {\n type: 'object',\n description: 'Property projection — extract and aggregate property values from result entities. When present, only aggregations are returned (no entity objects). Set includeEntities: true to also get entity objects.',\n properties: {\n properties: { type: 'array', items: { type: 'string' }, description: 'Property names to extract from entities' },\n distinct: { type: 'boolean', description: 'Return only distinct value combinations (default: false)' },\n mode: { type: 'string', enum: ['values', 'count'], description: 'values (default): raw property values. count: count entities per distinct combination' },\n includeEntities: { type: 'boolean', description: 'Also return full entity objects alongside projections (default: false)' },\n },\n required: ['properties'],\n },\n returnMode: { type: 'string', enum: ['terminal', 'path', 'all'], description: 'What to return (default: terminal)' },\n limit: { type: 'number', description: 'Maximum results (default: 50, max: 200)' },\n offset: { type: 'number', description: 'Pagination offset (default: 0)' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for entities (default: summary)' },\n dedup: { type: 'boolean', description: 'Deduplicate entities (default: true)' },\n includeRelationshipSummary: { type: 'boolean', description: 'Attach out/in relationship counts by type to each entity (default: true). Set false to reduce response size.' },\n },\n required: ['repositoryId', 'start'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n\n const start = params['start'] as TraversalSpec['start'];\n if (start.entityId) {\n start.entityId = await this.resolveEntityId(repo, start.entityId);\n }\n\n const spec: TraversalSpec = {\n start,\n steps: params['steps'] as TraversalSpec['steps'],\n returnMode: (params['returnMode'] as TraversalSpec['returnMode']) ?? 'terminal',\n projection: params['projection'] as TraversalSpec['projection'],\n limit: params['limit'] as number | undefined,\n offset: params['offset'] as number | undefined,\n detailLevel: params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined,\n dedup: params['dedup'] as boolean | undefined,\n includeRelationshipSummary: (params['includeRelationshipSummary'] as boolean | undefined) ?? true,\n includeProvenance: false,\n };\n\n return repo.traverse(spec);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class SearchByConceptTool extends BaseToolController {\n get name() { return 'memory_search_by_concept'; }\n get description() { return 'Semantic search for entities by concept similarity (requires an EmbeddingProvider)'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to search in' },\n query: { type: 'string', description: 'Natural language search query' },\n similarityThreshold: { type: 'number', description: 'Minimum similarity score 0.0-1.0 (default: 0.7)' },\n entityTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by entity type(s)' },\n limit: { type: 'number', description: 'Max results (default 10)' },\n offset: { type: 'number', description: 'Pagination offset' },\n detailLevel: { type: 'string', enum: ['brief', 'summary', 'full'], description: 'Detail level for returned entities (default: summary)' },\n },\n required: ['repositoryId', 'query'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.searchByConcept(params['query'] as string, {\n similarityThreshold: params['similarityThreshold'] as number | undefined,\n entityTypes: params['entityTypes'] as string[] | undefined,\n limit: params['limit'] as number | undefined,\n offset: params['offset'] as number | undefined,\n detailLevel: params['detailLevel'] as 'brief' | 'summary' | 'full' | undefined,\n });\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\n/** Strip createdAt/createdBy/modifiedAt/modifiedBy from a vocabulary type definition */\nfunction stripVocabularyProvenance<T>(obj: T): Omit<T, 'createdAt' | 'createdBy' | 'modifiedAt' | 'modifiedBy'> {\n const { createdAt, createdBy, modifiedAt, modifiedBy, ...rest } = obj as Record<string, unknown>;\n return rest as Omit<T, 'createdAt' | 'createdBy' | 'modifiedAt' | 'modifiedBy'>;\n}\n\nexport class GetVocabularyTool extends BaseToolController {\n get name() { return 'memory_get_vocabulary'; }\n get description() { return 'Get the vocabulary definition for a repository — shows available entity types, relationship types, and governance mode'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to get vocabulary for' },\n includeProvenance: { type: 'boolean', description: 'Include createdAt/createdBy/modifiedAt/modifiedBy on type definitions (default: false)' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const result = await repo.getVocabulary();\n const includeProvenance = params['includeProvenance'] === true;\n\n if (!includeProvenance) {\n return {\n ...result,\n vocabulary: {\n ...result.vocabulary,\n entityTypes: result.vocabulary.entityTypes.map(stripVocabularyProvenance),\n relationshipTypes: result.vocabulary.relationshipTypes.map(stripVocabularyProvenance),\n },\n };\n }\n\n return result;\n }\n}\n","import type { VocabularyProposal } from '@utaba/deep-memory';\nimport { BaseToolController } from '../base/BaseToolController.js';\n\nexport class ProposeVocabularyExtensionTool extends BaseToolController {\n get name() { return 'memory_propose_vocabulary_extension'; }\n get description() { return 'Propose a new entity type or relationship type. Only needed when the vocabulary doesn\\'t already include the type you need — check memory_open_repository response first.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to modify' },\n proposalType: {\n type: 'string',\n enum: [\n 'entity_type',\n 'relationship_type',\n 'edit_entity_type',\n 'edit_relationship_type',\n 'delete_entity_type',\n 'delete_relationship_type',\n ],\n description: 'Type of vocabulary change',\n },\n entityType: {\n type: 'object',\n description: 'Entity type definition (when proposalType is entity_type)',\n properties: {\n type: { type: 'string', description: 'Type name' },\n description: { type: 'string', description: 'Type description' },\n properties: { type: 'array', items: { type: 'object' }, description: 'Property schema definitions' },\n },\n required: ['type', 'description'],\n },\n relationshipType: {\n type: 'object',\n description: 'Relationship type definition (when proposalType is relationship_type)',\n properties: {\n type: { type: 'string', description: 'Type name' },\n description: { type: 'string', description: 'Type description' },\n allowedSourceTypes: { type: 'array', items: { type: 'string' } },\n allowedTargetTypes: { type: 'array', items: { type: 'string' } },\n bidirectional: { type: 'boolean' },\n properties: { type: 'array', items: { type: 'object' }, description: 'Property schema definitions' },\n },\n required: ['type', 'description', 'allowedSourceTypes', 'allowedTargetTypes'],\n },\n editEntityType: {\n type: 'object',\n description: 'Edit an existing entity type (when proposalType is edit_entity_type)',\n properties: {\n type: { type: 'string', description: 'Name of the entity type to edit' },\n description: { type: 'string', description: 'New description (optional)' },\n addProperties: { type: 'array', items: { type: 'object' }, description: 'Properties to add' },\n removeProperties: { type: 'array', items: { type: 'string' }, description: 'Property names to remove' },\n updateProperties: { type: 'array', items: { type: 'object' }, description: 'Properties to update (matched by name)' },\n },\n required: ['type'],\n },\n editRelationshipType: {\n type: 'object',\n description: 'Edit an existing relationship type (when proposalType is edit_relationship_type)',\n properties: {\n type: { type: 'string', description: 'Name of the relationship type to edit' },\n description: { type: 'string', description: 'New description (optional)' },\n allowedSourceTypes: { type: 'array', items: { type: 'string' }, description: 'New allowed source types' },\n allowedTargetTypes: { type: 'array', items: { type: 'string' }, description: 'New allowed target types' },\n bidirectional: { type: 'boolean', description: 'New bidirectional flag' },\n addProperties: { type: 'array', items: { type: 'object' }, description: 'Properties to add' },\n removeProperties: { type: 'array', items: { type: 'string' }, description: 'Property names to remove' },\n updateProperties: { type: 'array', items: { type: 'object' }, description: 'Properties to update (matched by name)' },\n },\n required: ['type'],\n },\n deleteEntityType: {\n type: 'object',\n description: 'Delete an entity type and all its instances (when proposalType is delete_entity_type)',\n properties: {\n type: { type: 'string', description: 'Name of the entity type to delete' },\n },\n required: ['type'],\n },\n deleteRelationshipType: {\n type: 'object',\n description: 'Delete a relationship type and all its instances (when proposalType is delete_relationship_type)',\n properties: {\n type: { type: 'string', description: 'Name of the relationship type to delete' },\n },\n required: ['type'],\n },\n justification: { type: 'string', description: 'Why this vocabulary change is needed' },\n },\n required: ['repositoryId', 'proposalType'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n\n const proposal: VocabularyProposal = {\n proposalType: params['proposalType'] as VocabularyProposal['proposalType'],\n entityType: params['entityType'] as VocabularyProposal['entityType'],\n relationshipType: params['relationshipType'] as VocabularyProposal['relationshipType'],\n editEntityType: params['editEntityType'] as VocabularyProposal['editEntityType'],\n editRelationshipType: params['editRelationshipType'] as VocabularyProposal['editRelationshipType'],\n deleteEntityType: params['deleteEntityType'] as VocabularyProposal['deleteEntityType'],\n deleteRelationshipType: params['deleteRelationshipType'] as VocabularyProposal['deleteRelationshipType'],\n justification: (params['justification'] as string) ?? '',\n };\n\n return repo.proposeVocabularyChange(proposal);\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\n\nexport class GetStatsTool extends BaseToolController {\n get name() { return 'memory_get_stats'; }\n get description() { return 'Get statistics for a repository — entity count, relationship count, type breakdowns'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository to get stats for' },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n return repo.getStats();\n }\n}\n","import { BaseToolController } from '../base/BaseToolController.js';\nimport { buildProvenanceFilter } from '../base/provenanceHelper.js';\n\nexport class GetTimelineTool extends BaseToolController {\n get name() { return 'memory_get_timeline'; }\n get description() { return 'Get the activity timeline for an entity — creation, updates, and relationship changes. Accepts entity ID (GUID) or slug.'; }\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: { type: 'string', description: 'Repository containing the entity' },\n entityId: { type: 'string', description: 'Entity ID (GUID) or slug' },\n from: { type: 'string', description: 'Start of time range (ISO 8601)' },\n to: { type: 'string', description: 'End of time range (ISO 8601)' },\n eventTypes: { type: 'array', items: { type: 'string' }, description: 'Filter by event types' },\n limit: { type: 'number', description: 'Max events (default 20, max 100)' },\n offset: { type: 'number', description: 'Pagination offset' },\n conversationId: { type: 'string', description: 'Filter to events from this conversation' },\n actor: { type: 'string', description: 'Filter to events by this actor' },\n },\n required: ['repositoryId', 'entityId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repo = await this.context.getRepository(params['repositoryId'] as string);\n const resolvedId = await this.resolveEntityId(repo, params['entityId'] as string);\n const timeRange = params['from'] && params['to']\n ? { from: params['from'] as string, to: params['to'] as string }\n : undefined;\n const rawLimit = params['limit'] as number | undefined;\n const limit = Math.min(rawLimit ?? 20, 100);\n return repo.getTimeline(resolvedId, {\n timeRange,\n eventTypes: params['eventTypes'] as string[] | undefined,\n limit,\n offset: (params['offset'] as number | undefined) ?? 0,\n provenance: buildProvenanceFilter(params),\n });\n }\n}\n","import { mkdirSync } from 'node:fs';\nimport { writeFile } from 'node:fs/promises';\nimport { join, resolve } from 'node:path';\nimport type { ExportLegalMetadata } from '@utaba/deep-memory';\nimport type { ILogger } from '../../interfaces/ILogger.js';\nimport { BaseToolController } from '../base/BaseToolController.js';\nimport type { ToolContext } from '../base/BaseToolController.js';\nimport { createZip, type ZipEntry } from './zip.js';\n\n/** Maximum entities or relationships per chunk file */\nconst CHUNK_SIZE = 500;\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction slugify(text: string): string {\n return (\n text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '') || 'repository'\n );\n}\n\nfunction formatDatetime(date: Date): string {\n const p = (n: number) => String(n).padStart(2, '0');\n return (\n `${date.getFullYear()}${p(date.getMonth() + 1)}${p(date.getDate())}` +\n `-${p(date.getHours())}${p(date.getMinutes())}${p(date.getSeconds())}`\n );\n}\n\nfunction toBuffer(obj: unknown): Buffer {\n return Buffer.from(JSON.stringify(obj, null, 2), 'utf8');\n}\n\n// ---------------------------------------------------------------------------\n// Tool\n// ---------------------------------------------------------------------------\n\nexport class ExportRepositoryTool extends BaseToolController {\n constructor(\n context: ToolContext,\n logger: ILogger,\n private exportDir: string,\n ) {\n super(context, logger);\n }\n\n get name() {\n return 'memory_export_repository';\n }\n\n get description() {\n return (\n 'Export a memory repository to a .dkg (Deep Knowledge Graph) file on the local filesystem. ' +\n 'The archive contains manifest.json, vocabulary.json, and chunked ' +\n 'entities/relationships files. Returns the path — no data is sent to the AI.'\n );\n }\n\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: {\n type: 'string',\n description: 'UUID of the repository to export',\n },\n legal: {\n type: 'object',\n description: 'Optional legal/copyright metadata to embed in the archive manifest',\n properties: {\n copyright: {\n type: 'string',\n description: 'Copyright holder (e.g. \"© 2026 Caterpillar Inc.\")',\n },\n license: {\n type: 'string',\n description: 'SPDX license identifier or custom license name (e.g. \"Apache-2.0\", \"LicenseRef-Proprietary\")',\n },\n licenseUrl: {\n type: 'string',\n description: 'Full license text or URL pointing to license terms',\n },\n terms: {\n type: 'string',\n description: 'Human-readable usage terms or restrictions summary',\n },\n publisher: {\n type: 'string',\n description: 'Organization that published this archive',\n },\n contact: {\n type: 'string',\n description: 'Contact for licensing questions (e.g. email address)',\n },\n },\n required: ['copyright'],\n },\n },\n required: ['repositoryId'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const legal = params['legal'] as ExportLegalMetadata | undefined;\n\n this.logger.info(this.name, `Exporting repository ${repositoryId}`);\n const startTime = Date.now();\n\n const exportOptions = legal ? { legal } : undefined;\n\n const entries: ZipEntry[] = [];\n let entityCount = 0;\n let relationshipCount = 0;\n let entityChunkNum = 0;\n let relationshipChunkNum = 0;\n let label = '';\n let vocabVersion = '';\n let exportedAt = '';\n\n for await (const item of this.context.deepMemory.exportRepositoryStream(repositoryId, exportOptions)) {\n switch (item.type) {\n case 'manifest':\n entries.push({ name: 'manifest.json', data: toBuffer(item.data) });\n label = item.data.repository.label;\n vocabVersion = item.data.repository.vocabularyVersion;\n exportedAt = item.data.exportedAt;\n break;\n\n case 'vocabulary':\n entries.push({ name: 'vocabulary.json', data: toBuffer(item.data) });\n break;\n\n case 'entities': {\n const allEntities = item.data;\n for (let i = 0; i < allEntities.length; i += CHUNK_SIZE) {\n const chunk = allEntities.slice(i, i + CHUNK_SIZE);\n entityChunkNum++;\n entries.push({\n name: `entities-${String(entityChunkNum).padStart(4, '0')}.json`,\n data: toBuffer(chunk),\n });\n }\n entityCount += allEntities.length;\n break;\n }\n\n case 'relationships': {\n const allRels = item.data;\n for (let i = 0; i < allRels.length; i += CHUNK_SIZE) {\n const chunk = allRels.slice(i, i + CHUNK_SIZE);\n relationshipChunkNum++;\n entries.push({\n name: `relationships-${String(relationshipChunkNum).padStart(4, '0')}.json`,\n data: toBuffer(chunk),\n });\n }\n relationshipCount += allRels.length;\n break;\n }\n }\n }\n\n const slug = slugify(label);\n const datetime = formatDatetime(new Date(exportedAt));\n const zipName = `${slug}-v${vocabVersion}-${datetime}.dkg`;\n\n const exportDir = resolve(this.exportDir);\n mkdirSync(exportDir, { recursive: true });\n\n const filePath = join(exportDir, zipName);\n const zipBuffer = createZip(entries);\n await writeFile(filePath, zipBuffer);\n\n const elapsedMs = Date.now() - startTime;\n const elapsedSec = (elapsedMs / 1000).toFixed(1);\n\n this.logger.info(this.name, `Exported to ${filePath} (${entries.length} files) in ${elapsedSec}s`);\n\n return {\n path: filePath,\n filename: zipName,\n repository: label,\n vocabularyVersion: vocabVersion,\n statistics: {\n entities: entityCount,\n relationships: relationshipCount,\n files: entries.length,\n },\n timing: {\n elapsedMs,\n elapsedFormatted: `${elapsedSec}s`,\n },\n };\n }\n}\n","// Minimal multi-entry ZIP writer/reader using Node built-ins (no extra deps)\n\nimport { deflateRawSync, inflateRawSync } from 'node:zlib';\n\n// ---------------------------------------------------------------------------\n// CRC-32\n// ---------------------------------------------------------------------------\n\nconst crc32Table = new Uint32Array(256);\nfor (let i = 0; i < 256; i++) {\n let c = i;\n for (let j = 0; j < 8; j++) {\n c = c & 1 ? (0xedb88320 ^ (c >>> 1)) : c >>> 1;\n }\n crc32Table[i] = c;\n}\n\nfunction computeCrc32(data: Buffer): number {\n let crc = 0xffffffff;\n for (let i = 0; i < data.length; i++) {\n crc = (crc32Table[(crc ^ data[i]!) & 0xff]! ^ (crc >>> 8)) >>> 0;\n }\n return (crc ^ 0xffffffff) >>> 0;\n}\n\n// ---------------------------------------------------------------------------\n// ZIP writer — multiple entries\n// ---------------------------------------------------------------------------\n\nexport interface ZipEntry {\n name: string;\n data: Buffer;\n}\n\nexport function createZip(entries: ZipEntry[]): Buffer {\n const now = new Date();\n const dosTime =\n ((now.getHours() << 11) | (now.getMinutes() << 5) | (now.getSeconds() >> 1)) & 0xffff;\n const dosDate =\n ((((now.getFullYear() - 1980) & 0x7f) << 9) |\n (((now.getMonth() + 1) & 0x0f) << 5) |\n (now.getDate() & 0x1f)) &\n 0xffff;\n\n const localParts: Buffer[] = [];\n const centralParts: Buffer[] = [];\n let offset = 0;\n\n for (const entry of entries) {\n const nameBytes = Buffer.from(entry.name, 'utf8');\n const compressed = deflateRawSync(entry.data);\n const crc = computeCrc32(entry.data);\n\n // Local file header\n const local = Buffer.allocUnsafe(30 + nameBytes.length);\n local.writeUInt32LE(0x04034b50, 0);\n local.writeUInt16LE(20, 4);\n local.writeUInt16LE(0, 6);\n local.writeUInt16LE(8, 8);\n local.writeUInt16LE(dosTime, 10);\n local.writeUInt16LE(dosDate, 12);\n local.writeUInt32LE(crc, 14);\n local.writeUInt32LE(compressed.length, 18);\n local.writeUInt32LE(entry.data.length, 22);\n local.writeUInt16LE(nameBytes.length, 26);\n local.writeUInt16LE(0, 28);\n nameBytes.copy(local, 30);\n\n // Central directory header\n const central = Buffer.allocUnsafe(46 + nameBytes.length);\n central.writeUInt32LE(0x02014b50, 0);\n central.writeUInt16LE(20, 4);\n central.writeUInt16LE(20, 6);\n central.writeUInt16LE(0, 8);\n central.writeUInt16LE(8, 10);\n central.writeUInt16LE(dosTime, 12);\n central.writeUInt16LE(dosDate, 14);\n central.writeUInt32LE(crc, 16);\n central.writeUInt32LE(compressed.length, 20);\n central.writeUInt32LE(entry.data.length, 24);\n central.writeUInt16LE(nameBytes.length, 28);\n central.writeUInt16LE(0, 30);\n central.writeUInt16LE(0, 32);\n central.writeUInt16LE(0, 34);\n central.writeUInt16LE(0, 36);\n central.writeUInt32LE(0, 38);\n central.writeUInt32LE(offset, 42);\n nameBytes.copy(central, 46);\n\n localParts.push(local, compressed);\n centralParts.push(central);\n offset += local.length + compressed.length;\n }\n\n const centralDirOffset = offset;\n const centralDirBuf = Buffer.concat(centralParts);\n\n // End of central directory\n const eocd = Buffer.allocUnsafe(22);\n eocd.writeUInt32LE(0x06054b50, 0);\n eocd.writeUInt16LE(0, 4);\n eocd.writeUInt16LE(0, 6);\n eocd.writeUInt16LE(entries.length, 8);\n eocd.writeUInt16LE(entries.length, 10);\n eocd.writeUInt32LE(centralDirBuf.length, 12);\n eocd.writeUInt32LE(centralDirOffset, 16);\n eocd.writeUInt16LE(0, 20);\n\n return Buffer.concat([...localParts, centralDirBuf, eocd]);\n}\n\n// ---------------------------------------------------------------------------\n// ZIP reader — multiple entries, returned as a name→data map\n// ---------------------------------------------------------------------------\n\nexport function readZip(zipBuffer: Buffer): Map<string, Buffer> {\n // Find EOCD\n let eocdOffset = -1;\n for (let i = zipBuffer.length - 22; i >= 0; i--) {\n if (zipBuffer.readUInt32LE(i) === 0x06054b50) {\n eocdOffset = i;\n break;\n }\n }\n if (eocdOffset === -1) {\n throw new Error('Invalid ZIP file: end of central directory record not found');\n }\n\n const entryCount = zipBuffer.readUInt16LE(eocdOffset + 10);\n const centralDirOffset = zipBuffer.readUInt32LE(eocdOffset + 16);\n\n const entries = new Map<string, Buffer>();\n let pos = centralDirOffset;\n\n for (let i = 0; i < entryCount; i++) {\n if (zipBuffer.readUInt32LE(pos) !== 0x02014b50) {\n throw new Error('Invalid ZIP file: central directory header not found');\n }\n\n const compressionMethod = zipBuffer.readUInt16LE(pos + 10);\n const compressedSize = zipBuffer.readUInt32LE(pos + 20);\n const nameLength = zipBuffer.readUInt16LE(pos + 28);\n const extraLength = zipBuffer.readUInt16LE(pos + 30);\n const commentLength = zipBuffer.readUInt16LE(pos + 32);\n const localHeaderOffset = zipBuffer.readUInt32LE(pos + 42);\n\n const name = zipBuffer.subarray(pos + 46, pos + 46 + nameLength).toString('utf8');\n pos += 46 + nameLength + extraLength + commentLength;\n\n // Read from local file header\n const localNameLength = zipBuffer.readUInt16LE(localHeaderOffset + 26);\n const localExtraLength = zipBuffer.readUInt16LE(localHeaderOffset + 28);\n const dataOffset = localHeaderOffset + 30 + localNameLength + localExtraLength;\n const compressedData = zipBuffer.subarray(dataOffset, dataOffset + compressedSize);\n\n if (compressionMethod === 0) {\n entries.set(name, Buffer.from(compressedData));\n } else if (compressionMethod === 8) {\n entries.set(name, Buffer.from(inflateRawSync(compressedData)));\n } else {\n throw new Error(`Unsupported ZIP compression method: ${compressionMethod}`);\n }\n }\n\n return entries;\n}\n","import { readFile } from 'node:fs/promises';\nimport type {\n ExportManifest,\n StoredEntity,\n StoredRelationship,\n} from '@utaba/deep-memory';\nimport type {\n AdaptiveConcurrencyAdjustEvent,\n MemoryVocabulary,\n} from '@utaba/deep-memory/types';\nimport { BaseToolController } from '../base/BaseToolController.js';\nimport { readZip } from './zip.js';\n\n// ---------------------------------------------------------------------------\n// Tool\n// ---------------------------------------------------------------------------\n\nexport class ImportRepositoryTool extends BaseToolController {\n get name() {\n return 'memory_import_repository';\n }\n\n get description() {\n return (\n 'Import a .dkg (Deep Knowledge Graph) archive. ' +\n 'Also accepts legacy .zip archives. ' +\n 'Mode \"create\" creates a new repository and uses fast bulk inserts (no existence checks). ' +\n 'Mode \"merge\" (default) imports into an existing repository — entities with matching IDs are overwritten; new vocabulary types are added automatically. ' +\n 'Supports both multi-file (manifest.json + chunks) and legacy single-file archives.'\n );\n }\n\n get inputSchema() {\n return {\n type: 'object',\n properties: {\n repositoryId: {\n type: 'string',\n description: 'UUID of the target repository to import into (merge) or for the new repository (create)',\n },\n path: {\n type: 'string',\n description: 'Absolute path to the .dkg or .zip archive to import',\n },\n mode: {\n type: 'string',\n enum: ['create', 'merge'],\n description: 'Import mode: \"create\" for a new repository (fast, no existence checks), \"merge\" to import into an existing repository (default: merge)',\n },\n },\n required: ['repositoryId', 'path'],\n };\n }\n\n protected async handleExecute(params: Record<string, unknown>) {\n const repositoryId = params['repositoryId'] as string;\n const filePath = params['path'] as string;\n const mode = (params['mode'] as string) ?? 'merge';\n\n this.logger.info(this.name, `Importing ${filePath} into repository ${repositoryId} (mode: ${mode})`);\n const startTime = Date.now();\n\n const zipBuffer = await readFile(filePath);\n const files = readZip(zipBuffer);\n\n // Detect format: multi-file (has manifest.json) vs legacy single-file\n const manifestBuf = files.get('manifest.json');\n\n let manifest: ExportManifest;\n let vocabulary: MemoryVocabulary;\n const entities: StoredEntity[] = [];\n const relationships: StoredRelationship[] = [];\n\n if (manifestBuf) {\n // Multi-file format\n manifest = JSON.parse(manifestBuf.toString('utf8')) as ExportManifest;\n\n const vocabBuf = files.get('vocabulary.json');\n if (!vocabBuf) {\n throw new Error('Invalid archive: manifest.json present but vocabulary.json missing');\n }\n vocabulary = JSON.parse(vocabBuf.toString('utf8')) as MemoryVocabulary;\n\n // Collect entity and relationship chunks in sorted order\n const sortedNames = [...files.keys()].sort();\n for (const name of sortedNames) {\n if (name.startsWith('entities-') && name.endsWith('.json')) {\n const chunk = JSON.parse(files.get(name)!.toString('utf8')) as StoredEntity[];\n entities.push(...chunk);\n } else if (name.startsWith('relationships-') && name.endsWith('.json')) {\n const chunk = JSON.parse(files.get(name)!.toString('utf8')) as StoredRelationship[];\n relationships.push(...chunk);\n }\n }\n } else {\n // Legacy single-file format — first entry is the full archive JSON\n const firstEntry = files.values().next().value;\n if (!firstEntry) {\n throw new Error('Invalid archive: zip file is empty');\n }\n const legacy = JSON.parse(firstEntry.toString('utf8')) as {\n manifest: ExportManifest;\n vocabulary: MemoryVocabulary;\n entities: StoredEntity[];\n relationships: StoredRelationship[];\n };\n manifest = legacy.manifest;\n vocabulary = legacy.vocabulary;\n entities.push(...legacy.entities);\n relationships.push(...legacy.relationships);\n }\n\n const onAdjust = (event: AdaptiveConcurrencyAdjustEvent): void => {\n this.logger.info(\n this.name,\n `Adaptive concurrency ${event.reason}: ${event.previousConcurrency} -> ${event.concurrency} ` +\n `(tasks=${event.tasksCompleted}, throttled=${event.throttledCount})`,\n );\n };\n\n const importOptions = mode === 'create'\n ? {\n target: {\n mode: 'create' as const,\n repositoryId,\n config: {\n label: manifest.repository.label,\n type: manifest.repository.type,\n description: manifest.repository.description,\n governance: { mode: manifest.repository.governanceMode },\n },\n },\n bulk: {\n adaptiveConcurrency: { onAdjust },\n },\n }\n : {\n target: { mode: 'merge' as const, repositoryId },\n vocabularyConflict: 'extend' as const,\n entityConflict: 'overwrite' as const,\n bulk: {\n adaptiveConcurrency: { onAdjust },\n },\n };\n\n const result = await this.context.deepMemory.importRepository(\n { manifest, vocabulary, entities, relationships },\n importOptions,\n );\n\n const elapsedMs = Date.now() - startTime;\n const elapsedSec = (elapsedMs / 1000).toFixed(1);\n\n this.logger.info(\n this.name,\n `Import ${result.success ? 'succeeded' : 'failed'}: ` +\n `${result.statistics.entitiesImported} entities, ` +\n `${result.statistics.relationshipsImported} relationships ` +\n `in ${elapsedSec}s`,\n );\n\n return {\n success: result.success,\n repositoryId: result.repositoryId,\n statistics: result.statistics,\n warnings: result.warnings,\n timing: {\n elapsedMs,\n elapsedFormatted: `${elapsedSec}s`,\n },\n };\n }\n}\n","import type { ILogger } from '../interfaces/ILogger.js';\nimport type { IMcpTool } from '../interfaces/IMcpTool.js';\nimport type { ToolContext } from '../tools/base/BaseToolController.js';\n\n// Repository tools\nimport { CreateRepositoryTool } from '../tools/repository/CreateRepositoryTool.js';\nimport { OpenRepositoryTool } from '../tools/repository/OpenRepositoryTool.js';\nimport { ListRepositoriesTool } from '../tools/repository/ListRepositoriesTool.js';\nimport { UpdateRepositoryTool } from '../tools/repository/UpdateRepositoryTool.js';\nimport { DeleteRepositoryTool } from '../tools/repository/DeleteRepositoryTool.js';\nimport { EnsureSchemaTool } from '../tools/repository/EnsureSchemaTool.js';\nimport { ValidateEntitiesTool } from '../tools/repository/ValidateEntitiesTool.js';\nimport { ValidateRelationshipsTool } from '../tools/repository/ValidateRelationshipsTool.js';\n\n// Entity tools\nimport { CreateEntitiesTool } from '../tools/entity/CreateEntitiesTool.js';\nimport { UpdateEntityTool } from '../tools/entity/UpdateEntityTool.js';\nimport { GetEntityTool } from '../tools/entity/GetEntityTool.js';\nimport { FindEntitiesTool } from '../tools/entity/FindEntitiesTool.js';\nimport { DeleteEntitiesTool } from '../tools/entity/DeleteEntitiesTool.js';\nimport { ReembedRepositoryTool } from '../tools/entity/ReembedRepositoryTool.js';\n\n// Relationship tools\nimport { CreateRelationshipsTool } from '../tools/relationship/CreateRelationshipsTool.js';\nimport { RemoveRelationshipsTool } from '../tools/relationship/RemoveRelationshipsTool.js';\nimport { GetRelationshipsTool } from '../tools/relationship/GetRelationshipsTool.js';\n\n// Graph traversal tools\nimport { ExploreNeighborhoodTool } from '../tools/graph/ExploreNeighborhoodTool.js';\nimport { FindPathsTool } from '../tools/graph/FindPathsTool.js';\nimport { GetGraphTool } from '../tools/graph/GetGraphTool.js';\nimport { QueryGraphTool } from '../tools/graph/QueryGraphTool.js';\n\n// Search tools\nimport { SearchByConceptTool } from '../tools/search/SearchByConceptTool.js';\n\n// Vocabulary tools\nimport { GetVocabularyTool } from '../tools/vocabulary/GetVocabularyTool.js';\nimport { ProposeVocabularyExtensionTool } from '../tools/vocabulary/ProposeVocabularyExtensionTool.js';\n\n// Stats tools\nimport { GetStatsTool } from '../tools/stats/GetStatsTool.js';\nimport { GetTimelineTool } from '../tools/stats/GetTimelineTool.js';\n\n// Portability tools\nimport { ExportRepositoryTool } from '../tools/portability/ExportRepositoryTool.js';\nimport { ImportRepositoryTool } from '../tools/portability/ImportRepositoryTool.js';\n\nexport interface ToolInfo {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n}\n\nexport class ToolRegistry {\n private tools: Map<string, IMcpTool> = new Map();\n\n constructor(\n private context: ToolContext,\n private logger: ILogger,\n ) {\n this.registerTools();\n }\n\n private registerTools(): void {\n // Repository lifecycle\n this.register(new CreateRepositoryTool(this.context, this.logger));\n this.register(new OpenRepositoryTool(this.context, this.logger));\n this.register(new ListRepositoriesTool(this.context, this.logger));\n this.register(new UpdateRepositoryTool(this.context, this.logger));\n this.register(new DeleteRepositoryTool(this.context, this.logger));\n this.register(new EnsureSchemaTool(this.context, this.logger));\n this.register(new ValidateEntitiesTool(this.context, this.logger));\n this.register(new ValidateRelationshipsTool(this.context, this.logger));\n\n // Entity operations\n this.register(new CreateEntitiesTool(this.context, this.logger));\n this.register(new UpdateEntityTool(this.context, this.logger));\n this.register(new GetEntityTool(this.context, this.logger));\n this.register(new FindEntitiesTool(this.context, this.logger));\n this.register(new DeleteEntitiesTool(this.context, this.logger));\n this.register(new ReembedRepositoryTool(this.context, this.logger));\n\n // Relationship operations\n this.register(new CreateRelationshipsTool(this.context, this.logger));\n this.register(new RemoveRelationshipsTool(this.context, this.logger));\n this.register(new GetRelationshipsTool(this.context, this.logger));\n\n // Graph traversal\n this.register(new ExploreNeighborhoodTool(this.context, this.logger));\n this.register(new FindPathsTool(this.context, this.logger));\n this.register(new GetGraphTool(this.context, this.logger));\n this.register(new QueryGraphTool(this.context, this.logger));\n\n // Search\n this.register(new SearchByConceptTool(this.context, this.logger));\n\n // Vocabulary\n this.register(new GetVocabularyTool(this.context, this.logger));\n this.register(new ProposeVocabularyExtensionTool(this.context, this.logger));\n\n // Stats & timeline\n this.register(new GetStatsTool(this.context, this.logger));\n this.register(new GetTimelineTool(this.context, this.logger));\n\n // Portability\n this.register(new ExportRepositoryTool(this.context, this.logger, this.context.exportDir));\n this.register(new ImportRepositoryTool(this.context, this.logger));\n\n this.logger.info('ToolRegistry', `Registered ${this.tools.size} tools`);\n }\n\n private register(tool: IMcpTool): void {\n if (this.tools.has(tool.name)) {\n this.logger.warn('ToolRegistry', `Tool ${tool.name} already registered, overwriting`);\n }\n this.tools.set(tool.name, tool);\n }\n\n listTools(): ToolInfo[] {\n return Array.from(this.tools.values()).map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n }));\n }\n\n async executeTool(name: string, params: Record<string, unknown>): Promise<unknown> {\n const tool = this.tools.get(name);\n if (!tool) {\n throw new Error(`Tool '${name}' not found`);\n }\n\n this.logger.debug('ToolRegistry', `Executing tool: ${name}`);\n\n try {\n const result = await tool.execute(params);\n this.logger.debug('ToolRegistry', `Tool ${name} completed`);\n return result;\n } catch (error) {\n this.logger.error('ToolRegistry', `Tool ${name} failed`, error);\n throw error;\n }\n }\n\n getToolCount(): number {\n return this.tools.size;\n }\n}\n","import type { ILogger } from '../interfaces/ILogger.js';\nimport type { ToolRegistry } from './ToolRegistry.js';\n\nexport class McpHandler {\n constructor(\n private toolRegistry: ToolRegistry,\n private logger: ILogger,\n ) {}\n\n async handleToolsList(): Promise<{ tools: Array<{ name: string; description: string; inputSchema: Record<string, unknown> }> }> {\n this.logger.debug('McpHandler', 'Received tools/list request');\n\n const tools = this.toolRegistry.listTools();\n this.logger.info('McpHandler', `Returning ${tools.length} tools`);\n\n return {\n tools: tools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n })),\n };\n }\n\n async handleToolCall(request: { params: { name: string; arguments?: Record<string, unknown> } }): Promise<{\n content: Array<{ type: string; text: string }>;\n isError?: boolean;\n }> {\n const { name, arguments: args } = request.params;\n\n this.logger.debug('McpHandler', `Received tool call: ${name}`);\n\n try {\n if (!name) {\n throw new Error('Tool name is required');\n }\n\n const result = await this.toolRegistry.executeTool(name, args ?? {});\n\n this.logger.info('McpHandler', `Tool ${name} executed successfully`);\n\n // Pre-formatted MCP response passthrough\n if (result && typeof result === 'object' && 'content' in (result as Record<string, unknown>) && Array.isArray((result as Record<string, unknown>)['content'])) {\n return result as { content: Array<{ type: string; text: string }> };\n }\n\n // String results\n if (typeof result === 'string') {\n return { content: [{ type: 'text', text: result }] };\n }\n\n // Objects/arrays as JSON\n return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n this.logger.error('McpHandler', `Tool ${name} failed: ${message}`);\n\n return {\n content: [{ type: 'text', text: `Error: ${message}` }],\n isError: true,\n };\n }\n }\n}\n","export interface ILogger {\n debug(context: string, message: string): void;\n info(context: string, message: string): void;\n warn(context: string, message: string): void;\n error(context: string, message: string, detail?: unknown): void;\n}\n\nexport class ConsoleLogger implements ILogger {\n debug(context: string, message: string): void {\n console.error(`[DEBUG] [${context}] ${message}`);\n }\n\n info(context: string, message: string): void {\n console.error(`[INFO] [${context}] ${message}`);\n }\n\n warn(context: string, message: string): void {\n console.error(`[WARN] [${context}] ${message}`);\n }\n\n error(context: string, message: string, detail?: unknown): void {\n console.error(`[ERROR] [${context}] ${message}`, detail ?? '');\n }\n}\n"],"mappings":";;;AAAA,SAAS,cAAc,kBAAkB;AACzC,SAAS,WAAAA,gBAAe;;;ACDxB,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,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logger","logger","logger","resolve"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utaba/deep-memory-local-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Local MCP server exposing @utaba/deep-memory as tools for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@modelcontextprotocol/sdk": "^1.28.0",
|
|
51
|
-
"@utaba/deep-memory": "0.
|
|
52
|
-
"@utaba/deep-memory-storage-
|
|
53
|
-
"@utaba/deep-memory-
|
|
54
|
-
"@utaba/deep-memory-
|
|
51
|
+
"@utaba/deep-memory": "0.18.0",
|
|
52
|
+
"@utaba/deep-memory-storage-sqlserver": "0.18.0",
|
|
53
|
+
"@utaba/deep-memory-embeddings-openai": "0.18.0",
|
|
54
|
+
"@utaba/deep-memory-storage-cosmosdb": "0.18.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^22.0.0",
|