kotadb 2.1.0-next.20260203224441 → 2.1.0-next.20260203233957
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/package.json +1 -1
- package/src/cli/args.ts +105 -0
- package/src/cli.ts +72 -4
- package/src/mcp/server.ts +22 -25
- package/src/mcp/tools.ts +73 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kotadb",
|
|
3
|
-
"version": "2.1.0-next.
|
|
3
|
+
"version": "2.1.0-next.20260203233957",
|
|
4
4
|
"description": "Local-only code intelligence tool for CLI agents. SQLite-backed repository indexing and code search via MCP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "src/index.ts",
|
package/src/cli/args.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI argument parsing utilities
|
|
3
|
+
*
|
|
4
|
+
* Extracted for testability. Used by main CLI entry point.
|
|
5
|
+
*
|
|
6
|
+
* @module cli/args
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Valid toolset tiers for MCP tool selection
|
|
11
|
+
* - default: 8 tools (core + sync)
|
|
12
|
+
* - core: 6 tools
|
|
13
|
+
* - memory: 14 tools (core + sync + memory)
|
|
14
|
+
* - full: 20 tools (all)
|
|
15
|
+
*/
|
|
16
|
+
export type ToolsetTier = "default" | "core" | "memory" | "full";
|
|
17
|
+
|
|
18
|
+
const VALID_TOOLSET_TIERS: ToolsetTier[] = ["default", "core", "memory", "full"];
|
|
19
|
+
|
|
20
|
+
export interface CliOptions {
|
|
21
|
+
port: number;
|
|
22
|
+
help: boolean;
|
|
23
|
+
version: boolean;
|
|
24
|
+
stdio: boolean;
|
|
25
|
+
toolset: ToolsetTier;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Type guard for valid toolset tier
|
|
30
|
+
*/
|
|
31
|
+
export function isValidToolsetTier(value: string): value is ToolsetTier {
|
|
32
|
+
return VALID_TOOLSET_TIERS.includes(value as ToolsetTier);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Parse CLI arguments into options object
|
|
37
|
+
*/
|
|
38
|
+
export function parseArgs(args: string[]): CliOptions {
|
|
39
|
+
const options: CliOptions = {
|
|
40
|
+
port: Number(process.env.PORT ?? 3000),
|
|
41
|
+
help: false,
|
|
42
|
+
version: false,
|
|
43
|
+
stdio: false,
|
|
44
|
+
toolset: "default",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
for (let i = 0; i < args.length; i++) {
|
|
48
|
+
const arg = args[i];
|
|
49
|
+
if (arg === undefined) continue;
|
|
50
|
+
|
|
51
|
+
if (arg === "--help" || arg === "-h") {
|
|
52
|
+
options.help = true;
|
|
53
|
+
} else if (arg === "--version" || arg === "-v") {
|
|
54
|
+
options.version = true;
|
|
55
|
+
} else if (arg === "--stdio") {
|
|
56
|
+
options.stdio = true;
|
|
57
|
+
} else if (arg === "--port") {
|
|
58
|
+
const portStr = args[++i];
|
|
59
|
+
if (!portStr || Number.isNaN(Number(portStr))) {
|
|
60
|
+
process.stderr.write("Error: --port requires a valid number\n");
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
options.port = Number(portStr);
|
|
64
|
+
} else if (arg.startsWith("--port=")) {
|
|
65
|
+
const portStr = arg.split("=")[1];
|
|
66
|
+
if (portStr === undefined || Number.isNaN(Number(portStr))) {
|
|
67
|
+
process.stderr.write("Error: --port requires a valid number\n");
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
options.port = Number(portStr);
|
|
71
|
+
} else if (arg === "--toolset") {
|
|
72
|
+
const tierStr = args[++i];
|
|
73
|
+
if (!tierStr) {
|
|
74
|
+
process.stderr.write("Error: --toolset requires a tier value\n");
|
|
75
|
+
process.stderr.write("Valid tiers: default, core, memory, full\n");
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
if (!isValidToolsetTier(tierStr)) {
|
|
79
|
+
process.stderr.write(`Error: Invalid toolset tier '${tierStr}'\n`);
|
|
80
|
+
process.stderr.write("Valid tiers: default, core, memory, full\n");
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
options.toolset = tierStr;
|
|
84
|
+
} else if (arg.startsWith("--toolset=")) {
|
|
85
|
+
const tierStr = arg.split("=")[1];
|
|
86
|
+
if (tierStr === undefined || tierStr === "") {
|
|
87
|
+
process.stderr.write("Error: --toolset requires a tier value\n");
|
|
88
|
+
process.stderr.write("Valid tiers: default, core, memory, full\n");
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
if (!isValidToolsetTier(tierStr)) {
|
|
92
|
+
process.stderr.write(`Error: Invalid toolset tier '${tierStr}'\n`);
|
|
93
|
+
process.stderr.write("Valid tiers: default, core, memory, full\n");
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
options.toolset = tierStr;
|
|
97
|
+
} else if (arg.startsWith("-") && arg !== "-") {
|
|
98
|
+
process.stderr.write(`Unknown option: ${arg}\n`);
|
|
99
|
+
process.stderr.write("Use --help for usage information\n");
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return options;
|
|
105
|
+
}
|
package/src/cli.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* kotadb Start the MCP server (default port 3000)
|
|
10
10
|
* kotadb --stdio Start in stdio mode (for Claude Code integration)
|
|
11
11
|
* kotadb --port 4000 Start on custom port
|
|
12
|
+
* kotadb --toolset full Select tool tier (default, core, memory, full)
|
|
12
13
|
* kotadb --version Show version
|
|
13
14
|
* kotadb --help Show help
|
|
14
15
|
* kotadb deps Query dependency information for a file
|
|
@@ -25,11 +26,23 @@ import { fileURLToPath } from "node:url";
|
|
|
25
26
|
|
|
26
27
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Valid toolset tiers for MCP tool selection
|
|
31
|
+
* - default: 8 tools (core + sync)
|
|
32
|
+
* - core: 6 tools
|
|
33
|
+
* - memory: 14 tools (core + sync + memory)
|
|
34
|
+
* - full: 20 tools (all)
|
|
35
|
+
*/
|
|
36
|
+
export type ToolsetTier = "default" | "core" | "memory" | "full";
|
|
37
|
+
|
|
38
|
+
const VALID_TOOLSET_TIERS: ToolsetTier[] = ["default", "core", "memory", "full"];
|
|
39
|
+
|
|
28
40
|
interface CliOptions {
|
|
29
41
|
port: number;
|
|
30
42
|
help: boolean;
|
|
31
43
|
version: boolean;
|
|
32
44
|
stdio: boolean;
|
|
45
|
+
toolset: ToolsetTier;
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
function getVersion(): string {
|
|
@@ -70,6 +83,12 @@ COMMANDS:
|
|
|
70
83
|
OPTIONS:
|
|
71
84
|
--stdio Use stdio transport (for Claude Code integration)
|
|
72
85
|
--port <number> Port to listen on (default: 3000, env: PORT)
|
|
86
|
+
--toolset <tier> Select tool tier (default: default)
|
|
87
|
+
Tiers:
|
|
88
|
+
default 8 tools (core + sync)
|
|
89
|
+
core 6 tools (search, index, deps, impact)
|
|
90
|
+
memory 14 tools (core + sync + memory layer)
|
|
91
|
+
full 20 tools (all available tools)
|
|
73
92
|
--version, -v Show version number
|
|
74
93
|
--help, -h Show this help message
|
|
75
94
|
|
|
@@ -81,6 +100,8 @@ ENVIRONMENT VARIABLES:
|
|
|
81
100
|
|
|
82
101
|
EXAMPLES:
|
|
83
102
|
kotadb --stdio Start in stdio mode (for Claude Code)
|
|
103
|
+
kotadb --stdio --toolset full Start with all tools enabled
|
|
104
|
+
kotadb --stdio --toolset core Start with minimal core tools
|
|
84
105
|
kotadb Start HTTP server on port 3000
|
|
85
106
|
kotadb --port 4000 Start HTTP server on port 4000
|
|
86
107
|
kotadb deps --file src/db/client.ts Query deps for a file (text)
|
|
@@ -99,6 +120,17 @@ MCP CONFIGURATION (stdio mode - RECOMMENDED):
|
|
|
99
120
|
}
|
|
100
121
|
}
|
|
101
122
|
|
|
123
|
+
With toolset selection:
|
|
124
|
+
|
|
125
|
+
{
|
|
126
|
+
"mcpServers": {
|
|
127
|
+
"kotadb": {
|
|
128
|
+
"command": "bunx",
|
|
129
|
+
"args": ["kotadb@next", "--stdio", "--toolset", "full"]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
102
134
|
MCP CONFIGURATION (HTTP mode - legacy):
|
|
103
135
|
Add to your .mcp.json or Claude Code settings:
|
|
104
136
|
|
|
@@ -126,12 +158,17 @@ function printVersion(): void {
|
|
|
126
158
|
process.stdout.write(`kotadb v${version}\n`);
|
|
127
159
|
}
|
|
128
160
|
|
|
161
|
+
function isValidToolsetTier(value: string): value is ToolsetTier {
|
|
162
|
+
return VALID_TOOLSET_TIERS.includes(value as ToolsetTier);
|
|
163
|
+
}
|
|
164
|
+
|
|
129
165
|
function parseArgs(args: string[]): CliOptions {
|
|
130
166
|
const options: CliOptions = {
|
|
131
167
|
port: Number(process.env.PORT ?? 3000),
|
|
132
168
|
help: false,
|
|
133
169
|
version: false,
|
|
134
170
|
stdio: false,
|
|
171
|
+
toolset: "default",
|
|
135
172
|
};
|
|
136
173
|
|
|
137
174
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -158,6 +195,32 @@ function parseArgs(args: string[]): CliOptions {
|
|
|
158
195
|
process.exit(1);
|
|
159
196
|
}
|
|
160
197
|
options.port = Number(portStr);
|
|
198
|
+
} else if (arg === "--toolset") {
|
|
199
|
+
const tierStr = args[++i];
|
|
200
|
+
if (!tierStr) {
|
|
201
|
+
process.stderr.write("Error: --toolset requires a tier value\n");
|
|
202
|
+
process.stderr.write("Valid tiers: default, core, memory, full\n");
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
205
|
+
if (!isValidToolsetTier(tierStr)) {
|
|
206
|
+
process.stderr.write(`Error: Invalid toolset tier '${tierStr}'\n`);
|
|
207
|
+
process.stderr.write("Valid tiers: default, core, memory, full\n");
|
|
208
|
+
process.exit(1);
|
|
209
|
+
}
|
|
210
|
+
options.toolset = tierStr;
|
|
211
|
+
} else if (arg.startsWith("--toolset=")) {
|
|
212
|
+
const tierStr = arg.split("=")[1];
|
|
213
|
+
if (tierStr === undefined || tierStr === "") {
|
|
214
|
+
process.stderr.write("Error: --toolset requires a tier value\n");
|
|
215
|
+
process.stderr.write("Valid tiers: default, core, memory, full\n");
|
|
216
|
+
process.exit(1);
|
|
217
|
+
}
|
|
218
|
+
if (!isValidToolsetTier(tierStr)) {
|
|
219
|
+
process.stderr.write(`Error: Invalid toolset tier '${tierStr}'\n`);
|
|
220
|
+
process.stderr.write("Valid tiers: default, core, memory, full\n");
|
|
221
|
+
process.exit(1);
|
|
222
|
+
}
|
|
223
|
+
options.toolset = tierStr;
|
|
161
224
|
} else if (arg.startsWith("-") && arg !== "-") {
|
|
162
225
|
process.stderr.write(`Unknown option: ${arg}\n`);
|
|
163
226
|
process.stderr.write("Use --help for usage information\n");
|
|
@@ -168,7 +231,7 @@ function parseArgs(args: string[]): CliOptions {
|
|
|
168
231
|
return options;
|
|
169
232
|
}
|
|
170
233
|
|
|
171
|
-
async function runStdioMode(): Promise<void> {
|
|
234
|
+
async function runStdioMode(toolset: ToolsetTier): Promise<void> {
|
|
172
235
|
// Redirect logger to stderr in stdio mode
|
|
173
236
|
// This is CRITICAL - stdout is reserved for JSON-RPC protocol
|
|
174
237
|
const logger = createLogger({
|
|
@@ -178,11 +241,13 @@ async function runStdioMode(): Promise<void> {
|
|
|
178
241
|
|
|
179
242
|
logger.info("KotaDB MCP server starting in stdio mode", {
|
|
180
243
|
version: getVersion(),
|
|
244
|
+
toolset,
|
|
181
245
|
});
|
|
182
246
|
|
|
183
|
-
// Create MCP server with local-only context
|
|
247
|
+
// Create MCP server with local-only context and toolset
|
|
184
248
|
const context: McpServerContext = {
|
|
185
249
|
userId: "local", // Local-only mode uses fixed user ID
|
|
250
|
+
toolset,
|
|
186
251
|
};
|
|
187
252
|
const server = createMcpServer(context);
|
|
188
253
|
|
|
@@ -192,7 +257,7 @@ async function runStdioMode(): Promise<void> {
|
|
|
192
257
|
// Connect server to transport
|
|
193
258
|
await server.connect(transport);
|
|
194
259
|
|
|
195
|
-
logger.info("KotaDB MCP server connected via stdio");
|
|
260
|
+
logger.info("KotaDB MCP server connected via stdio", { toolset });
|
|
196
261
|
|
|
197
262
|
// Server lifecycle is managed by the transport
|
|
198
263
|
// Process will stay alive until stdin closes (when Claude Code terminates it)
|
|
@@ -234,7 +299,7 @@ async function main(): Promise<void> {
|
|
|
234
299
|
|
|
235
300
|
// Handle stdio mode
|
|
236
301
|
if (options.stdio) {
|
|
237
|
-
await runStdioMode();
|
|
302
|
+
await runStdioMode(options.toolset);
|
|
238
303
|
return; // runStdioMode() keeps process alive
|
|
239
304
|
}
|
|
240
305
|
|
|
@@ -247,6 +312,7 @@ async function main(): Promise<void> {
|
|
|
247
312
|
mode: envConfig.mode,
|
|
248
313
|
port: options.port,
|
|
249
314
|
localDbPath: envConfig.localDbPath,
|
|
315
|
+
toolset: options.toolset,
|
|
250
316
|
});
|
|
251
317
|
|
|
252
318
|
const app = createExpressApp();
|
|
@@ -256,6 +322,7 @@ async function main(): Promise<void> {
|
|
|
256
322
|
port: options.port,
|
|
257
323
|
mcp_endpoint: `http://localhost:${options.port}/mcp`,
|
|
258
324
|
health_endpoint: `http://localhost:${options.port}/health`,
|
|
325
|
+
toolset: options.toolset,
|
|
259
326
|
});
|
|
260
327
|
|
|
261
328
|
// Print user-friendly startup message
|
|
@@ -265,6 +332,7 @@ async function main(): Promise<void> {
|
|
|
265
332
|
process.stdout.write(` MCP Endpoint: http://localhost:${options.port}/mcp\n`);
|
|
266
333
|
process.stdout.write(` Health Check: http://localhost:${options.port}/health\n`);
|
|
267
334
|
process.stdout.write(` Database: ${envConfig.localDbPath}\n`);
|
|
335
|
+
process.stdout.write(` Toolset: ${options.toolset}\n`);
|
|
268
336
|
process.stdout.write(`\n`);
|
|
269
337
|
process.stdout.write(`Press Ctrl+C to stop\n`);
|
|
270
338
|
process.stdout.write(`\n`);
|
package/src/mcp/server.ts
CHANGED
|
@@ -57,10 +57,21 @@ import {
|
|
|
57
57
|
executeValidateExpertise,
|
|
58
58
|
executeSyncExpertise,
|
|
59
59
|
executeGetRecentPatterns,
|
|
60
|
+
// Tool filtering
|
|
61
|
+
filterToolsByTier,
|
|
60
62
|
} from "./tools";
|
|
61
63
|
|
|
62
64
|
const logger = createLogger({ module: "mcp-server" });
|
|
63
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Valid toolset tiers for MCP tool selection
|
|
68
|
+
* - default: 8 tools (core + sync)
|
|
69
|
+
* - core: 6 tools
|
|
70
|
+
* - memory: 14 tools (core + sync + memory)
|
|
71
|
+
* - full: 20 tools (all)
|
|
72
|
+
*/
|
|
73
|
+
export type ToolsetTier = "default" | "core" | "memory" | "full";
|
|
74
|
+
|
|
64
75
|
/**
|
|
65
76
|
* MCP Server context passed to tool handlers via closure
|
|
66
77
|
*
|
|
@@ -68,6 +79,7 @@ const logger = createLogger({ module: "mcp-server" });
|
|
|
68
79
|
*/
|
|
69
80
|
export interface McpServerContext {
|
|
70
81
|
userId: string;
|
|
82
|
+
toolset?: ToolsetTier;
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
/**
|
|
@@ -107,35 +119,20 @@ export function createMcpServer(context: McpServerContext): Server {
|
|
|
107
119
|
},
|
|
108
120
|
);
|
|
109
121
|
|
|
110
|
-
// Register tools/list handler -
|
|
122
|
+
// Register tools/list handler - filter by toolset tier
|
|
111
123
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
124
|
+
const tier = context.toolset || "default";
|
|
125
|
+
const filteredTools = filterToolsByTier(tier);
|
|
126
|
+
|
|
127
|
+
logger.debug("Listing MCP tools", {
|
|
128
|
+
tier,
|
|
129
|
+
tool_count: filteredTools.length
|
|
130
|
+
});
|
|
131
|
+
|
|
112
132
|
return {
|
|
113
|
-
tools:
|
|
114
|
-
SEARCH_CODE_TOOL,
|
|
115
|
-
INDEX_REPOSITORY_TOOL,
|
|
116
|
-
LIST_RECENT_FILES_TOOL,
|
|
117
|
-
SEARCH_DEPENDENCIES_TOOL,
|
|
118
|
-
ANALYZE_CHANGE_IMPACT_TOOL,
|
|
119
|
-
VALIDATE_IMPLEMENTATION_SPEC_TOOL,
|
|
120
|
-
SYNC_EXPORT_TOOL,
|
|
121
|
-
SYNC_IMPORT_TOOL,
|
|
122
|
-
GENERATE_TASK_CONTEXT_TOOL,
|
|
123
|
-
// Memory Layer tools
|
|
124
|
-
SEARCH_DECISIONS_TOOL,
|
|
125
|
-
RECORD_DECISION_TOOL,
|
|
126
|
-
SEARCH_FAILURES_TOOL,
|
|
127
|
-
RECORD_FAILURE_TOOL,
|
|
128
|
-
SEARCH_PATTERNS_TOOL,
|
|
129
|
-
RECORD_INSIGHT_TOOL,
|
|
130
|
-
// Dynamic Expertise tools
|
|
131
|
-
GET_DOMAIN_KEY_FILES_TOOL,
|
|
132
|
-
VALIDATE_EXPERTISE_TOOL,
|
|
133
|
-
SYNC_EXPERTISE_TOOL,
|
|
134
|
-
GET_RECENT_PATTERNS_TOOL,
|
|
135
|
-
],
|
|
133
|
+
tools: filteredTools,
|
|
136
134
|
};
|
|
137
135
|
});
|
|
138
|
-
|
|
139
136
|
// Register tools/call handler
|
|
140
137
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
141
138
|
const { name, arguments: toolArgs } = request.params;
|
package/src/mcp/tools.ts
CHANGED
|
@@ -34,8 +34,14 @@ const logger = createLogger({ module: "mcp-tools" });
|
|
|
34
34
|
/**
|
|
35
35
|
* MCP Tool Definition
|
|
36
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* Tool tier for categorizing tools by feature set
|
|
39
|
+
*/
|
|
40
|
+
export type ToolTier = "core" | "sync" | "memory" | "expertise";
|
|
41
|
+
|
|
37
42
|
export interface ToolDefinition {
|
|
38
43
|
name: string;
|
|
44
|
+
tier: ToolTier;
|
|
39
45
|
description: string;
|
|
40
46
|
inputSchema: {
|
|
41
47
|
type: "object";
|
|
@@ -45,11 +51,60 @@ export interface ToolDefinition {
|
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
/**
|
|
54
|
+
* Toolset tier for CLI selection (maps to tool tiers)
|
|
55
|
+
*/
|
|
56
|
+
export type ToolsetTier = "default" | "core" | "memory" | "full";
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Filter tools by the requested toolset tier
|
|
60
|
+
*
|
|
61
|
+
* Tier mapping:
|
|
62
|
+
* - core: 6 tools (core tier only)
|
|
63
|
+
* - default: 8 tools (core + sync tiers)
|
|
64
|
+
* - memory: 14 tools (core + sync + memory tiers)
|
|
65
|
+
* - full: all tools
|
|
66
|
+
*
|
|
67
|
+
* @param tier - The toolset tier to filter by
|
|
68
|
+
* @param tools - Optional array of tools (defaults to all tool definitions)
|
|
69
|
+
*/
|
|
70
|
+
export function filterToolsByTier(tier: ToolsetTier, tools?: ToolDefinition[]): ToolDefinition[] {
|
|
71
|
+
const allTools = tools ?? getToolDefinitions();
|
|
72
|
+
switch (tier) {
|
|
73
|
+
case "core":
|
|
74
|
+
return allTools.filter((t) => t.tier === "core");
|
|
75
|
+
case "default":
|
|
76
|
+
return allTools.filter((t) => t.tier === "core" || t.tier === "sync");
|
|
77
|
+
case "memory":
|
|
78
|
+
return allTools.filter((t) => t.tier === "core" || t.tier === "sync" || t.tier === "memory");
|
|
79
|
+
case "full":
|
|
80
|
+
return allTools;
|
|
81
|
+
default:
|
|
82
|
+
// Default to "default" tier if unknown
|
|
83
|
+
return allTools.filter((t) => t.tier === "core" || t.tier === "sync");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Alias for filterToolsByTier - get tool definitions filtered by toolset
|
|
89
|
+
*
|
|
90
|
+
* @param toolset - The toolset tier to filter by
|
|
91
|
+
*/
|
|
92
|
+
export function getToolsByTier(toolset: ToolsetTier): ToolDefinition[] {
|
|
93
|
+
return filterToolsByTier(toolset);
|
|
94
|
+
}
|
|
48
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Validate if a string is a valid toolset tier
|
|
98
|
+
*/
|
|
99
|
+
export function isValidToolset(value: string): value is ToolsetTier {
|
|
100
|
+
return value === "default" || value === "core" || value === "memory" || value === "full";
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
49
103
|
/**
|
|
50
104
|
* Tool: search_code
|
|
51
105
|
*/
|
|
52
106
|
export const SEARCH_CODE_TOOL: ToolDefinition = {
|
|
107
|
+
tier: "core",
|
|
53
108
|
name: "search_code",
|
|
54
109
|
description:
|
|
55
110
|
"Search indexed code files for a specific term. Returns matching files with context snippets.",
|
|
@@ -77,6 +132,7 @@ export const SEARCH_CODE_TOOL: ToolDefinition = {
|
|
|
77
132
|
* Tool: index_repository
|
|
78
133
|
*/
|
|
79
134
|
export const INDEX_REPOSITORY_TOOL: ToolDefinition = {
|
|
135
|
+
tier: "core",
|
|
80
136
|
name: "index_repository",
|
|
81
137
|
description:
|
|
82
138
|
"Index a git repository by cloning/updating it and extracting code files. Performs synchronous indexing and returns immediately with status 'completed' and full indexing stats.",
|
|
@@ -104,6 +160,7 @@ export const INDEX_REPOSITORY_TOOL: ToolDefinition = {
|
|
|
104
160
|
* Tool: list_recent_files
|
|
105
161
|
*/
|
|
106
162
|
export const LIST_RECENT_FILES_TOOL: ToolDefinition = {
|
|
163
|
+
tier: "core",
|
|
107
164
|
name: "list_recent_files",
|
|
108
165
|
description:
|
|
109
166
|
"List recently indexed files, ordered by indexing timestamp. Useful for seeing what code is available.",
|
|
@@ -126,6 +183,7 @@ export const LIST_RECENT_FILES_TOOL: ToolDefinition = {
|
|
|
126
183
|
* Tool: search_dependencies
|
|
127
184
|
*/
|
|
128
185
|
export const SEARCH_DEPENDENCIES_TOOL: ToolDefinition = {
|
|
186
|
+
tier: "core",
|
|
129
187
|
name: "search_dependencies",
|
|
130
188
|
description:
|
|
131
189
|
"Search the dependency graph to find files that depend on (dependents) or are depended on by (dependencies) a target file. Useful for impact analysis before refactoring, test scope discovery, and circular dependency detection.",
|
|
@@ -174,6 +232,7 @@ export const SEARCH_DEPENDENCIES_TOOL: ToolDefinition = {
|
|
|
174
232
|
* Tool: analyze_change_impact
|
|
175
233
|
*/
|
|
176
234
|
export const ANALYZE_CHANGE_IMPACT_TOOL: ToolDefinition = {
|
|
235
|
+
tier: "core",
|
|
177
236
|
name: "analyze_change_impact",
|
|
178
237
|
description:
|
|
179
238
|
"Analyze the impact of proposed code changes by examining dependency graphs, test scope, and potential conflicts. Returns comprehensive analysis including affected files, test recommendations, architectural warnings, and risk assessment. Useful for planning implementations and avoiding breaking changes.",
|
|
@@ -221,6 +280,7 @@ export const ANALYZE_CHANGE_IMPACT_TOOL: ToolDefinition = {
|
|
|
221
280
|
* Tool: validate_implementation_spec
|
|
222
281
|
*/
|
|
223
282
|
export const VALIDATE_IMPLEMENTATION_SPEC_TOOL: ToolDefinition = {
|
|
283
|
+
tier: "expertise",
|
|
224
284
|
name: "validate_implementation_spec",
|
|
225
285
|
description:
|
|
226
286
|
"Validate an implementation specification against KotaDB conventions and repository state. Checks for file conflicts, naming conventions, path alias usage, test coverage, and dependency compatibility. Returns validation errors, warnings, and approval conditions checklist.",
|
|
@@ -303,6 +363,7 @@ export const VALIDATE_IMPLEMENTATION_SPEC_TOOL: ToolDefinition = {
|
|
|
303
363
|
* Tool: kota_sync_export
|
|
304
364
|
*/
|
|
305
365
|
export const SYNC_EXPORT_TOOL: ToolDefinition = {
|
|
366
|
+
tier: "sync",
|
|
306
367
|
name: "kota_sync_export",
|
|
307
368
|
description:
|
|
308
369
|
"Export local SQLite database to JSONL files for git sync. Uses hash-based change detection to skip unchanged tables. Exports to .kotadb/export/ by default.",
|
|
@@ -325,6 +386,7 @@ export const SYNC_EXPORT_TOOL: ToolDefinition = {
|
|
|
325
386
|
* Tool: kota_sync_import
|
|
326
387
|
*/
|
|
327
388
|
export const SYNC_IMPORT_TOOL: ToolDefinition = {
|
|
389
|
+
tier: "sync",
|
|
328
390
|
name: "kota_sync_import",
|
|
329
391
|
description:
|
|
330
392
|
"Import JSONL files into local SQLite database. Applies deletion manifest first, then imports all tables transactionally. Typically run after git pull to sync remote changes.",
|
|
@@ -347,6 +409,7 @@ export const SYNC_IMPORT_TOOL: ToolDefinition = {
|
|
|
347
409
|
* Target: <100ms response time
|
|
348
410
|
*/
|
|
349
411
|
export const GENERATE_TASK_CONTEXT_TOOL: ToolDefinition = {
|
|
412
|
+
tier: "core",
|
|
350
413
|
name: "generate_task_context",
|
|
351
414
|
description:
|
|
352
415
|
"Generate structured context for a set of files including dependency counts, impacted files, test files, and recent changes. Designed for hook-based context injection with <100ms performance target.",
|
|
@@ -387,6 +450,7 @@ export const GENERATE_TASK_CONTEXT_TOOL: ToolDefinition = {
|
|
|
387
450
|
* Tool: search_decisions
|
|
388
451
|
*/
|
|
389
452
|
export const SEARCH_DECISIONS_TOOL: ToolDefinition = {
|
|
453
|
+
tier: "memory",
|
|
390
454
|
name: "search_decisions",
|
|
391
455
|
description:
|
|
392
456
|
"Search past architectural decisions using FTS5. Returns decisions with relevance scores.",
|
|
@@ -419,6 +483,7 @@ export const SEARCH_DECISIONS_TOOL: ToolDefinition = {
|
|
|
419
483
|
* Tool: record_decision
|
|
420
484
|
*/
|
|
421
485
|
export const RECORD_DECISION_TOOL: ToolDefinition = {
|
|
486
|
+
tier: "memory",
|
|
422
487
|
name: "record_decision",
|
|
423
488
|
description:
|
|
424
489
|
"Record a new architectural decision for future reference. Decisions are searchable via search_decisions.",
|
|
@@ -469,6 +534,7 @@ export const RECORD_DECISION_TOOL: ToolDefinition = {
|
|
|
469
534
|
* Tool: search_failures
|
|
470
535
|
*/
|
|
471
536
|
export const SEARCH_FAILURES_TOOL: ToolDefinition = {
|
|
537
|
+
tier: "memory",
|
|
472
538
|
name: "search_failures",
|
|
473
539
|
description:
|
|
474
540
|
"Search failed approaches to avoid repeating mistakes. Returns failures with relevance scores.",
|
|
@@ -496,6 +562,7 @@ export const SEARCH_FAILURES_TOOL: ToolDefinition = {
|
|
|
496
562
|
* Tool: record_failure
|
|
497
563
|
*/
|
|
498
564
|
export const RECORD_FAILURE_TOOL: ToolDefinition = {
|
|
565
|
+
tier: "memory",
|
|
499
566
|
name: "record_failure",
|
|
500
567
|
description:
|
|
501
568
|
"Record a failed approach for future reference. Helps agents avoid repeating mistakes.",
|
|
@@ -536,6 +603,7 @@ export const RECORD_FAILURE_TOOL: ToolDefinition = {
|
|
|
536
603
|
* Tool: search_patterns
|
|
537
604
|
*/
|
|
538
605
|
export const SEARCH_PATTERNS_TOOL: ToolDefinition = {
|
|
606
|
+
tier: "memory",
|
|
539
607
|
name: "search_patterns",
|
|
540
608
|
description:
|
|
541
609
|
"Find codebase patterns by type or file. Returns discovered patterns for consistency.",
|
|
@@ -570,6 +638,7 @@ export const SEARCH_PATTERNS_TOOL: ToolDefinition = {
|
|
|
570
638
|
* Tool: record_insight
|
|
571
639
|
*/
|
|
572
640
|
export const RECORD_INSIGHT_TOOL: ToolDefinition = {
|
|
641
|
+
tier: "memory",
|
|
573
642
|
name: "record_insight",
|
|
574
643
|
description:
|
|
575
644
|
"Store a session insight for future agents. Insights are discoveries, failures, or workarounds.",
|
|
@@ -611,6 +680,7 @@ export const RECORD_INSIGHT_TOOL: ToolDefinition = {
|
|
|
611
680
|
* Tool: get_domain_key_files
|
|
612
681
|
*/
|
|
613
682
|
export const GET_DOMAIN_KEY_FILES_TOOL: ToolDefinition = {
|
|
683
|
+
tier: "expertise",
|
|
614
684
|
name: "get_domain_key_files",
|
|
615
685
|
description:
|
|
616
686
|
"Get the most-depended-on files for a domain. Key files are core infrastructure that many other files depend on.",
|
|
@@ -638,6 +708,7 @@ export const GET_DOMAIN_KEY_FILES_TOOL: ToolDefinition = {
|
|
|
638
708
|
* Tool: validate_expertise
|
|
639
709
|
*/
|
|
640
710
|
export const VALIDATE_EXPERTISE_TOOL: ToolDefinition = {
|
|
711
|
+
tier: "expertise",
|
|
641
712
|
name: "validate_expertise",
|
|
642
713
|
description:
|
|
643
714
|
"Validate that key_files defined in expertise.yaml exist in the indexed codebase. Checks for stale or missing file references.",
|
|
@@ -657,6 +728,7 @@ export const VALIDATE_EXPERTISE_TOOL: ToolDefinition = {
|
|
|
657
728
|
* Tool: sync_expertise
|
|
658
729
|
*/
|
|
659
730
|
export const SYNC_EXPERTISE_TOOL: ToolDefinition = {
|
|
731
|
+
tier: "expertise",
|
|
660
732
|
name: "sync_expertise",
|
|
661
733
|
description:
|
|
662
734
|
"Sync patterns from expertise.yaml files to the patterns table. Extracts pattern definitions and stores them for future reference.",
|
|
@@ -679,6 +751,7 @@ export const SYNC_EXPERTISE_TOOL: ToolDefinition = {
|
|
|
679
751
|
* Tool: get_recent_patterns
|
|
680
752
|
*/
|
|
681
753
|
export const GET_RECENT_PATTERNS_TOOL: ToolDefinition = {
|
|
754
|
+
tier: "expertise",
|
|
682
755
|
name: "get_recent_patterns",
|
|
683
756
|
description:
|
|
684
757
|
"Get recently observed patterns from the patterns table. Useful for understanding codebase conventions.",
|
|
@@ -734,7 +807,6 @@ export function getToolDefinitions(): ToolDefinition[] {
|
|
|
734
807
|
GET_RECENT_PATTERNS_TOOL,
|
|
735
808
|
];
|
|
736
809
|
}
|
|
737
|
-
|
|
738
810
|
/**
|
|
739
811
|
|
|
740
812
|
/**
|