@grafema/mcp 0.2.12-beta → 0.3.0-beta

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.
Files changed (158) hide show
  1. package/dist/analysis-worker.d.ts +4 -3
  2. package/dist/analysis-worker.d.ts.map +1 -1
  3. package/dist/analysis-worker.js +8 -203
  4. package/dist/analysis-worker.js.map +1 -1
  5. package/dist/analysis.d.ts +10 -3
  6. package/dist/analysis.d.ts.map +1 -1
  7. package/dist/analysis.js +130 -62
  8. package/dist/analysis.js.map +1 -1
  9. package/dist/config.d.ts +5 -11
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +6 -128
  12. package/dist/config.js.map +1 -1
  13. package/dist/definitions/analysis-tools.d.ts +6 -0
  14. package/dist/definitions/analysis-tools.d.ts.map +1 -0
  15. package/dist/definitions/analysis-tools.js +125 -0
  16. package/dist/definitions/analysis-tools.js.map +1 -0
  17. package/dist/definitions/context-tools.d.ts +6 -0
  18. package/dist/definitions/context-tools.d.ts.map +1 -0
  19. package/dist/definitions/context-tools.js +144 -0
  20. package/dist/definitions/context-tools.js.map +1 -0
  21. package/dist/definitions/graph-tools.d.ts +7 -0
  22. package/dist/definitions/graph-tools.d.ts.map +1 -0
  23. package/dist/definitions/graph-tools.js +124 -0
  24. package/dist/definitions/graph-tools.js.map +1 -0
  25. package/dist/definitions/graphql-tools.d.ts +6 -0
  26. package/dist/definitions/graphql-tools.d.ts.map +1 -0
  27. package/dist/definitions/graphql-tools.js +62 -0
  28. package/dist/definitions/graphql-tools.js.map +1 -0
  29. package/dist/definitions/guarantee-tools.d.ts +6 -0
  30. package/dist/definitions/guarantee-tools.d.ts.map +1 -0
  31. package/dist/definitions/guarantee-tools.js +136 -0
  32. package/dist/definitions/guarantee-tools.js.map +1 -0
  33. package/dist/definitions/index.d.ts +7 -0
  34. package/dist/definitions/index.d.ts.map +1 -0
  35. package/dist/definitions/index.js +24 -0
  36. package/dist/definitions/index.js.map +1 -0
  37. package/dist/definitions/knowledge-tools.d.ts +10 -0
  38. package/dist/definitions/knowledge-tools.d.ts.map +1 -0
  39. package/dist/definitions/knowledge-tools.js +300 -0
  40. package/dist/definitions/knowledge-tools.js.map +1 -0
  41. package/dist/definitions/notation-tools.d.ts +9 -0
  42. package/dist/definitions/notation-tools.d.ts.map +1 -0
  43. package/dist/definitions/notation-tools.js +62 -0
  44. package/dist/definitions/notation-tools.js.map +1 -0
  45. package/dist/definitions/project-tools.d.ts +6 -0
  46. package/dist/definitions/project-tools.d.ts.map +1 -0
  47. package/dist/definitions/project-tools.js +181 -0
  48. package/dist/definitions/project-tools.js.map +1 -0
  49. package/dist/definitions/query-tools.d.ts +6 -0
  50. package/dist/definitions/query-tools.d.ts.map +1 -0
  51. package/dist/definitions/query-tools.js +245 -0
  52. package/dist/definitions/query-tools.js.map +1 -0
  53. package/dist/definitions/types.d.ts +21 -0
  54. package/dist/definitions/types.d.ts.map +1 -0
  55. package/dist/definitions/types.js +5 -0
  56. package/dist/definitions/types.js.map +1 -0
  57. package/dist/dev-proxy.d.ts +29 -0
  58. package/dist/dev-proxy.d.ts.map +1 -0
  59. package/dist/dev-proxy.js +267 -0
  60. package/dist/dev-proxy.js.map +1 -0
  61. package/dist/handlers/analysis-handlers.d.ts.map +1 -1
  62. package/dist/handlers/analysis-handlers.js +34 -4
  63. package/dist/handlers/analysis-handlers.js.map +1 -1
  64. package/dist/handlers/context-handlers.d.ts +5 -6
  65. package/dist/handlers/context-handlers.d.ts.map +1 -1
  66. package/dist/handlers/context-handlers.js +19 -16
  67. package/dist/handlers/context-handlers.js.map +1 -1
  68. package/dist/handlers/coverage-handlers.js +1 -1
  69. package/dist/handlers/dataflow-handlers.d.ts +2 -0
  70. package/dist/handlers/dataflow-handlers.d.ts.map +1 -1
  71. package/dist/handlers/dataflow-handlers.js +68 -46
  72. package/dist/handlers/dataflow-handlers.js.map +1 -1
  73. package/dist/handlers/documentation-handlers.d.ts.map +1 -1
  74. package/dist/handlers/documentation-handlers.js +56 -2
  75. package/dist/handlers/documentation-handlers.js.map +1 -1
  76. package/dist/handlers/graph-handlers.d.ts +23 -0
  77. package/dist/handlers/graph-handlers.d.ts.map +1 -0
  78. package/dist/handlers/graph-handlers.js +155 -0
  79. package/dist/handlers/graph-handlers.js.map +1 -0
  80. package/dist/handlers/graphql-handlers.d.ts +9 -0
  81. package/dist/handlers/graphql-handlers.d.ts.map +1 -0
  82. package/dist/handlers/graphql-handlers.js +57 -0
  83. package/dist/handlers/graphql-handlers.js.map +1 -0
  84. package/dist/handlers/guarantee-handlers.js +1 -1
  85. package/dist/handlers/guard-handlers.d.ts.map +1 -1
  86. package/dist/handlers/guard-handlers.js +6 -3
  87. package/dist/handlers/guard-handlers.js.map +1 -1
  88. package/dist/handlers/index.d.ts +4 -0
  89. package/dist/handlers/index.d.ts.map +1 -1
  90. package/dist/handlers/index.js +6 -0
  91. package/dist/handlers/index.js.map +1 -1
  92. package/dist/handlers/issue-handlers.d.ts.map +1 -1
  93. package/dist/handlers/issue-handlers.js +10 -15
  94. package/dist/handlers/issue-handlers.js.map +1 -1
  95. package/dist/handlers/knowledge-handlers.d.ts +25 -0
  96. package/dist/handlers/knowledge-handlers.d.ts.map +1 -0
  97. package/dist/handlers/knowledge-handlers.js +208 -0
  98. package/dist/handlers/knowledge-handlers.js.map +1 -0
  99. package/dist/handlers/notation-handlers.d.ts +6 -0
  100. package/dist/handlers/notation-handlers.d.ts.map +1 -0
  101. package/dist/handlers/notation-handlers.js +53 -0
  102. package/dist/handlers/notation-handlers.js.map +1 -0
  103. package/dist/handlers/project-handlers.js +1 -1
  104. package/dist/handlers/query-handlers.d.ts.map +1 -1
  105. package/dist/handlers/query-handlers.js +166 -20
  106. package/dist/handlers/query-handlers.js.map +1 -1
  107. package/dist/prompts.js +1 -1
  108. package/dist/server.d.ts +19 -1
  109. package/dist/server.d.ts.map +1 -1
  110. package/dist/server.js +93 -3
  111. package/dist/server.js.map +1 -1
  112. package/dist/state.d.ts +10 -1
  113. package/dist/state.d.ts.map +1 -1
  114. package/dist/state.js +61 -8
  115. package/dist/state.js.map +1 -1
  116. package/dist/types.d.ts +75 -3
  117. package/dist/types.d.ts.map +1 -1
  118. package/dist/utils.d.ts +4 -0
  119. package/dist/utils.d.ts.map +1 -1
  120. package/dist/utils.js +18 -1
  121. package/dist/utils.js.map +1 -1
  122. package/package.json +4 -3
  123. package/src/analysis-worker.ts +9 -301
  124. package/src/analysis.ts +151 -77
  125. package/src/config.ts +6 -193
  126. package/src/definitions/analysis-tools.ts +127 -0
  127. package/src/definitions/context-tools.ts +147 -0
  128. package/src/definitions/graph-tools.ts +126 -0
  129. package/src/definitions/graphql-tools.ts +64 -0
  130. package/src/definitions/guarantee-tools.ts +138 -0
  131. package/src/definitions/index.ts +28 -0
  132. package/src/definitions/knowledge-tools.ts +302 -0
  133. package/src/definitions/notation-tools.ts +64 -0
  134. package/src/definitions/project-tools.ts +183 -0
  135. package/src/definitions/query-tools.ts +247 -0
  136. package/src/definitions/types.ts +22 -0
  137. package/src/dev-proxy.ts +336 -0
  138. package/src/handlers/analysis-handlers.ts +35 -4
  139. package/src/handlers/context-handlers.ts +19 -15
  140. package/src/handlers/coverage-handlers.ts +1 -1
  141. package/src/handlers/dataflow-handlers.ts +74 -56
  142. package/src/handlers/documentation-handlers.ts +56 -2
  143. package/src/handlers/graph-handlers.ts +212 -0
  144. package/src/handlers/graphql-handlers.ts +70 -0
  145. package/src/handlers/guarantee-handlers.ts +1 -1
  146. package/src/handlers/guard-handlers.ts +7 -3
  147. package/src/handlers/index.ts +6 -0
  148. package/src/handlers/issue-handlers.ts +10 -15
  149. package/src/handlers/knowledge-handlers.ts +242 -0
  150. package/src/handlers/notation-handlers.ts +71 -0
  151. package/src/handlers/project-handlers.ts +1 -1
  152. package/src/handlers/query-handlers.ts +186 -22
  153. package/src/prompts.ts +1 -1
  154. package/src/server.ts +126 -2
  155. package/src/state.ts +68 -8
  156. package/src/types.ts +98 -3
  157. package/src/utils.ts +22 -1
  158. package/src/definitions.ts +0 -665
