@optave/codegraph 3.1.3 → 3.1.4
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/README.md +17 -19
- package/package.json +10 -7
- package/src/analysis/context.js +408 -0
- package/src/analysis/dependencies.js +341 -0
- package/src/analysis/exports.js +130 -0
- package/src/analysis/impact.js +463 -0
- package/src/analysis/module-map.js +322 -0
- package/src/analysis/roles.js +45 -0
- package/src/analysis/symbol-lookup.js +232 -0
- package/src/ast-analysis/shared.js +5 -4
- package/src/batch.js +2 -1
- package/src/builder/context.js +85 -0
- package/src/builder/helpers.js +218 -0
- package/src/builder/incremental.js +178 -0
- package/src/builder/pipeline.js +130 -0
- package/src/builder/stages/build-edges.js +297 -0
- package/src/builder/stages/build-structure.js +113 -0
- package/src/builder/stages/collect-files.js +44 -0
- package/src/builder/stages/detect-changes.js +413 -0
- package/src/builder/stages/finalize.js +139 -0
- package/src/builder/stages/insert-nodes.js +195 -0
- package/src/builder/stages/parse-files.js +28 -0
- package/src/builder/stages/resolve-imports.js +143 -0
- package/src/builder/stages/run-analyses.js +44 -0
- package/src/builder.js +10 -1485
- package/src/cfg.js +1 -2
- package/src/cli/commands/ast.js +26 -0
- package/src/cli/commands/audit.js +46 -0
- package/src/cli/commands/batch.js +68 -0
- package/src/cli/commands/branch-compare.js +21 -0
- package/src/cli/commands/build.js +26 -0
- package/src/cli/commands/cfg.js +30 -0
- package/src/cli/commands/check.js +79 -0
- package/src/cli/commands/children.js +31 -0
- package/src/cli/commands/co-change.js +65 -0
- package/src/cli/commands/communities.js +23 -0
- package/src/cli/commands/complexity.js +45 -0
- package/src/cli/commands/context.js +34 -0
- package/src/cli/commands/cycles.js +28 -0
- package/src/cli/commands/dataflow.js +32 -0
- package/src/cli/commands/deps.js +16 -0
- package/src/cli/commands/diff-impact.js +30 -0
- package/src/cli/commands/embed.js +30 -0
- package/src/cli/commands/export.js +75 -0
- package/src/cli/commands/exports.js +18 -0
- package/src/cli/commands/flow.js +36 -0
- package/src/cli/commands/fn-impact.js +30 -0
- package/src/cli/commands/impact.js +16 -0
- package/src/cli/commands/info.js +76 -0
- package/src/cli/commands/map.js +19 -0
- package/src/cli/commands/mcp.js +18 -0
- package/src/cli/commands/models.js +19 -0
- package/src/cli/commands/owners.js +25 -0
- package/src/cli/commands/path.js +36 -0
- package/src/cli/commands/plot.js +80 -0
- package/src/cli/commands/query.js +49 -0
- package/src/cli/commands/registry.js +100 -0
- package/src/cli/commands/roles.js +34 -0
- package/src/cli/commands/search.js +42 -0
- package/src/cli/commands/sequence.js +32 -0
- package/src/cli/commands/snapshot.js +61 -0
- package/src/cli/commands/stats.js +15 -0
- package/src/cli/commands/structure.js +32 -0
- package/src/cli/commands/triage.js +78 -0
- package/src/cli/commands/watch.js +12 -0
- package/src/cli/commands/where.js +24 -0
- package/src/cli/index.js +118 -0
- package/src/cli/shared/options.js +39 -0
- package/src/cli/shared/output.js +1 -0
- package/src/cli.js +11 -1522
- package/src/commands/check.js +5 -5
- package/src/commands/manifesto.js +3 -3
- package/src/commands/structure.js +1 -1
- package/src/communities.js +15 -87
- package/src/cycles.js +30 -85
- package/src/dataflow.js +1 -2
- package/src/db/connection.js +4 -4
- package/src/db/migrations.js +41 -0
- package/src/db/query-builder.js +6 -5
- package/src/db/repository/base.js +201 -0
- package/src/db/repository/graph-read.js +5 -2
- package/src/db/repository/in-memory-repository.js +584 -0
- package/src/db/repository/index.js +5 -1
- package/src/db/repository/nodes.js +63 -4
- package/src/db/repository/sqlite-repository.js +219 -0
- package/src/db.js +5 -0
- package/src/embeddings/generator.js +163 -0
- package/src/embeddings/index.js +13 -0
- package/src/embeddings/models.js +218 -0
- package/src/embeddings/search/cli-formatter.js +151 -0
- package/src/embeddings/search/filters.js +46 -0
- package/src/embeddings/search/hybrid.js +121 -0
- package/src/embeddings/search/keyword.js +68 -0
- package/src/embeddings/search/prepare.js +66 -0
- package/src/embeddings/search/semantic.js +145 -0
- package/src/embeddings/stores/fts5.js +27 -0
- package/src/embeddings/stores/sqlite-blob.js +24 -0
- package/src/embeddings/strategies/source.js +14 -0
- package/src/embeddings/strategies/structured.js +43 -0
- package/src/embeddings/strategies/text-utils.js +43 -0
- package/src/errors.js +78 -0
- package/src/export.js +217 -520
- package/src/extractors/csharp.js +10 -2
- package/src/extractors/go.js +3 -1
- package/src/extractors/helpers.js +71 -0
- package/src/extractors/java.js +9 -2
- package/src/extractors/javascript.js +38 -1
- package/src/extractors/php.js +3 -1
- package/src/extractors/python.js +14 -3
- package/src/extractors/rust.js +3 -1
- package/src/graph/algorithms/bfs.js +49 -0
- package/src/graph/algorithms/centrality.js +16 -0
- package/src/graph/algorithms/index.js +5 -0
- package/src/graph/algorithms/louvain.js +26 -0
- package/src/graph/algorithms/shortest-path.js +41 -0
- package/src/graph/algorithms/tarjan.js +49 -0
- package/src/graph/builders/dependency.js +91 -0
- package/src/graph/builders/index.js +3 -0
- package/src/graph/builders/structure.js +40 -0
- package/src/graph/builders/temporal.js +33 -0
- package/src/graph/classifiers/index.js +2 -0
- package/src/graph/classifiers/risk.js +85 -0
- package/src/graph/classifiers/roles.js +64 -0
- package/src/graph/index.js +13 -0
- package/src/graph/model.js +230 -0
- package/src/index.js +33 -210
- package/src/infrastructure/result-formatter.js +2 -21
- package/src/mcp/index.js +2 -0
- package/src/mcp/middleware.js +26 -0
- package/src/mcp/server.js +128 -0
- package/src/mcp/tool-registry.js +801 -0
- package/src/mcp/tools/ast-query.js +14 -0
- package/src/mcp/tools/audit.js +21 -0
- package/src/mcp/tools/batch-query.js +11 -0
- package/src/mcp/tools/branch-compare.js +10 -0
- package/src/mcp/tools/cfg.js +21 -0
- package/src/mcp/tools/check.js +43 -0
- package/src/mcp/tools/co-changes.js +20 -0
- package/src/mcp/tools/code-owners.js +12 -0
- package/src/mcp/tools/communities.js +15 -0
- package/src/mcp/tools/complexity.js +18 -0
- package/src/mcp/tools/context.js +17 -0
- package/src/mcp/tools/dataflow.js +26 -0
- package/src/mcp/tools/diff-impact.js +24 -0
- package/src/mcp/tools/execution-flow.js +26 -0
- package/src/mcp/tools/export-graph.js +57 -0
- package/src/mcp/tools/file-deps.js +12 -0
- package/src/mcp/tools/file-exports.js +13 -0
- package/src/mcp/tools/find-cycles.js +15 -0
- package/src/mcp/tools/fn-impact.js +15 -0
- package/src/mcp/tools/impact-analysis.js +12 -0
- package/src/mcp/tools/index.js +71 -0
- package/src/mcp/tools/list-functions.js +14 -0
- package/src/mcp/tools/list-repos.js +11 -0
- package/src/mcp/tools/module-map.js +6 -0
- package/src/mcp/tools/node-roles.js +14 -0
- package/src/mcp/tools/path.js +12 -0
- package/src/mcp/tools/query.js +30 -0
- package/src/mcp/tools/semantic-search.js +65 -0
- package/src/mcp/tools/sequence.js +17 -0
- package/src/mcp/tools/structure.js +15 -0
- package/src/mcp/tools/symbol-children.js +14 -0
- package/src/mcp/tools/triage.js +35 -0
- package/src/mcp/tools/where.js +13 -0
- package/src/mcp.js +2 -1470
- package/src/native.js +3 -1
- package/src/presentation/colors.js +44 -0
- package/src/presentation/export.js +444 -0
- package/src/presentation/result-formatter.js +21 -0
- package/src/presentation/sequence-renderer.js +43 -0
- package/src/presentation/table.js +47 -0
- package/src/presentation/viewer.js +634 -0
- package/src/queries.js +35 -2276
- package/src/resolve.js +1 -1
- package/src/sequence.js +2 -38
- package/src/shared/file-utils.js +153 -0
- package/src/shared/generators.js +125 -0
- package/src/shared/hierarchy.js +27 -0
- package/src/shared/normalize.js +59 -0
- package/src/snapshot.js +6 -5
- package/src/structure.js +15 -40
- package/src/triage.js +20 -72
- package/src/viewer.js +35 -656
- package/src/watcher.js +8 -148
- package/src/embedder.js +0 -1097
|
@@ -0,0 +1,801 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool schema registry.
|
|
3
|
+
*
|
|
4
|
+
* Owns BASE_TOOLS, LIST_REPOS_TOOL, buildToolList(), and the backward-compatible TOOLS export.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { AST_NODE_KINDS } from '../ast.js';
|
|
8
|
+
import { EVERY_EDGE_KIND, EVERY_SYMBOL_KIND, VALID_ROLES } from '../queries.js';
|
|
9
|
+
|
|
10
|
+
const REPO_PROP = {
|
|
11
|
+
repo: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'Repository name from the registry (omit for local project)',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const PAGINATION_PROPS = {
|
|
18
|
+
limit: { type: 'number', description: 'Max results to return (pagination)' },
|
|
19
|
+
offset: { type: 'number', description: 'Skip this many results (pagination, default: 0)' },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const BASE_TOOLS = [
|
|
23
|
+
{
|
|
24
|
+
name: 'query',
|
|
25
|
+
description:
|
|
26
|
+
'Query the call graph: find callers/callees with transitive chain, or find shortest path between two symbols',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
name: { type: 'string', description: 'Function/method/class name (partial match)' },
|
|
31
|
+
mode: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
enum: ['deps', 'path'],
|
|
34
|
+
description: 'deps (default): dependency chain. path: shortest path to target',
|
|
35
|
+
},
|
|
36
|
+
depth: {
|
|
37
|
+
type: 'number',
|
|
38
|
+
description: 'Transitive depth (deps default: 3, path default: 10)',
|
|
39
|
+
},
|
|
40
|
+
file: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Scope search to functions in this file (partial match)',
|
|
43
|
+
},
|
|
44
|
+
kind: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
enum: EVERY_SYMBOL_KIND,
|
|
47
|
+
description: 'Filter by symbol kind',
|
|
48
|
+
},
|
|
49
|
+
to: { type: 'string', description: 'Target symbol for path mode (required in path mode)' },
|
|
50
|
+
edge_kinds: {
|
|
51
|
+
type: 'array',
|
|
52
|
+
items: { type: 'string', enum: EVERY_EDGE_KIND },
|
|
53
|
+
description: 'Edge kinds to follow in path mode (default: ["calls"])',
|
|
54
|
+
},
|
|
55
|
+
reverse: {
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
description: 'Follow edges backward in path mode',
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
from_file: { type: 'string', description: 'Disambiguate source by file in path mode' },
|
|
61
|
+
to_file: { type: 'string', description: 'Disambiguate target by file in path mode' },
|
|
62
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
63
|
+
...PAGINATION_PROPS,
|
|
64
|
+
},
|
|
65
|
+
required: ['name'],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'path',
|
|
70
|
+
description: 'Find shortest path between two symbols in the dependency graph',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: {
|
|
74
|
+
from: { type: 'string', description: 'Source symbol name' },
|
|
75
|
+
to: { type: 'string', description: 'Target symbol name' },
|
|
76
|
+
depth: { type: 'number', description: 'Max traversal depth (default: 10)' },
|
|
77
|
+
edge_kinds: {
|
|
78
|
+
type: 'array',
|
|
79
|
+
items: { type: 'string', enum: EVERY_EDGE_KIND },
|
|
80
|
+
description: 'Edge kinds to follow (default: ["calls"])',
|
|
81
|
+
},
|
|
82
|
+
from_file: { type: 'string', description: 'Disambiguate source by file' },
|
|
83
|
+
to_file: { type: 'string', description: 'Disambiguate target by file' },
|
|
84
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
85
|
+
},
|
|
86
|
+
required: ['from', 'to'],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'file_deps',
|
|
91
|
+
description: 'Show what a file imports and what imports it',
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
properties: {
|
|
95
|
+
file: { type: 'string', description: 'File path (partial match supported)' },
|
|
96
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
97
|
+
...PAGINATION_PROPS,
|
|
98
|
+
},
|
|
99
|
+
required: ['file'],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'file_exports',
|
|
104
|
+
description:
|
|
105
|
+
'Show exported symbols of a file with per-symbol consumers — who calls each export and from where',
|
|
106
|
+
inputSchema: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
properties: {
|
|
109
|
+
file: { type: 'string', description: 'File path (partial match supported)' },
|
|
110
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
111
|
+
unused: {
|
|
112
|
+
type: 'boolean',
|
|
113
|
+
description: 'Show only exports with zero consumers',
|
|
114
|
+
default: false,
|
|
115
|
+
},
|
|
116
|
+
...PAGINATION_PROPS,
|
|
117
|
+
},
|
|
118
|
+
required: ['file'],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'impact_analysis',
|
|
123
|
+
description: 'Show files affected by changes to a given file (transitive)',
|
|
124
|
+
inputSchema: {
|
|
125
|
+
type: 'object',
|
|
126
|
+
properties: {
|
|
127
|
+
file: { type: 'string', description: 'File path to analyze' },
|
|
128
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
129
|
+
...PAGINATION_PROPS,
|
|
130
|
+
},
|
|
131
|
+
required: ['file'],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'find_cycles',
|
|
136
|
+
description: 'Detect circular dependencies in the codebase',
|
|
137
|
+
inputSchema: {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: {},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'module_map',
|
|
144
|
+
description: 'Get high-level overview of most-connected files',
|
|
145
|
+
inputSchema: {
|
|
146
|
+
type: 'object',
|
|
147
|
+
properties: {
|
|
148
|
+
limit: { type: 'number', description: 'Number of top files to show', default: 20 },
|
|
149
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'fn_impact',
|
|
155
|
+
description:
|
|
156
|
+
'Show function-level blast radius: all functions transitively affected by changes to a function',
|
|
157
|
+
inputSchema: {
|
|
158
|
+
type: 'object',
|
|
159
|
+
properties: {
|
|
160
|
+
name: { type: 'string', description: 'Function/method/class name (partial match)' },
|
|
161
|
+
depth: { type: 'number', description: 'Max traversal depth', default: 5 },
|
|
162
|
+
file: {
|
|
163
|
+
type: 'string',
|
|
164
|
+
description: 'Scope search to functions in this file (partial match)',
|
|
165
|
+
},
|
|
166
|
+
kind: {
|
|
167
|
+
type: 'string',
|
|
168
|
+
enum: EVERY_SYMBOL_KIND,
|
|
169
|
+
description: 'Filter to a specific symbol kind',
|
|
170
|
+
},
|
|
171
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
172
|
+
...PAGINATION_PROPS,
|
|
173
|
+
},
|
|
174
|
+
required: ['name'],
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'context',
|
|
179
|
+
description:
|
|
180
|
+
'Full context for a function: source code, dependencies with summaries, callers, signature, and related tests — everything needed to understand or modify a function in one call',
|
|
181
|
+
inputSchema: {
|
|
182
|
+
type: 'object',
|
|
183
|
+
properties: {
|
|
184
|
+
name: { type: 'string', description: 'Function/method/class name (partial match)' },
|
|
185
|
+
depth: {
|
|
186
|
+
type: 'number',
|
|
187
|
+
description: 'Include callee source up to N levels deep (0=no source, 1=direct)',
|
|
188
|
+
default: 0,
|
|
189
|
+
},
|
|
190
|
+
file: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
description: 'Scope search to functions in this file (partial match)',
|
|
193
|
+
},
|
|
194
|
+
kind: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
enum: EVERY_SYMBOL_KIND,
|
|
197
|
+
description: 'Filter to a specific symbol kind',
|
|
198
|
+
},
|
|
199
|
+
no_source: {
|
|
200
|
+
type: 'boolean',
|
|
201
|
+
description: 'Skip source extraction (metadata only)',
|
|
202
|
+
default: false,
|
|
203
|
+
},
|
|
204
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
205
|
+
include_tests: {
|
|
206
|
+
type: 'boolean',
|
|
207
|
+
description: 'Include test file source code',
|
|
208
|
+
default: false,
|
|
209
|
+
},
|
|
210
|
+
...PAGINATION_PROPS,
|
|
211
|
+
},
|
|
212
|
+
required: ['name'],
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'symbol_children',
|
|
217
|
+
description:
|
|
218
|
+
'List sub-declaration children of a symbol: parameters, properties, constants. Answers "what fields does this class have?" without reading source.',
|
|
219
|
+
inputSchema: {
|
|
220
|
+
type: 'object',
|
|
221
|
+
properties: {
|
|
222
|
+
name: { type: 'string', description: 'Function/method/class name (partial match)' },
|
|
223
|
+
file: { type: 'string', description: 'Scope to file (partial match)' },
|
|
224
|
+
kind: { type: 'string', enum: EVERY_SYMBOL_KIND, description: 'Filter by symbol kind' },
|
|
225
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
226
|
+
...PAGINATION_PROPS,
|
|
227
|
+
},
|
|
228
|
+
required: ['name'],
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: 'where',
|
|
233
|
+
description:
|
|
234
|
+
'Find where a symbol is defined and used, or list symbols/imports/exports for a file. Minimal, fast lookup.',
|
|
235
|
+
inputSchema: {
|
|
236
|
+
type: 'object',
|
|
237
|
+
properties: {
|
|
238
|
+
target: { type: 'string', description: 'Symbol name or file path' },
|
|
239
|
+
file_mode: {
|
|
240
|
+
type: 'boolean',
|
|
241
|
+
description: 'Treat target as file path (list symbols/imports/exports)',
|
|
242
|
+
default: false,
|
|
243
|
+
},
|
|
244
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
245
|
+
...PAGINATION_PROPS,
|
|
246
|
+
},
|
|
247
|
+
required: ['target'],
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: 'diff_impact',
|
|
252
|
+
description: 'Analyze git diff to find which functions changed and their transitive callers',
|
|
253
|
+
inputSchema: {
|
|
254
|
+
type: 'object',
|
|
255
|
+
properties: {
|
|
256
|
+
staged: { type: 'boolean', description: 'Analyze staged changes only', default: false },
|
|
257
|
+
ref: { type: 'string', description: 'Git ref to diff against (default: HEAD)' },
|
|
258
|
+
depth: { type: 'number', description: 'Transitive caller depth', default: 3 },
|
|
259
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
260
|
+
format: {
|
|
261
|
+
type: 'string',
|
|
262
|
+
enum: ['json', 'mermaid'],
|
|
263
|
+
description: 'Output format (default: json)',
|
|
264
|
+
},
|
|
265
|
+
...PAGINATION_PROPS,
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: 'semantic_search',
|
|
271
|
+
description:
|
|
272
|
+
'Search code symbols by meaning using embeddings and/or keyword matching (requires prior `codegraph embed`). Default hybrid mode combines BM25 keyword + semantic search for best results.',
|
|
273
|
+
inputSchema: {
|
|
274
|
+
type: 'object',
|
|
275
|
+
properties: {
|
|
276
|
+
query: { type: 'string', description: 'Natural language search query' },
|
|
277
|
+
limit: { type: 'number', description: 'Max results to return', default: 15 },
|
|
278
|
+
min_score: { type: 'number', description: 'Minimum similarity score (0-1)', default: 0.2 },
|
|
279
|
+
mode: {
|
|
280
|
+
type: 'string',
|
|
281
|
+
enum: ['hybrid', 'semantic', 'keyword'],
|
|
282
|
+
description:
|
|
283
|
+
'Search mode: hybrid (BM25 + semantic, default), semantic (embeddings only), keyword (BM25 only)',
|
|
284
|
+
},
|
|
285
|
+
...PAGINATION_PROPS,
|
|
286
|
+
},
|
|
287
|
+
required: ['query'],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: 'export_graph',
|
|
292
|
+
description:
|
|
293
|
+
'Export the dependency graph in DOT, Mermaid, JSON, GraphML, GraphSON, or Neo4j CSV format',
|
|
294
|
+
inputSchema: {
|
|
295
|
+
type: 'object',
|
|
296
|
+
properties: {
|
|
297
|
+
format: {
|
|
298
|
+
type: 'string',
|
|
299
|
+
enum: ['dot', 'mermaid', 'json', 'graphml', 'graphson', 'neo4j'],
|
|
300
|
+
description: 'Export format',
|
|
301
|
+
},
|
|
302
|
+
file_level: {
|
|
303
|
+
type: 'boolean',
|
|
304
|
+
description: 'File-level graph (true) or function-level (false)',
|
|
305
|
+
default: true,
|
|
306
|
+
},
|
|
307
|
+
...PAGINATION_PROPS,
|
|
308
|
+
},
|
|
309
|
+
required: ['format'],
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: 'list_functions',
|
|
314
|
+
description:
|
|
315
|
+
'List functions, methods, classes, structs, enums, traits, records, and modules in the codebase, optionally filtered by file or name pattern',
|
|
316
|
+
inputSchema: {
|
|
317
|
+
type: 'object',
|
|
318
|
+
properties: {
|
|
319
|
+
file: { type: 'string', description: 'Filter by file path (partial match)' },
|
|
320
|
+
pattern: { type: 'string', description: 'Filter by function name (partial match)' },
|
|
321
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
322
|
+
...PAGINATION_PROPS,
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: 'structure',
|
|
328
|
+
description:
|
|
329
|
+
'Show project structure with directory hierarchy, cohesion scores, and per-file metrics. Per-file details are capped at 25 files by default; use full=true to show all.',
|
|
330
|
+
inputSchema: {
|
|
331
|
+
type: 'object',
|
|
332
|
+
properties: {
|
|
333
|
+
directory: { type: 'string', description: 'Filter to a specific directory path' },
|
|
334
|
+
depth: { type: 'number', description: 'Max directory depth to show' },
|
|
335
|
+
sort: {
|
|
336
|
+
type: 'string',
|
|
337
|
+
enum: ['cohesion', 'fan-in', 'fan-out', 'density', 'files'],
|
|
338
|
+
description: 'Sort directories by metric',
|
|
339
|
+
},
|
|
340
|
+
full: {
|
|
341
|
+
type: 'boolean',
|
|
342
|
+
description: 'Return all files without limit',
|
|
343
|
+
default: false,
|
|
344
|
+
},
|
|
345
|
+
...PAGINATION_PROPS,
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: 'node_roles',
|
|
351
|
+
description:
|
|
352
|
+
'Show node role classification (entry, core, utility, adapter, dead, leaf) based on connectivity patterns',
|
|
353
|
+
inputSchema: {
|
|
354
|
+
type: 'object',
|
|
355
|
+
properties: {
|
|
356
|
+
role: {
|
|
357
|
+
type: 'string',
|
|
358
|
+
enum: VALID_ROLES,
|
|
359
|
+
description: 'Filter to a specific role',
|
|
360
|
+
},
|
|
361
|
+
file: { type: 'string', description: 'Scope to a specific file (partial match)' },
|
|
362
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
363
|
+
...PAGINATION_PROPS,
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: 'co_changes',
|
|
369
|
+
description:
|
|
370
|
+
'Find files that historically change together based on git commit history. Requires prior `codegraph co-change --analyze`.',
|
|
371
|
+
inputSchema: {
|
|
372
|
+
type: 'object',
|
|
373
|
+
properties: {
|
|
374
|
+
file: {
|
|
375
|
+
type: 'string',
|
|
376
|
+
description: 'File path (partial match). Omit for top global pairs.',
|
|
377
|
+
},
|
|
378
|
+
limit: { type: 'number', description: 'Max results', default: 20 },
|
|
379
|
+
min_jaccard: {
|
|
380
|
+
type: 'number',
|
|
381
|
+
description: 'Minimum Jaccard similarity (0-1)',
|
|
382
|
+
default: 0.3,
|
|
383
|
+
},
|
|
384
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
385
|
+
offset: { type: 'number', description: 'Skip this many results (pagination, default: 0)' },
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: 'execution_flow',
|
|
391
|
+
description:
|
|
392
|
+
'Trace execution flow forward from an entry point through callees to leaves, or list all entry points with list=true',
|
|
393
|
+
inputSchema: {
|
|
394
|
+
type: 'object',
|
|
395
|
+
properties: {
|
|
396
|
+
name: {
|
|
397
|
+
type: 'string',
|
|
398
|
+
description:
|
|
399
|
+
'Entry point or function name (required unless list=true). Supports prefix-stripped matching.',
|
|
400
|
+
},
|
|
401
|
+
list: {
|
|
402
|
+
type: 'boolean',
|
|
403
|
+
description: 'List all entry points grouped by type',
|
|
404
|
+
default: false,
|
|
405
|
+
},
|
|
406
|
+
depth: { type: 'number', description: 'Max forward traversal depth', default: 10 },
|
|
407
|
+
file: {
|
|
408
|
+
type: 'string',
|
|
409
|
+
description: 'Scope search to functions in this file (partial match)',
|
|
410
|
+
},
|
|
411
|
+
kind: {
|
|
412
|
+
type: 'string',
|
|
413
|
+
enum: EVERY_SYMBOL_KIND,
|
|
414
|
+
description: 'Filter to a specific symbol kind',
|
|
415
|
+
},
|
|
416
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
417
|
+
...PAGINATION_PROPS,
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: 'sequence',
|
|
423
|
+
description:
|
|
424
|
+
'Generate a Mermaid sequence diagram from call graph edges. Participants are files, messages are function calls between them.',
|
|
425
|
+
inputSchema: {
|
|
426
|
+
type: 'object',
|
|
427
|
+
properties: {
|
|
428
|
+
name: {
|
|
429
|
+
type: 'string',
|
|
430
|
+
description: 'Entry point or function name to trace from (partial match)',
|
|
431
|
+
},
|
|
432
|
+
depth: { type: 'number', description: 'Max forward traversal depth', default: 10 },
|
|
433
|
+
format: {
|
|
434
|
+
type: 'string',
|
|
435
|
+
enum: ['mermaid', 'json'],
|
|
436
|
+
description: 'Output format (default: mermaid)',
|
|
437
|
+
},
|
|
438
|
+
dataflow: {
|
|
439
|
+
type: 'boolean',
|
|
440
|
+
description: 'Annotate with parameter names and return arrows',
|
|
441
|
+
default: false,
|
|
442
|
+
},
|
|
443
|
+
file: {
|
|
444
|
+
type: 'string',
|
|
445
|
+
description: 'Scope search to functions in this file (partial match)',
|
|
446
|
+
},
|
|
447
|
+
kind: {
|
|
448
|
+
type: 'string',
|
|
449
|
+
enum: EVERY_SYMBOL_KIND,
|
|
450
|
+
description: 'Filter to a specific symbol kind',
|
|
451
|
+
},
|
|
452
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
453
|
+
...PAGINATION_PROPS,
|
|
454
|
+
},
|
|
455
|
+
required: ['name'],
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: 'complexity',
|
|
460
|
+
description:
|
|
461
|
+
'Show per-function complexity metrics (cognitive, cyclomatic, nesting, Halstead, Maintainability Index). Sorted by most complex first.',
|
|
462
|
+
inputSchema: {
|
|
463
|
+
type: 'object',
|
|
464
|
+
properties: {
|
|
465
|
+
name: { type: 'string', description: 'Function name filter (partial match)' },
|
|
466
|
+
file: { type: 'string', description: 'Scope to file (partial match)' },
|
|
467
|
+
limit: { type: 'number', description: 'Max results', default: 20 },
|
|
468
|
+
sort: {
|
|
469
|
+
type: 'string',
|
|
470
|
+
enum: ['cognitive', 'cyclomatic', 'nesting', 'mi', 'volume', 'effort', 'bugs', 'loc'],
|
|
471
|
+
description: 'Sort metric',
|
|
472
|
+
default: 'cognitive',
|
|
473
|
+
},
|
|
474
|
+
above_threshold: {
|
|
475
|
+
type: 'boolean',
|
|
476
|
+
description: 'Only functions exceeding warn thresholds',
|
|
477
|
+
default: false,
|
|
478
|
+
},
|
|
479
|
+
health: {
|
|
480
|
+
type: 'boolean',
|
|
481
|
+
description: 'Include Halstead and Maintainability Index metrics',
|
|
482
|
+
default: false,
|
|
483
|
+
},
|
|
484
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
485
|
+
kind: {
|
|
486
|
+
type: 'string',
|
|
487
|
+
description: 'Filter by symbol kind (function, method, class, etc.)',
|
|
488
|
+
},
|
|
489
|
+
offset: { type: 'number', description: 'Skip this many results (pagination, default: 0)' },
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: 'communities',
|
|
495
|
+
description:
|
|
496
|
+
'Detect natural module boundaries using Louvain community detection. Compares discovered communities against directory structure and surfaces architectural drift.',
|
|
497
|
+
inputSchema: {
|
|
498
|
+
type: 'object',
|
|
499
|
+
properties: {
|
|
500
|
+
functions: {
|
|
501
|
+
type: 'boolean',
|
|
502
|
+
description: 'Function-level instead of file-level',
|
|
503
|
+
default: false,
|
|
504
|
+
},
|
|
505
|
+
resolution: {
|
|
506
|
+
type: 'number',
|
|
507
|
+
description: 'Louvain resolution parameter (higher = more communities)',
|
|
508
|
+
default: 1.0,
|
|
509
|
+
},
|
|
510
|
+
drift: {
|
|
511
|
+
type: 'boolean',
|
|
512
|
+
description: 'Show only drift analysis (omit community member lists)',
|
|
513
|
+
default: false,
|
|
514
|
+
},
|
|
515
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
516
|
+
...PAGINATION_PROPS,
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
name: 'code_owners',
|
|
522
|
+
description:
|
|
523
|
+
'Show CODEOWNERS mapping for files and functions. Shows ownership coverage, per-owner breakdown, and cross-owner boundary edges.',
|
|
524
|
+
inputSchema: {
|
|
525
|
+
type: 'object',
|
|
526
|
+
properties: {
|
|
527
|
+
file: { type: 'string', description: 'Scope to a specific file (partial match)' },
|
|
528
|
+
owner: { type: 'string', description: 'Filter to a specific owner (e.g. @team-name)' },
|
|
529
|
+
boundary: {
|
|
530
|
+
type: 'boolean',
|
|
531
|
+
description: 'Show cross-owner boundary edges',
|
|
532
|
+
default: false,
|
|
533
|
+
},
|
|
534
|
+
kind: {
|
|
535
|
+
type: 'string',
|
|
536
|
+
description: 'Filter by symbol kind (function, method, class, etc.)',
|
|
537
|
+
},
|
|
538
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: 'audit',
|
|
544
|
+
description:
|
|
545
|
+
'Composite report combining explain, fn-impact, and health metrics for a file or function. Returns structure, blast radius, complexity, and threshold breaches in one call.',
|
|
546
|
+
inputSchema: {
|
|
547
|
+
type: 'object',
|
|
548
|
+
properties: {
|
|
549
|
+
target: { type: 'string', description: 'File path or function name' },
|
|
550
|
+
quick: {
|
|
551
|
+
type: 'boolean',
|
|
552
|
+
description: 'Structural summary only (skip impact + health)',
|
|
553
|
+
default: false,
|
|
554
|
+
},
|
|
555
|
+
depth: { type: 'number', description: 'Impact analysis depth (default: 3)', default: 3 },
|
|
556
|
+
file: { type: 'string', description: 'Scope to file (partial match)' },
|
|
557
|
+
kind: {
|
|
558
|
+
type: 'string',
|
|
559
|
+
description: 'Filter by symbol kind (function, method, class, etc.)',
|
|
560
|
+
},
|
|
561
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
562
|
+
...PAGINATION_PROPS,
|
|
563
|
+
},
|
|
564
|
+
required: ['target'],
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: 'batch_query',
|
|
569
|
+
description:
|
|
570
|
+
'Run a query command against multiple targets in one call. Returns all results in a single JSON payload — ideal for multi-agent dispatch.',
|
|
571
|
+
inputSchema: {
|
|
572
|
+
type: 'object',
|
|
573
|
+
properties: {
|
|
574
|
+
command: {
|
|
575
|
+
type: 'string',
|
|
576
|
+
enum: [
|
|
577
|
+
'fn-impact',
|
|
578
|
+
'context',
|
|
579
|
+
'explain',
|
|
580
|
+
'where',
|
|
581
|
+
'query',
|
|
582
|
+
'impact',
|
|
583
|
+
'deps',
|
|
584
|
+
'flow',
|
|
585
|
+
'dataflow',
|
|
586
|
+
'complexity',
|
|
587
|
+
],
|
|
588
|
+
description: 'The query command to run for each target',
|
|
589
|
+
},
|
|
590
|
+
targets: {
|
|
591
|
+
type: 'array',
|
|
592
|
+
items: { type: 'string' },
|
|
593
|
+
description: 'List of target names (symbol names or file paths depending on command)',
|
|
594
|
+
},
|
|
595
|
+
depth: {
|
|
596
|
+
type: 'number',
|
|
597
|
+
description: 'Traversal depth (for fn-impact, context, fn, flow)',
|
|
598
|
+
},
|
|
599
|
+
file: {
|
|
600
|
+
type: 'string',
|
|
601
|
+
description: 'Scope to file (partial match)',
|
|
602
|
+
},
|
|
603
|
+
kind: {
|
|
604
|
+
type: 'string',
|
|
605
|
+
enum: EVERY_SYMBOL_KIND,
|
|
606
|
+
description: 'Filter symbol kind',
|
|
607
|
+
},
|
|
608
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
609
|
+
},
|
|
610
|
+
required: ['command', 'targets'],
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
name: 'triage',
|
|
615
|
+
description:
|
|
616
|
+
'Ranked audit queue by composite risk score. Merges connectivity (fan-in), complexity (cognitive), churn (commit count), role classification, and maintainability index into a single weighted score.',
|
|
617
|
+
inputSchema: {
|
|
618
|
+
type: 'object',
|
|
619
|
+
properties: {
|
|
620
|
+
level: {
|
|
621
|
+
type: 'string',
|
|
622
|
+
enum: ['function', 'file', 'directory'],
|
|
623
|
+
description:
|
|
624
|
+
'Granularity: function (default) | file | directory. File/directory shows hotspots',
|
|
625
|
+
},
|
|
626
|
+
sort: {
|
|
627
|
+
type: 'string',
|
|
628
|
+
enum: ['risk', 'complexity', 'churn', 'fan-in', 'mi'],
|
|
629
|
+
description: 'Sort metric (default: risk)',
|
|
630
|
+
},
|
|
631
|
+
min_score: {
|
|
632
|
+
type: 'number',
|
|
633
|
+
description: 'Only return symbols with risk score >= this threshold (0-1)',
|
|
634
|
+
},
|
|
635
|
+
role: {
|
|
636
|
+
type: 'string',
|
|
637
|
+
enum: VALID_ROLES,
|
|
638
|
+
description: 'Filter by role classification',
|
|
639
|
+
},
|
|
640
|
+
file: { type: 'string', description: 'Scope to file (partial match)' },
|
|
641
|
+
kind: {
|
|
642
|
+
type: 'string',
|
|
643
|
+
enum: ['function', 'method', 'class'],
|
|
644
|
+
description: 'Filter by symbol kind',
|
|
645
|
+
},
|
|
646
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
647
|
+
weights: {
|
|
648
|
+
type: 'object',
|
|
649
|
+
description:
|
|
650
|
+
'Custom scoring weights (e.g. {"fanIn":1,"complexity":0,"churn":0,"role":0,"mi":0})',
|
|
651
|
+
},
|
|
652
|
+
...PAGINATION_PROPS,
|
|
653
|
+
},
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
name: 'branch_compare',
|
|
658
|
+
description:
|
|
659
|
+
'Compare code structure between two git refs (branches, tags, commits). Shows added/removed/changed symbols and transitive caller impact using temporary git worktrees.',
|
|
660
|
+
inputSchema: {
|
|
661
|
+
type: 'object',
|
|
662
|
+
properties: {
|
|
663
|
+
base: { type: 'string', description: 'Base git ref (branch, tag, or commit SHA)' },
|
|
664
|
+
target: { type: 'string', description: 'Target git ref to compare against base' },
|
|
665
|
+
depth: { type: 'number', description: 'Max transitive caller depth', default: 3 },
|
|
666
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
667
|
+
format: {
|
|
668
|
+
type: 'string',
|
|
669
|
+
enum: ['json', 'mermaid'],
|
|
670
|
+
description: 'Output format (default: json)',
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
required: ['base', 'target'],
|
|
674
|
+
},
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
name: 'cfg',
|
|
678
|
+
description: 'Show intraprocedural control flow graph for a function.',
|
|
679
|
+
inputSchema: {
|
|
680
|
+
type: 'object',
|
|
681
|
+
properties: {
|
|
682
|
+
name: { type: 'string', description: 'Function/method name (partial match)' },
|
|
683
|
+
format: {
|
|
684
|
+
type: 'string',
|
|
685
|
+
enum: ['json', 'dot', 'mermaid'],
|
|
686
|
+
description: 'Output format (default: json)',
|
|
687
|
+
},
|
|
688
|
+
file: { type: 'string', description: 'Scope to file (partial match)' },
|
|
689
|
+
kind: { type: 'string', enum: EVERY_SYMBOL_KIND, description: 'Filter by symbol kind' },
|
|
690
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
691
|
+
...PAGINATION_PROPS,
|
|
692
|
+
},
|
|
693
|
+
required: ['name'],
|
|
694
|
+
},
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
name: 'dataflow',
|
|
698
|
+
description: 'Show data flow edges or data-dependent blast radius.',
|
|
699
|
+
inputSchema: {
|
|
700
|
+
type: 'object',
|
|
701
|
+
properties: {
|
|
702
|
+
name: { type: 'string', description: 'Function/method name (partial match)' },
|
|
703
|
+
mode: {
|
|
704
|
+
type: 'string',
|
|
705
|
+
enum: ['edges', 'impact'],
|
|
706
|
+
description: 'edges (default) or impact',
|
|
707
|
+
},
|
|
708
|
+
depth: { type: 'number', description: 'Max depth for impact mode', default: 5 },
|
|
709
|
+
file: { type: 'string', description: 'Scope to file (partial match)' },
|
|
710
|
+
kind: { type: 'string', enum: EVERY_SYMBOL_KIND, description: 'Filter by symbol kind' },
|
|
711
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
712
|
+
...PAGINATION_PROPS,
|
|
713
|
+
},
|
|
714
|
+
required: ['name'],
|
|
715
|
+
},
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
name: 'check',
|
|
719
|
+
description:
|
|
720
|
+
'CI gate: run manifesto rules (no args), diff predicates (with ref/staged), or both (with rules flag). Returns pass/fail verdicts.',
|
|
721
|
+
inputSchema: {
|
|
722
|
+
type: 'object',
|
|
723
|
+
properties: {
|
|
724
|
+
ref: { type: 'string', description: 'Git ref to diff against (default: HEAD)' },
|
|
725
|
+
staged: { type: 'boolean', description: 'Analyze staged changes instead of unstaged' },
|
|
726
|
+
rules: {
|
|
727
|
+
type: 'boolean',
|
|
728
|
+
description: 'Also run manifesto rules alongside diff predicates',
|
|
729
|
+
},
|
|
730
|
+
cycles: { type: 'boolean', description: 'Enable cycles predicate (default: true)' },
|
|
731
|
+
blast_radius: {
|
|
732
|
+
type: 'number',
|
|
733
|
+
description: 'Max transitive callers threshold (null = disabled)',
|
|
734
|
+
},
|
|
735
|
+
signatures: { type: 'boolean', description: 'Enable signatures predicate (default: true)' },
|
|
736
|
+
boundaries: { type: 'boolean', description: 'Enable boundaries predicate (default: true)' },
|
|
737
|
+
depth: { type: 'number', description: 'Max BFS depth for blast radius (default: 3)' },
|
|
738
|
+
file: { type: 'string', description: 'Scope to file (partial match, manifesto mode)' },
|
|
739
|
+
kind: {
|
|
740
|
+
type: 'string',
|
|
741
|
+
description: 'Filter by symbol kind (manifesto mode)',
|
|
742
|
+
},
|
|
743
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
744
|
+
...PAGINATION_PROPS,
|
|
745
|
+
},
|
|
746
|
+
},
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
name: 'ast_query',
|
|
750
|
+
description:
|
|
751
|
+
'Search stored AST nodes (calls, literals, new, throw, await) by pattern. Requires a prior build.',
|
|
752
|
+
inputSchema: {
|
|
753
|
+
type: 'object',
|
|
754
|
+
properties: {
|
|
755
|
+
pattern: {
|
|
756
|
+
type: 'string',
|
|
757
|
+
description: 'GLOB pattern for node name (auto-wrapped in *..* for substring match)',
|
|
758
|
+
},
|
|
759
|
+
kind: {
|
|
760
|
+
type: 'string',
|
|
761
|
+
enum: AST_NODE_KINDS,
|
|
762
|
+
description: 'Filter by AST node kind',
|
|
763
|
+
},
|
|
764
|
+
file: { type: 'string', description: 'Scope to file (partial match)' },
|
|
765
|
+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
|
|
766
|
+
...PAGINATION_PROPS,
|
|
767
|
+
},
|
|
768
|
+
},
|
|
769
|
+
},
|
|
770
|
+
];
|
|
771
|
+
|
|
772
|
+
const LIST_REPOS_TOOL = {
|
|
773
|
+
name: 'list_repos',
|
|
774
|
+
description: 'List all repositories registered in the codegraph registry',
|
|
775
|
+
inputSchema: {
|
|
776
|
+
type: 'object',
|
|
777
|
+
properties: {},
|
|
778
|
+
},
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Build the tool list based on multi-repo mode.
|
|
783
|
+
* @param {boolean} multiRepo - If true, inject `repo` prop into each tool and append `list_repos`
|
|
784
|
+
* @returns {object[]}
|
|
785
|
+
*/
|
|
786
|
+
export function buildToolList(multiRepo) {
|
|
787
|
+
if (!multiRepo) return BASE_TOOLS;
|
|
788
|
+
return [
|
|
789
|
+
...BASE_TOOLS.map((tool) => ({
|
|
790
|
+
...tool,
|
|
791
|
+
inputSchema: {
|
|
792
|
+
...tool.inputSchema,
|
|
793
|
+
properties: { ...tool.inputSchema.properties, ...REPO_PROP },
|
|
794
|
+
},
|
|
795
|
+
})),
|
|
796
|
+
LIST_REPOS_TOOL,
|
|
797
|
+
];
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// Backward-compatible export: full multi-repo tool list
|
|
801
|
+
export const TOOLS = buildToolList(true);
|