@d365portal/d365fo-context-mcp 1.0.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.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * D365 Finance & Operations MCP Tool Definitions
3
+ *
4
+ * This module defines specialized MCP tools for all 60+ D365FO object types.
5
+ * Each tool enables semantic search within a specific object type folder.
6
+ */
7
+ interface ToolDefinition {
8
+ name: string;
9
+ description: string;
10
+ inputSchema: {
11
+ type: string;
12
+ properties: Record<string, any>;
13
+ required: string[];
14
+ };
15
+ }
16
+ export interface D365ObjectType {
17
+ type: string;
18
+ folder: string;
19
+ desc: string;
20
+ }
21
+ /**
22
+ * Complete registry of all D365FO object types
23
+ * Organized by layer: Data, Code, UI, Menu, Security, Workflow, Configuration, Resources, Analytics, Integration, Miscellaneous
24
+ */
25
+ export declare const D365_OBJECT_TYPES: D365ObjectType[];
26
+ /**
27
+ * Generate all D365 context tool definitions
28
+ */
29
+ export declare const D365_CONTEXT_TOOLS: ToolDefinition[];
30
+ /**
31
+ * Relationship analysis tool definition
32
+ */
33
+ export declare const D365_RELATIONSHIP_TOOL: ToolDefinition;
34
+ /**
35
+ * Combined array of all D365 MCP tools
36
+ */
37
+ export declare const D365_TOOLS: ToolDefinition[];
38
+ /**
39
+ * Helper to find object type configuration by tool name
40
+ */
41
+ export declare function findObjectTypeByToolName(toolName: string): D365ObjectType | undefined;
42
+ /**
43
+ * Helper to check if a tool name is a D365 tool
44
+ */
45
+ export declare function isD365Tool(toolName: string): boolean;
46
+ export {};
47
+ //# sourceMappingURL=d365-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d365-tools.d.ts","sourceRoot":"","sources":["../src/d365-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,UAAU,cAAc;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;CACL;AAGD,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAwG7C,CAAC;AAoCF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAE9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,cAwBpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,cAAc,EAGtC,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAMrF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKpD"}
@@ -0,0 +1,194 @@
1
+ /**
2
+ * D365 Finance & Operations MCP Tool Definitions
3
+ *
4
+ * This module defines specialized MCP tools for all 60+ D365FO object types.
5
+ * Each tool enables semantic search within a specific object type folder.
6
+ */
7
+ /**
8
+ * Complete registry of all D365FO object types
9
+ * Organized by layer: Data, Code, UI, Menu, Security, Workflow, Configuration, Resources, Analytics, Integration, Miscellaneous
10
+ */
11
+ export const D365_OBJECT_TYPES = [
12
+ // ============================================
13
+ // Data Layer Objects
14
+ // ============================================
15
+ { type: "table", folder: "AxTable", desc: "database tables and entities" },
16
+ { type: "view", folder: "AxView", desc: "database views" },
17
+ { type: "dataentity", folder: "AxDataEntity", desc: "OData data entities" },
18
+ { type: "edt", folder: "AxEdt", desc: "Extended Data Types" },
19
+ { type: "enum", folder: "AxEnum", desc: "enumerations" },
20
+ { type: "query", folder: "AxQuery", desc: "reusable query definitions" },
21
+ { type: "tableext", folder: "AxTableExt", desc: "table extensions" },
22
+ { type: "viewext", folder: "AxViewExt", desc: "view extensions" },
23
+ { type: "dataentityext", folder: "AxDataEntityExt", desc: "data entity extensions" },
24
+ { type: "aggrdataenty", folder: "AxAggrDataEnty", desc: "aggregate data entities" },
25
+ { type: "aggmeasure", folder: "AxAggMsrmnt", desc: "aggregate measurements" },
26
+ { type: "compviewdef", folder: "AxCompViewDef", desc: "composite view definitions" },
27
+ // ============================================
28
+ // Code Layer Objects
29
+ // ============================================
30
+ { type: "class", folder: "AxClass", desc: "X++ classes with business logic" },
31
+ { type: "classext", folder: "AxClassExt", desc: "class extensions" },
32
+ { type: "map", folder: "AxMap", desc: "X++ interface maps" },
33
+ { type: "mapext", folder: "AxMapExt", desc: "map extensions" },
34
+ { type: "service", folder: "AxService", desc: "web service definitions" },
35
+ { type: "servicegrp", folder: "AxServiceGrp", desc: "service groups" },
36
+ { type: "delegate", folder: "AxDelegate", desc: "delegate definitions" },
37
+ // ============================================
38
+ // UI Layer Objects
39
+ // ============================================
40
+ { type: "form", folder: "AxForm", desc: "user interface forms" },
41
+ { type: "formext", folder: "AxFormExt", desc: "form extensions" },
42
+ { type: "report", folder: "AxReport", desc: "SSRS report definitions" },
43
+ { type: "reportext", folder: "AxReportExt", desc: "report extensions" },
44
+ { type: "ssrsrdl", folder: "AxSsrsRDL", desc: "SSRS RDL report files" },
45
+ { type: "tile", folder: "AxTile", desc: "workspace tiles" },
46
+ // ============================================
47
+ // Menu Objects
48
+ // ============================================
49
+ { type: "menu", folder: "AxMenu", desc: "menu definitions" },
50
+ { type: "menuext", folder: "AxMenuExt", desc: "menu extensions" },
51
+ { type: "menuitemact", folder: "AxMenuItemAct", desc: "action menu items" },
52
+ { type: "menuitemdsp", folder: "AxMenuItemDsp", desc: "display menu items" },
53
+ { type: "menuitemout", folder: "AxMenuItemOut", desc: "output menu items" },
54
+ { type: "menuitemactext", folder: "AxMenuItemActExt", desc: "action menu item extensions" },
55
+ { type: "menuitemdspext", folder: "AxMenuItemDspExt", desc: "display menu item extensions" },
56
+ { type: "menuitemoutext", folder: "AxMenuItemOutExt", desc: "output menu item extensions" },
57
+ // ============================================
58
+ // Security Objects
59
+ // ============================================
60
+ { type: "secpol", folder: "AxSecPol", desc: "security policies" },
61
+ { type: "secpriv", folder: "AxSecPriv", desc: "security privileges" },
62
+ { type: "secrole", folder: "AxSecRole", desc: "security roles" },
63
+ { type: "secduty", folder: "AxSecDuty", desc: "security duties" },
64
+ { type: "secpolext", folder: "AxSecPolExt", desc: "security policy extensions" },
65
+ // ============================================
66
+ // Workflow Objects
67
+ // ============================================
68
+ { type: "workflow", folder: "AxWorkflow", desc: "workflow definitions" },
69
+ { type: "workflowcat", folder: "AxWorkflowCat", desc: "workflow categories" },
70
+ { type: "workflowapproval", folder: "AxWorkflowApproval", desc: "workflow approvals" },
71
+ { type: "workflowtask", folder: "AxWorkflowTask", desc: "workflow tasks" },
72
+ { type: "workflowdecision", folder: "AxWorkflowDecision", desc: "workflow decisions" },
73
+ // ============================================
74
+ // Configuration Objects
75
+ // ============================================
76
+ { type: "config", folder: "AxConfig", desc: "configuration keys" },
77
+ { type: "configext", folder: "AxConfigExt", desc: "configuration key extensions" },
78
+ { type: "liccode", folder: "AxLicCode", desc: "license codes" },
79
+ { type: "liccodeext", folder: "AxLicCodeExt", desc: "license code extensions" },
80
+ // ============================================
81
+ // Resource Objects
82
+ // ============================================
83
+ { type: "resource", folder: "AxResource", desc: "embedded resources" },
84
+ { type: "label", folder: "AxLabelFile", desc: "label files (translations)" },
85
+ // ============================================
86
+ // Analytics Objects
87
+ // ============================================
88
+ { type: "kpi", folder: "AxKPI", desc: "Key Performance Indicators" },
89
+ { type: "perspctv", folder: "AxPerspctv", desc: "perspectives" },
90
+ { type: "sharedproj", folder: "AxSharedProj", desc: "shared projects" },
91
+ // ============================================
92
+ // Integration Objects
93
+ // ============================================
94
+ { type: "composite", folder: "AxComposite", desc: "composite entities" },
95
+ { type: "businessevent", folder: "AxBusinessEvent", desc: "business events" },
96
+ { type: "businessevtcat", folder: "AxBusinessEvtCat", desc: "business event categories" },
97
+ // ============================================
98
+ // Miscellaneous Objects
99
+ // ============================================
100
+ { type: "tablegroup", folder: "AxTableGroup", desc: "table groups" },
101
+ { type: "tablerelation", folder: "AxTableRel", desc: "table relations" },
102
+ { type: "index", folder: "AxIndex", desc: "table indexes" },
103
+ { type: "fulltext", folder: "AxFullText", desc: "full-text indexes" },
104
+ { type: "reference", folder: "AxReference", desc: "reference definitions" },
105
+ ];
106
+ /**
107
+ * Factory function to generate a D365 context tool definition
108
+ */
109
+ function createD365Tool(objectType, folderName, description) {
110
+ const capitalizedDesc = description.charAt(0).toUpperCase() + description.slice(1);
111
+ return {
112
+ name: `d365_${objectType}_context`,
113
+ description: `Search for ${description} examples and patterns in Dynamics 365 F&O codebase. Use when creating, reviewing, or modifying ${folderName} objects.\n\n` +
114
+ `**When to use**: Before implementing new ${folderName} objects, to find similar implementations and understand common patterns.\n\n` +
115
+ `**Returns**: ${capitalizedDesc} examples with code snippets, structural patterns, and best practices.`,
116
+ inputSchema: {
117
+ type: "object",
118
+ properties: {
119
+ query: {
120
+ type: "string",
121
+ description: `Natural language description of the ${description} functionality you need. Be specific about the business logic, field types, or patterns you're looking for.`
122
+ },
123
+ topK: {
124
+ type: "number",
125
+ description: "Number of examples to return (default: 5, max: 20)",
126
+ default: 5
127
+ },
128
+ includePatterns: {
129
+ type: "boolean",
130
+ description: "Include structural patterns analysis in the response (default: true)",
131
+ default: true
132
+ }
133
+ },
134
+ required: ["query"]
135
+ }
136
+ };
137
+ }
138
+ /**
139
+ * Generate all D365 context tool definitions
140
+ */
141
+ export const D365_CONTEXT_TOOLS = D365_OBJECT_TYPES.map(({ type, folder, desc }) => createD365Tool(type, folder, desc));
142
+ /**
143
+ * Relationship analysis tool definition
144
+ */
145
+ export const D365_RELATIONSHIP_TOOL = {
146
+ name: "d365_relationship_analysis",
147
+ description: `Analyze dependencies and relationships between Dynamics 365 F&O objects. Use to understand how objects connect and depend on each other.\n\n` +
148
+ `**When to use**: Before modifying an object to understand impact, or when designing new objects that need to integrate with existing ones.\n\n` +
149
+ `**Returns**: List of related objects grouped by type, showing which objects reference the specified object.`,
150
+ inputSchema: {
151
+ type: "object",
152
+ properties: {
153
+ objectName: {
154
+ type: "string",
155
+ description: "Name of the D365 object to analyze (e.g., 'CustTable', 'SalesOrder')"
156
+ },
157
+ objectType: {
158
+ type: "string",
159
+ description: "Type of object (e.g., 'AxClass', 'AxTable', 'AxForm'). Use the folder name format."
160
+ },
161
+ depth: {
162
+ type: "number",
163
+ description: "Depth of relationship analysis - how many levels of dependencies to explore (default: 2, max: 5)",
164
+ default: 2
165
+ }
166
+ },
167
+ required: ["objectName", "objectType"]
168
+ }
169
+ };
170
+ /**
171
+ * Combined array of all D365 MCP tools
172
+ */
173
+ export const D365_TOOLS = [
174
+ ...D365_CONTEXT_TOOLS,
175
+ D365_RELATIONSHIP_TOOL
176
+ ];
177
+ /**
178
+ * Helper to find object type configuration by tool name
179
+ */
180
+ export function findObjectTypeByToolName(toolName) {
181
+ const match = toolName.match(/^d365_(\w+)_context$/);
182
+ if (!match)
183
+ return undefined;
184
+ const typeKey = match[1];
185
+ return D365_OBJECT_TYPES.find(t => t.type === typeKey);
186
+ }
187
+ /**
188
+ * Helper to check if a tool name is a D365 tool
189
+ */
190
+ export function isD365Tool(toolName) {
191
+ return toolName.startsWith('d365_') && (toolName.endsWith('_context') ||
192
+ toolName === 'd365_relationship_analysis');
193
+ }
194
+ //# sourceMappingURL=d365-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d365-tools.js","sourceRoot":"","sources":["../src/d365-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqB;IAC/C,+CAA+C;IAC/C,qBAAqB;IACrB,+CAA+C;IAC/C,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,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rD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAE7B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACvC,OAAO,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CACnC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC7B,QAAQ,KAAK,4BAA4B,CAC5C,CAAC;AACN,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { OpenAIEmbedding, VoyageAIEmbedding, GeminiEmbedding, OllamaEmbedding } from "@d365portal/d365fo-context-core";
2
+ import { ContextMcpConfig } from "./config.js";
3
+ export declare function createEmbeddingInstance(config: ContextMcpConfig): OpenAIEmbedding | VoyageAIEmbedding | GeminiEmbedding | OllamaEmbedding;
4
+ export declare function logEmbeddingProviderInfo(config: ContextMcpConfig, embedding: OpenAIEmbedding | VoyageAIEmbedding | GeminiEmbedding | OllamaEmbedding): void;
5
+ //# sourceMappingURL=embedding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../src/embedding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,eAAe,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,CA2DzI;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,GAAG,IAAI,CAmB3J"}
@@ -0,0 +1,77 @@
1
+ import { OpenAIEmbedding, VoyageAIEmbedding, GeminiEmbedding, OllamaEmbedding } from "@d365portal/d365fo-context-core";
2
+ // Helper function to create embedding instance based on provider
3
+ export function createEmbeddingInstance(config) {
4
+ console.log(`[EMBEDDING] Creating ${config.embeddingProvider} embedding instance...`);
5
+ switch (config.embeddingProvider) {
6
+ case 'OpenAI':
7
+ if (!config.openaiApiKey) {
8
+ console.error(`[EMBEDDING] ❌ OpenAI API key is required but not provided`);
9
+ throw new Error('OPENAI_API_KEY is required for OpenAI embedding provider');
10
+ }
11
+ console.log(`[EMBEDDING] 🔧 Configuring OpenAI with model: ${config.embeddingModel}`);
12
+ const openaiEmbedding = new OpenAIEmbedding({
13
+ apiKey: config.openaiApiKey,
14
+ model: config.embeddingModel,
15
+ ...(config.openaiBaseUrl && { baseURL: config.openaiBaseUrl })
16
+ });
17
+ console.log(`[EMBEDDING] ✅ OpenAI embedding instance created successfully`);
18
+ return openaiEmbedding;
19
+ case 'VoyageAI':
20
+ if (!config.voyageaiApiKey) {
21
+ console.error(`[EMBEDDING] ❌ VoyageAI API key is required but not provided`);
22
+ throw new Error('VOYAGEAI_API_KEY is required for VoyageAI embedding provider');
23
+ }
24
+ console.log(`[EMBEDDING] 🔧 Configuring VoyageAI with model: ${config.embeddingModel}`);
25
+ const voyageEmbedding = new VoyageAIEmbedding({
26
+ apiKey: config.voyageaiApiKey,
27
+ model: config.embeddingModel
28
+ });
29
+ console.log(`[EMBEDDING] ✅ VoyageAI embedding instance created successfully`);
30
+ return voyageEmbedding;
31
+ case 'Gemini':
32
+ if (!config.geminiApiKey) {
33
+ console.error(`[EMBEDDING] ❌ Gemini API key is required but not provided`);
34
+ throw new Error('GEMINI_API_KEY is required for Gemini embedding provider');
35
+ }
36
+ console.log(`[EMBEDDING] 🔧 Configuring Gemini with model: ${config.embeddingModel}`);
37
+ const geminiEmbedding = new GeminiEmbedding({
38
+ apiKey: config.geminiApiKey,
39
+ model: config.embeddingModel,
40
+ ...(config.geminiBaseUrl && { baseURL: config.geminiBaseUrl })
41
+ });
42
+ console.log(`[EMBEDDING] ✅ Gemini embedding instance created successfully`);
43
+ return geminiEmbedding;
44
+ case 'Ollama':
45
+ const ollamaHost = config.ollamaHost || 'http://127.0.0.1:11434';
46
+ console.log(`[EMBEDDING] 🔧 Configuring Ollama with model: ${config.embeddingModel}, host: ${ollamaHost}`);
47
+ const ollamaEmbedding = new OllamaEmbedding({
48
+ model: config.embeddingModel,
49
+ host: config.ollamaHost
50
+ });
51
+ console.log(`[EMBEDDING] ✅ Ollama embedding instance created successfully`);
52
+ return ollamaEmbedding;
53
+ default:
54
+ console.error(`[EMBEDDING] ❌ Unsupported embedding provider: ${config.embeddingProvider}`);
55
+ throw new Error(`Unsupported embedding provider: ${config.embeddingProvider}`);
56
+ }
57
+ }
58
+ export function logEmbeddingProviderInfo(config, embedding) {
59
+ console.log(`[EMBEDDING] ✅ Successfully initialized ${config.embeddingProvider} embedding provider`);
60
+ console.log(`[EMBEDDING] Provider details - Model: ${config.embeddingModel}, Dimension: ${embedding.getDimension()}`);
61
+ // Log provider-specific configuration details
62
+ switch (config.embeddingProvider) {
63
+ case 'OpenAI':
64
+ console.log(`[EMBEDDING] OpenAI configuration - API Key: ${config.openaiApiKey ? '✅ Provided' : '❌ Missing'}, Base URL: ${config.openaiBaseUrl || 'Default'}`);
65
+ break;
66
+ case 'VoyageAI':
67
+ console.log(`[EMBEDDING] VoyageAI configuration - API Key: ${config.voyageaiApiKey ? '✅ Provided' : '❌ Missing'}`);
68
+ break;
69
+ case 'Gemini':
70
+ console.log(`[EMBEDDING] Gemini configuration - API Key: ${config.geminiApiKey ? '✅ Provided' : '❌ Missing'}, Base URL: ${config.geminiBaseUrl || 'Default'}`);
71
+ break;
72
+ case 'Ollama':
73
+ console.log(`[EMBEDDING] Ollama configuration - Host: ${config.ollamaHost || 'http://127.0.0.1:11434'}, Model: ${config.embeddingModel}`);
74
+ break;
75
+ }
76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,KAAK,CAAC,mCAAmC,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACvF,CAAC;AACL,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAwB,EAAE,SAAkF;IACjJ,OAAO,CAAC,GAAG,CAAC,0CAA0C,MAAM,CAAC,iBAAiB,qBAAqB,CAAC,CAAC;IACrG,OAAO,CAAC,GAAG,CAAC,yCAAyC,MAAM,CAAC,cAAc,gBAAgB,SAAS,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAEtH,8CAA8C;IAC9C,QAAQ,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC/B,KAAK,QAAQ;YACT,OAAO,CAAC,GAAG,CAAC,+CAA+C,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,eAAe,MAAM,CAAC,aAAa,IAAI,SAAS,EAAE,CAAC,CAAC;YAC/J,MAAM;QACV,KAAK,UAAU;YACX,OAAO,CAAC,GAAG,CAAC,iDAAiD,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YACnH,MAAM;QACV,KAAK,QAAQ;YACT,OAAO,CAAC,GAAG,CAAC,+CAA+C,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,eAAe,MAAM,CAAC,aAAa,IAAI,SAAS,EAAE,CAAC,CAAC;YAC/J,MAAM;QACV,KAAK,QAAQ;YACT,OAAO,CAAC,GAAG,CAAC,4CAA4C,MAAM,CAAC,UAAU,IAAI,wBAAwB,YAAY,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;YAC1I,MAAM;IACd,CAAC;AACL,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { Context } from "@d365portal/d365fo-context-core";
2
+ import { SnapshotManager } from "./snapshot.js";
3
+ export declare class ToolHandlers {
4
+ private context;
5
+ private snapshotManager;
6
+ private indexingStats;
7
+ private currentWorkspace;
8
+ constructor(context: Context, snapshotManager: SnapshotManager);
9
+ /**
10
+ * Sync indexed codebases from Zilliz Cloud collections
11
+ * This method fetches all collections from the vector database,
12
+ * gets the first document from each collection to extract codebasePath from metadata,
13
+ * and updates the snapshot with discovered codebases.
14
+ *
15
+ * Logic: Compare mcp-codebase-snapshot.json with zilliz cloud collections
16
+ * - If local snapshot has extra directories (not in cloud), remove them
17
+ * - If local snapshot is missing directories (exist in cloud), ignore them
18
+ */
19
+ private syncIndexedCodebasesFromCloud;
20
+ handleIndexCodebase(args: any): Promise<{
21
+ content: {
22
+ type: string;
23
+ text: string;
24
+ }[];
25
+ isError: boolean;
26
+ } | {
27
+ content: {
28
+ type: string;
29
+ text: string;
30
+ }[];
31
+ isError?: undefined;
32
+ }>;
33
+ private startBackgroundIndexing;
34
+ handleSearchCode(args: any): Promise<{
35
+ content: {
36
+ type: string;
37
+ text: string;
38
+ }[];
39
+ isError: boolean;
40
+ } | {
41
+ content: {
42
+ type: string;
43
+ text: string;
44
+ }[];
45
+ isError?: undefined;
46
+ }>;
47
+ handleClearIndex(args: any): Promise<{
48
+ content: {
49
+ type: string;
50
+ text: string;
51
+ }[];
52
+ isError?: undefined;
53
+ } | {
54
+ content: {
55
+ type: string;
56
+ text: string;
57
+ }[];
58
+ isError: boolean;
59
+ }>;
60
+ handleGetIndexingStatus(args: any): Promise<{
61
+ content: {
62
+ type: string;
63
+ text: string;
64
+ }[];
65
+ isError: boolean;
66
+ } | {
67
+ content: {
68
+ type: string;
69
+ text: string;
70
+ }[];
71
+ isError?: undefined;
72
+ }>;
73
+ }
74
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAA4B,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,qBAAa,YAAY;IACrB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAA8D;IACnF,OAAO,CAAC,gBAAgB,CAAS;gBAErB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe;IAO9D;;;;;;;;;OASG;YACW,6BAA6B;IAiH9B,mBAAmB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;;YAoL5B,uBAAuB;IA0FxB,gBAAgB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;;IA6J1B,gBAAgB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;;IAwH1B,uBAAuB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;;CA6GjD"}