package/dist/config.js CHANGED
@@ -1,81 +1,25 @@
1
1
  /**
2
2
  * MCP Server Configuration
3
+ *
4
+ * Loads grafema config via the shared loader from @grafema/util.
5
+ * Plugin instantiation is no longer needed — grafema-orchestrator handles analysis.
3
6
  */
4
- import { join } from 'path';
5
- import { existsSync, readdirSync } from 'fs';
6
- import { pathToFileURL } from 'url';
7
7
  import { log } from './utils.js';
8
- import { loadConfig as loadConfigFromCore } from '@grafema/core';
9
- // === PLUGIN IMPORTS ===
10
- import {
11
- // Indexing
12
- JSModuleIndexer, RustModuleIndexer,
13
- // Analysis
14
- JSASTAnalyzer, ExpressRouteAnalyzer, ExpressResponseAnalyzer, NestJSRouteAnalyzer, SocketIOAnalyzer, DatabaseAnalyzer, FetchAnalyzer, SocketAnalyzer, ServiceLayerAnalyzer, ReactAnalyzer, RustAnalyzer,
15
- // Enrichment
16
- MethodCallResolver, ArgumentParameterLinker, AliasTracker, ClosureCaptureEnricher, ValueDomainAnalyzer, MountPointResolver, ExpressHandlerLinker, PrefixEvaluator, ImportExportLinker, InstanceOfResolver, HTTPConnectionEnricher, CallbackCallResolver, SocketConnectionEnricher, ConfigRoutingMapBuilder, ServiceConnectionEnricher, RustFFIEnricher, RejectionPropagationEnricher,
17
- // Validation
18
- CallResolverValidator, EvalBanValidator, SQLInjectionValidator, AwaitInLoopValidator, ShadowingDetector, GraphConnectivityValidator, DataFlowValidator, TypeScriptDeadCodeValidator, BrokenImportValidator, UnconnectedRouteValidator, } from '@grafema/core';
8
+ import { loadConfig as loadConfigFromUtil } from '@grafema/util';
19
9
  const MCP_DEFAULTS = {
20
10
  discovery: {
21
11
  enabled: true,
22
12
  customOnly: false,
23
13
  },
24
14
  };
25
- export const BUILTIN_PLUGINS = {
26
- // Indexing
27
- JSModuleIndexer: () => new JSModuleIndexer(),
28
- RustModuleIndexer: () => new RustModuleIndexer(),
29
- // Analysis
30
- JSASTAnalyzer: () => new JSASTAnalyzer(),
31
- ExpressRouteAnalyzer: () => new ExpressRouteAnalyzer(),
32
- ExpressResponseAnalyzer: () => new ExpressResponseAnalyzer(),
33
- NestJSRouteAnalyzer: () => new NestJSRouteAnalyzer(),
34
- SocketIOAnalyzer: () => new SocketIOAnalyzer(),
35
- DatabaseAnalyzer: () => new DatabaseAnalyzer(),
36
- FetchAnalyzer: () => new FetchAnalyzer(),
37
- SocketAnalyzer: () => new SocketAnalyzer(),
38
- ServiceLayerAnalyzer: () => new ServiceLayerAnalyzer(),
39
- ReactAnalyzer: () => new ReactAnalyzer(),
40
- RustAnalyzer: () => new RustAnalyzer(),
41
- // Enrichment
42
- MethodCallResolver: () => new MethodCallResolver(),
43
- ArgumentParameterLinker: () => new ArgumentParameterLinker(),
44
- AliasTracker: () => new AliasTracker(),
45
- ClosureCaptureEnricher: () => new ClosureCaptureEnricher(),
46
- ValueDomainAnalyzer: () => new ValueDomainAnalyzer(),
47
- MountPointResolver: () => new MountPointResolver(),
48
- ExpressHandlerLinker: () => new ExpressHandlerLinker(),
49
- PrefixEvaluator: () => new PrefixEvaluator(),
50
- ImportExportLinker: () => new ImportExportLinker(),
51
- InstanceOfResolver: () => new InstanceOfResolver(),
52
- HTTPConnectionEnricher: () => new HTTPConnectionEnricher(),
53
- CallbackCallResolver: () => new CallbackCallResolver(),
54
- SocketConnectionEnricher: () => new SocketConnectionEnricher(),
55
- ConfigRoutingMapBuilder: () => new ConfigRoutingMapBuilder(),
56
- ServiceConnectionEnricher: () => new ServiceConnectionEnricher(),
57
- RustFFIEnricher: () => new RustFFIEnricher(),
58
- RejectionPropagationEnricher: () => new RejectionPropagationEnricher(),
59
- // Validation
60
- CallResolverValidator: () => new CallResolverValidator(),
61
- EvalBanValidator: () => new EvalBanValidator(),
62
- SQLInjectionValidator: () => new SQLInjectionValidator(),
63
- AwaitInLoopValidator: () => new AwaitInLoopValidator(),
64
- ShadowingDetector: () => new ShadowingDetector(),
65
- GraphConnectivityValidator: () => new GraphConnectivityValidator(),
66
- DataFlowValidator: () => new DataFlowValidator(),
67
- TypeScriptDeadCodeValidator: () => new TypeScriptDeadCodeValidator(),
68
- BrokenImportValidator: () => new BrokenImportValidator(),
69
- UnconnectedRouteValidator: () => new UnconnectedRouteValidator(),
70
- };
71
15
  // === CONFIG LOADING ===
72
16
  /**
73
17
  * Load MCP configuration (extends base GrafemaConfig).
74
- * Uses shared ConfigLoader but adds MCP-specific defaults.
18
+ * Uses shared loader but adds MCP-specific defaults.
75
19
  */
76
20
  export function loadConfig(projectPath) {
77
21
  // Use shared loader (handles YAML/JSON, deprecation warnings)
78
- const baseConfig = loadConfigFromCore(projectPath, {
22
+ const baseConfig = loadConfigFromUtil(projectPath, {
79
23
  warn: (msg) => log(`[Grafema MCP] ${msg}`),
80
24
  });
81
25
  // Add MCP-specific defaults
@@ -84,70 +28,4 @@ export function loadConfig(projectPath) {
84
28
  ...MCP_DEFAULTS,
85
29
  };
86
30
  }
87
- export async function loadCustomPlugins(projectPath) {
88
- const pluginsDir = join(projectPath, '.grafema', 'plugins');
89
- if (!existsSync(pluginsDir)) {
90
- return { plugins: [], pluginMap: {} };
91
- }
92
- const customPlugins = [];
93
- const pluginMap = {};
94
- try {
95
- const files = readdirSync(pluginsDir).filter((f) => f.endsWith('.js') || f.endsWith('.mjs'));
96
- for (const file of files) {
97
- try {
98
- const pluginPath = join(pluginsDir, file);
99
- const pluginUrl = pathToFileURL(pluginPath).href;
100
- const module = await import(pluginUrl);
101
- const PluginClass = module.default || module[file.replace(/\.(m?js)$/, '')];
102
- if (PluginClass && typeof PluginClass === 'function') {
103
- const pluginName = PluginClass.name || file.replace(/\.(m?js)$/, '');
104
- const instance = new PluginClass();
105
- if (instance.config) {
106
- instance.config.sourceFile = pluginPath;
107
- }
108
- customPlugins.push(instance);
109
- pluginMap[pluginName] = PluginClass;
110
- log(`[Grafema MCP] Loaded custom plugin: ${pluginName} from ${file}`);
111
- }
112
- }
113
- catch (err) {
114
- const message = err instanceof Error ? err.message : String(err);
115
- log(`[Grafema MCP] Failed to load plugin ${file}: ${message}`);
116
- }
117
- }
118
- }
119
- catch (err) {
120
- const message = err instanceof Error ? err.message : String(err);
121
- log(`[Grafema MCP] Error loading custom plugins: ${message}`);
122
- }
123
- return { plugins: customPlugins, pluginMap };
124
- }
125
- // === PLUGIN INSTANTIATION ===
126
- export function createPlugins(config, customPluginMap = {}) {
127
- const pluginNames = [
128
- ...config.indexing,
129
- ...config.analysis,
130
- ...config.enrichment,
131
- ...config.validation,
132
- ];
133
- const plugins = [];
134
- const availablePlugins = {
135
- ...BUILTIN_PLUGINS,
136
- ...Object.fromEntries(Object.entries(customPluginMap).map(([name, PluginClass]) => [
137
- name,
138
- () => new PluginClass(),
139
- ])),
140
- };
141
- for (const name of pluginNames) {
142
- const factory = availablePlugins[name];
143
- if (factory) {
144
- plugins.push(factory());
145
- log(`[Grafema MCP] Enabled plugin: ${name}`);
146
- }
147
- else {
148
- log(`[Grafema MCP] Plugin not found: ${name} (skipping)`);
149
- }
150
- }
151
- return plugins;
152
- }
153
31
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAsB,MAAM,eAAe,CAAC;AAErF,yBAAyB;AACzB,OAAO;AACL,WAAW;AACX,eAAe,EACf,iBAAiB;AACjB,WAAW;AACX,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,Y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,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAsB,MAAM,eAAe,CAAC;AAkBrF,MAAM,YAAY,GAAiC;IACjD,SAAS,EAAE;QACT,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,KAAK;KAClB;CACF,CAAC;AAEF,yBAAyB;AACzB;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,8DAA8D;IAC9D,MAAM,UAAU,GAAG,kBAAkB,CAAC,WAAW,EAAE;QACjD,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,iBAAiB,GAAG,EAAE,CAAC;KAC3C,CAAC,CAAC;IAEH,4BAA4B;IAC5B,OAAO;QACL,GAAG,UAAU;QACb,GAAG,YAAY;KAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Analysis Tools — project analysis and schema inspection
3
+ */
4
+ import type { ToolDefinition } from './types.js';
5
+ export declare const ANALYSIS_TOOLS: ToolDefinition[];
6
+ //# sourceMappingURL=analysis-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-tools.d.ts","sourceRoot":"","sources":["../../src/definitions/analysis-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,cAAc,EAAE,cAAc,EAwH1C,CAAC"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Analysis Tools — project analysis and schema inspection
3
+ */
4
+ export const ANALYSIS_TOOLS = [
5
+ {
6
+ name: 'discover_services',
7
+ description: `Discover services in the project without running full analysis.
8
+
9
+ Use this during onboarding to understand project structure BEFORE running analyze_project.
10
+
11
+ Returns:
12
+ - Service names and paths (e.g., "backend" at "apps/backend")
13
+ - Entry points (e.g., "src/index.ts")
14
+ - No graph data yet — this is fast discovery only
15
+
16
+ Workflow:
17
+ 1. discover_services — see what's in the project
18
+ 2. analyze_project — build graph for specific service or all
19
+ 3. Query tools — explore the graph
20
+
21
+ Tip: If project has no .grafema/config.yaml, this scans for common patterns
22
+ (package.json, index.ts, etc.). Use write_config to save the configuration.`,
23
+ inputSchema: {
24
+ type: 'object',
25
+ properties: {},
26
+ },
27
+ },
28
+ {
29
+ name: 'analyze_project',
30
+ description: `Build the code graph by analyzing project source code.
31
+
32
+ REQUIRED before using query tools. Without analysis, the graph is empty.
33
+
34
+ Options:
35
+ - service: Analyze only one service (faster for multi-service projects)
36
+ - force: Re-analyze even if graph exists (use after code changes)
37
+ - index_only: Fast mode — create MODULE nodes only, skip detailed analysis
38
+
39
+ Phases: Discovery → Indexing → Analysis → Enrichment → Validation
40
+ Returns: Analysis summary with node/edge counts and timing.
41
+
42
+ Tip: Use get_stats after analysis to verify graph was built successfully.`,
43
+ inputSchema: {
44
+ type: 'object',
45
+ properties: {
46
+ service: {
47
+ type: 'string',
48
+ description: 'Optional: analyze only this service',
49
+ },
50
+ force: {
51
+ type: 'boolean',
52
+ description: 'Force re-analysis even if already analyzed',
53
+ },
54
+ index_only: {
55
+ type: 'boolean',
56
+ description: 'Only index modules, skip full analysis',
57
+ },
58
+ },
59
+ },
60
+ },
61
+ {
62
+ name: 'get_analysis_status',
63
+ description: `Get the current analysis status and progress.
64
+
65
+ Use this to:
66
+ - Poll progress during long-running analysis (started by analyze_project)
67
+ - Check if analysis is still running before making queries
68
+ - See which phase is active (discovery, indexing, analysis, enrichment, validation)
69
+
70
+ Returns: { running: boolean, phase: string, progress: number, error: string | null }
71
+
72
+ Call this periodically after analyze_project to monitor progress.`,
73
+ inputSchema: {
74
+ type: 'object',
75
+ properties: {},
76
+ },
77
+ },
78
+ {
79
+ name: 'get_stats',
80
+ description: `Get graph statistics: node and edge counts by type.
81
+
82
+ Use this to:
83
+ - Verify analysis completed: nodeCount > 0 means the graph is loaded
84
+ - Understand graph size before running expensive queries
85
+ - See what node/edge types exist in this particular codebase
86
+ - Debug empty results: check if expected node types are present
87
+
88
+ Returns:
89
+ - nodeCount, edgeCount: Total counts
90
+ - nodesByType: {FUNCTION: 1234, CLASS: 56, ...}
91
+ - edgesByType: {CALLS: 5678, CONTAINS: 3456, ...}
92
+
93
+ Use BEFORE querying an unfamiliar graph to understand what data is available.`,
94
+ inputSchema: {
95
+ type: 'object',
96
+ properties: {},
97
+ },
98
+ },
99
+ {
100
+ name: 'get_schema',
101
+ description: `Get the graph schema: available node and edge types with counts.
102
+
103
+ Use this to:
104
+ - Discover what types exist: "What node types does this graph have?"
105
+ - Validate edge types before traverse_graph or get_neighbors
106
+ - Understand graph structure before writing Datalog queries
107
+ - Find correct type names (e.g., "http:route" not "HTTP_ROUTE")
108
+
109
+ Options:
110
+ - type: "nodes" (node types only), "edges" (edge types only), "all" (default)
111
+
112
+ Tip: Run this first when exploring a new graph to learn the available vocabulary.`,
113
+ inputSchema: {
114
+ type: 'object',
115
+ properties: {
116
+ type: {
117
+ type: 'string',
118
+ description: 'nodes, edges, or all (default: all)',
119
+ enum: ['nodes', 'edges', 'all'],
120
+ },
121
+ },
122
+ },
123
+ },
124
+ ];
125
+ //# sourceMappingURL=analysis-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-tools.js","sourceRoot":"","sources":["../../src/definitions/analysis-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,cAAc,GAAqB;IAC9C;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE;;;;;;;;;;;;;;;4EAe2D;QACxE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE;;;;;;;;;;;;0EAYyD;QACtE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qCAAqC;iBACnD;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,4CAA4C;iBAC1D;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,wCAAwC;iBACtD;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE;;;;;;;;;kEASiD;QAC9D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE;;;;;;;;;;;;;8EAa6D;QAC1E,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE;;;;;;;;;;;kFAWiE;QAC9E,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qCAAqC;oBAClD,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC;iBAChC;aACF;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Context Tools — node details, context, file overview, guards
3
+ */
4
+ import type { ToolDefinition } from './types.js';
5
+ export declare const CONTEXT_TOOLS: ToolDefinition[];
6
+ //# sourceMappingURL=context-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-tools.d.ts","sourceRoot":"","sources":["../../src/definitions/context-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,cAAc,EA4IzC,CAAC"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Context Tools — node details, context, file overview, guards
3
+ */
4
+ export const CONTEXT_TOOLS = [
5
+ {
6
+ name: 'get_function_details',
7
+ description: `Get comprehensive details about a function, including what it calls and who calls it.
8
+
9
+ Graph structure:
10
+ FUNCTION -[HAS_SCOPE]-> SCOPE -[CONTAINS]-> CALL/METHOD_CALL
11
+ CALL -[CALLS]-> FUNCTION (target)
12
+
13
+ Returns:
14
+ - Function metadata (name, file, line, async)
15
+ - calls: What functions/methods this function calls
16
+ - calledBy: What functions call this one
17
+
18
+ For calls array:
19
+ - resolved=true means target function was found
20
+ - resolved=false means unknown target (external/dynamic)
21
+ - type='CALL' for function calls like foo()
22
+ - type='METHOD_CALL' for method calls like obj.method()
23
+ - depth field shows transitive level (0=direct, 1+=indirect)
24
+
25
+ Use transitive=true to follow call chains (A calls B calls C).
26
+ Max transitive depth is 5 to prevent explosion.`,
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {
30
+ name: {
31
+ type: 'string',
32
+ description: 'Function name to look up',
33
+ },
34
+ file: {
35
+ type: 'string',
36
+ description: 'Optional: file path to disambiguate (partial match)',
37
+ },
38
+ transitive: {
39
+ type: 'boolean',
40
+ description: 'Follow call chains recursively (default: false)',
41
+ },
42
+ },
43
+ required: ['name'],
44
+ },
45
+ },
46
+ {
47
+ name: 'get_context',
48
+ description: `Get deep context for a graph node: source code + full graph neighborhood.
49
+
50
+ Shows ALL incoming and outgoing edges grouped by type, with source code
51
+ at each connected node's location. Works for ANY node type.
52
+
53
+ Use this after find_nodes or query_graph to deep-dive into a specific node.
54
+
55
+ Output includes:
56
+ - Node info (type, name, semantic ID, location)
57
+ - Source code at the node's location
58
+ - All outgoing edges (what this node connects to)
59
+ - All incoming edges (what connects to this node)
60
+ - Code context at each connected node's location
61
+
62
+ Primary edges (CALLS, ASSIGNED_FROM, DEPENDS_ON, etc.) include code context.
63
+ Structural edges (CONTAINS, HAS_SCOPE, etc.) are shown in compact form.`,
64
+ inputSchema: {
65
+ type: 'object',
66
+ properties: {
67
+ semanticId: {
68
+ type: 'string',
69
+ description: 'Exact semantic ID of the node (from find_nodes or query_graph)',
70
+ },
71
+ contextLines: {
72
+ type: 'number',
73
+ description: 'Lines of code context around each reference (default: 3)',
74
+ },
75
+ edgeType: {
76
+ type: 'string',
77
+ description: 'Filter by edge type (comma-separated, e.g., "CALLS,ASSIGNED_FROM")',
78
+ },
79
+ },
80
+ required: ['semanticId'],
81
+ },
82
+ },
83
+ {
84
+ name: 'get_file_overview',
85
+ description: `Understand what a file does without reading it — shows structure and relationships from the graph.
86
+
87
+ USE THIS FIRST when you need to understand a file. It replaces reading the file with
88
+ a structured summary: imports, exports, classes, functions, variables, and how they
89
+ connect to the rest of the codebase.
90
+
91
+ Returns:
92
+ - Imports: what modules are pulled in and which names
93
+ - Exports: what the file exposes to others
94
+ - Classes: with methods and their call targets
95
+ - Functions: with what they call
96
+ - Variables: with their assignment sources
97
+
98
+ After this, use get_context with specific node IDs to deep-dive into relationships.`,
99
+ inputSchema: {
100
+ type: 'object',
101
+ properties: {
102
+ file: {
103
+ type: 'string',
104
+ description: 'File path (relative to project root or absolute)',
105
+ },
106
+ include_edges: {
107
+ type: 'boolean',
108
+ description: 'Include relationship edges like CALLS, EXTENDS (default: true). Set false for faster results.',
109
+ },
110
+ },
111
+ required: ['file'],
112
+ },
113
+ },
114
+ {
115
+ name: 'find_guards',
116
+ description: `Find conditional guards protecting a node.
117
+
118
+ Returns all SCOPE nodes that guard the given node, walking from inner to outer scope.
119
+ Useful for answering "what conditions must be true for this code to execute?"
120
+
121
+ Each guard includes:
122
+ - scopeId: The SCOPE node ID
123
+ - scopeType: Type of conditional (if_statement, else_statement, etc.)
124
+ - condition: Raw condition text (e.g., "user !== null")
125
+ - constraints: Parsed constraints (if available)
126
+ - file/line: Location in source
127
+
128
+ Example use cases:
129
+ - "What conditions guard this API call?"
130
+ - "Is this code protected by a null check?"
131
+ - "What's the full guard chain for this function call?"`,
132
+ inputSchema: {
133
+ type: 'object',
134
+ properties: {
135
+ nodeId: {
136
+ type: 'string',
137
+ description: 'ID of the node to find guards for (e.g., CALL, VARIABLE)',
138
+ },
139
+ },
140
+ required: ['nodeId'],
141
+ },
142
+ },
143
+ ];
144
+ //# sourceMappingURL=context-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-tools.js","sourceRoot":"","sources":["../../src/definitions/context-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE;;;;;;;;;;;;;;;;;;;gDAmB+B;QAC5C,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,0BAA0B;iBACxC;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qDAAqD;iBACnE;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,iDAAiD;iBAC/D;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE;;;;;;;;;;;;;;;wEAeuD;QACpE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gEAAgE;iBAC9E;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,0DAA0D;iBACxE;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,oEAAoE;iBAClF;aACF;YACD,QAAQ,EAAE,CAAC,YAAY,CAAC;SACzB;KACF;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE;;;;;;;;;;;;;oFAamE;QAChF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kDAAkD;iBAChE;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,SAAS;oBACf,WAAW,EACT,+FAA+F;iBAClG;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE;;;;;;;;;;;;;;;wDAeuC;QACpD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,0DAA0D;iBACxE;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB;KACF;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Graph Tools — raw graph traversal primitives
3
+ * REG-521: get_node, get_neighbors, traverse_graph
4
+ */
5
+ import type { ToolDefinition } from './types.js';
6
+ export declare const GRAPH_TOOLS: ToolDefinition[];
7
+ //# sourceMappingURL=graph-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-tools.d.ts","sourceRoot":"","sources":["../../src/definitions/graph-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,cAAc,EAsHvC,CAAC"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Graph Tools — raw graph traversal primitives
3
+ * REG-521: get_node, get_neighbors, traverse_graph
4
+ */
5
+ export const GRAPH_TOOLS = [
6
+ {
7
+ name: 'get_node',
8
+ description: `Get a single node by its semantic ID with full metadata.
9
+
10
+ Use this when you have a node ID from find_nodes, query_graph, or another tool
11
+ and need the complete record.
12
+
13
+ Returns: All node properties (type, name, file, line, exported) plus
14
+ type-specific metadata (async, params, className, etc.).
15
+
16
+ Use cases:
17
+ - After find_nodes: get full details for a specific result
18
+ - After query_graph: inspect a violation node
19
+ - Quick lookup without full context (faster than get_context)
20
+
21
+ Tip: For relationships and code context, use get_context instead.
22
+ For just the direct edges, use get_neighbors.`,
23
+ inputSchema: {
24
+ type: 'object',
25
+ properties: {
26
+ semanticId: {
27
+ type: 'string',
28
+ description: 'Semantic ID of the node (from find_nodes, query_graph, etc.)',
29
+ },
30
+ },
31
+ required: ['semanticId'],
32
+ },
33
+ },
34
+ {
35
+ name: 'get_neighbors',
36
+ description: `Get direct neighbors of a node — all incoming and/or outgoing edges.
37
+
38
+ Returns edges grouped by type with connected node summaries.
39
+
40
+ Use this when you need:
41
+ - "What does this node connect to?" (outgoing)
42
+ - "What connects to this node?" (incoming)
43
+ - Simple graph exploration without Datalog
44
+
45
+ Direction options:
46
+ - outgoing: Edges FROM this node (calls, contains, depends on)
47
+ - incoming: Edges TO this node (callers, containers, dependents)
48
+ - both: All edges (default)
49
+
50
+ Edge type filter: Pass edgeTypes to see only specific relationships.
51
+ Omit to get all edge types.
52
+
53
+ Cheaper than get_context (no code snippets). Use when you only need
54
+ the graph structure, not source code.`,
55
+ inputSchema: {
56
+ type: 'object',
57
+ properties: {
58
+ semanticId: {
59
+ type: 'string',
60
+ description: 'Semantic ID of the node',
61
+ },
62
+ direction: {
63
+ type: 'string',
64
+ description: 'Edge direction: outgoing, incoming, or both (default: both)',
65
+ enum: ['outgoing', 'incoming', 'both'],
66
+ },
67
+ edgeTypes: {
68
+ type: 'array',
69
+ items: { type: 'string' },
70
+ description: 'Filter by edge types (e.g., ["CALLS", "CONTAINS"]). Omit for all.',
71
+ },
72
+ },
73
+ required: ['semanticId'],
74
+ },
75
+ },
76
+ {
77
+ name: 'traverse_graph',
78
+ description: `Traverse the graph using BFS from start nodes, following specific edge types.
79
+
80
+ Use this for:
81
+ - Impact analysis: "What's affected if I change this?" (outgoing CALLS, DEPENDS_ON)
82
+ - Dependency trees: "What does this module import?" (outgoing IMPORTS_FROM)
83
+ - Reverse dependencies: "Who depends on this?" (incoming DEPENDS_ON)
84
+ - Reachability: "Can data flow from X to Y?" (outgoing FLOWS_INTO, ASSIGNED_FROM)
85
+
86
+ Returns nodes with depth info (0 = start, 1 = direct neighbor, 2+ = transitive).
87
+
88
+ Direction:
89
+ - outgoing: Follow edges FROM start nodes (default)
90
+ - incoming: Follow edges TO start nodes
91
+
92
+ Examples:
93
+ - All transitive callers: traverse_graph(startNodeIds=[fnId], edgeTypes=["CALLS"], direction="incoming")
94
+ - Module dependency tree: traverse_graph(startNodeIds=[modId], edgeTypes=["IMPORTS_FROM"], maxDepth=10)
95
+
96
+ Tip: Start with maxDepth=5. Use get_schema(type="edges") to find valid edge type names.`,
97
+ inputSchema: {
98
+ type: 'object',
99
+ properties: {
100
+ startNodeIds: {
101
+ type: 'array',
102
+ items: { type: 'string' },
103
+ description: 'Starting node IDs (semantic IDs)',
104
+ },
105
+ edgeTypes: {
106
+ type: 'array',
107
+ items: { type: 'string' },
108
+ description: 'Edge types to follow (e.g., ["CALLS", "DEPENDS_ON"]). Use get_schema to see available types.',
109
+ },
110
+ maxDepth: {
111
+ type: 'number',
112
+ description: 'Maximum traversal depth (default: 5, max: 20)',
113
+ },
114
+ direction: {
115
+ type: 'string',
116
+ description: 'Traversal direction: outgoing or incoming (default: outgoing)',
117
+ enum: ['outgoing', 'incoming'],
118
+ },
119
+ },
120
+ required: ['startNodeIds', 'edgeTypes'],
121
+ },
122
+ },
123
+ ];
124
+ //# sourceMappingURL=graph-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-tools.js","sourceRoot":"","sources":["../../src/definitions/graph-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,WAAW,GAAqB;IAC3C;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE;;;;;;;;;;;;;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AAE,QAAQ;oBACd,WAAW,EAAE,+DAA+D;oBAC5E,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;iBAC/B;aACF;YACD,QAAQ,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC;SACxC;KACF;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * GraphQL Tool — execute GraphQL queries on the code graph
3
+ */
4
+ import type { ToolDefinition } from './types.js';
5
+ export declare const GRAPHQL_TOOLS: ToolDefinition[];
6
+ //# sourceMappingURL=graphql-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-tools.d.ts","sourceRoot":"","sources":["../../src/definitions/graphql-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,cAAc,EAyDzC,CAAC"}