@gmickel/gno 1.41.0 → 1.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  * @module src/mcp/tools
5
5
  */
6
6
 
7
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
7
+ import type { McpServer } from "@modelcontextprotocol/server";
8
8
 
9
9
  import { z } from "zod";
10
10
 
@@ -18,6 +18,11 @@ import { CAPTURE_MAX_TEXT_BYTES } from "../../core/capture";
18
18
  import { NOTE_PRESETS, type NotePresetId } from "../../core/note-presets";
19
19
  import { RETRIEVAL_TRACE_METADATA } from "../../core/retrieval-trace-session";
20
20
  import { normalizeTag } from "../../core/tags";
21
+ import { profileToolDescription } from "../tool-descriptions-core";
22
+ import {
23
+ createProfileToolRegistrar,
24
+ DEFAULT_MCP_TOOL_PROFILE,
25
+ } from "../tool-profile";
21
26
  import { handleAddCollection } from "./add-collection";
22
27
  import { askInputSchema, handleAsk } from "./ask";
23
28
  import { AUDIT_MCP_ANNOTATIONS, auditInputSchema, handleAudit } from "./audit";
@@ -1027,16 +1032,22 @@ function parseErrorMessage(message: string): { [x: string]: unknown } {
1027
1032
 
1028
1033
  export function registerTools(server: McpServer, ctx: ToolContext): void {
1029
1034
  // Tool IDs use underscores (MCP pattern: ^[a-zA-Z0-9_-]{1,64}$)
1030
- server.registerTool(
1035
+ const profile = ctx.toolProfile ?? DEFAULT_MCP_TOOL_PROFILE;
1036
+ const registerTool = createProfileToolRegistrar(server, profile);
1037
+ // The core profile serves micro-instruction variants; full keeps the
1038
+ // original strings verbatim (legacy golden + tool-profile byte-compat).
1039
+ const describe = (name: string, fullDescription: string) =>
1040
+ profileToolDescription(profile, name, fullDescription);
1041
+ registerTool(
1031
1042
  "gno_context",
1032
1043
  {
1033
- description: MCP_TOOL_DESCRIPTIONS.context,
1044
+ description: describe("gno_context", MCP_TOOL_DESCRIPTIONS.context),
1034
1045
  inputSchema: contextBuildSurfaceSchema,
1035
1046
  },
1036
1047
  (args) => handleContext(args, ctx)
1037
1048
  );
1038
1049
 
1039
- server.registerTool(
1050
+ registerTool(
1040
1051
  "gno_context_verify",
1041
1052
  {
1042
1053
  description: MCP_TOOL_DESCRIPTIONS.contextVerify,
@@ -1045,63 +1056,78 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1045
1056
  (args) => handleContextVerify(args, ctx)
1046
1057
  );
1047
1058
 
1048
- server.tool(
1059
+ registerTool(
1049
1060
  "gno_ask",
1050
- MCP_TOOL_DESCRIPTIONS.ask,
1051
- askInputSchema.shape,
1061
+ {
1062
+ description: MCP_TOOL_DESCRIPTIONS.ask,
1063
+ // The advertised 2025-11-25 schema is the non-strict shape (SDK v1
1064
+ // registered `.shape`); the handler still parses with the strict schema.
1065
+ inputSchema: z.object(askInputSchema.shape),
1066
+ },
1052
1067
  (args) => handleAsk(args, ctx)
1053
1068
  );
1054
1069
 
1055
- server.registerTool(
1070
+ registerTool(
1056
1071
  "gno_recall",
1057
1072
  {
1058
- description: MCP_TOOL_DESCRIPTIONS.recall,
1073
+ description: describe("gno_recall", MCP_TOOL_DESCRIPTIONS.recall),
1059
1074
  inputSchema: recallInputSchema,
1060
1075
  annotations: RECALL_MCP_ANNOTATIONS,
1061
1076
  },
1062
- (args, extra) =>
1077
+ (args, request) =>
1063
1078
  handleRecall(args, ctx, {
1064
1079
  clientName: server.server.getClientVersion()?.name,
1065
- sessionId: extra.sessionId,
1080
+ sessionId: request.sessionId,
1081
+ requestIdentity: ctx.getRequestIdentity?.(),
1066
1082
  })
1067
1083
  );
1068
1084
 
1069
- server.tool(
1085
+ registerTool(
1070
1086
  "gno_search",
1071
- MCP_TOOL_DESCRIPTIONS.search,
1072
- searchInputSchema.shape,
1087
+ {
1088
+ description: describe("gno_search", MCP_TOOL_DESCRIPTIONS.search),
1089
+ inputSchema: searchInputSchema,
1090
+ },
1073
1091
  (args) => handleSearch(args, ctx)
1074
1092
  );
1075
1093
 
1076
- server.tool(
1094
+ registerTool(
1077
1095
  "gno_vsearch",
1078
- MCP_TOOL_DESCRIPTIONS.vsearch,
1079
- vsearchInputSchema.shape,
1096
+ {
1097
+ description: MCP_TOOL_DESCRIPTIONS.vsearch,
1098
+ inputSchema: vsearchInputSchema,
1099
+ },
1080
1100
  (args) => handleVsearch(args, ctx)
1081
1101
  );
1082
1102
 
1083
- server.tool(
1103
+ registerTool(
1084
1104
  "gno_query",
1085
- MCP_TOOL_DESCRIPTIONS.query,
1086
- queryInputSchema.shape,
1105
+ {
1106
+ description: describe("gno_query", MCP_TOOL_DESCRIPTIONS.query),
1107
+ inputSchema: queryInputSchema,
1108
+ },
1087
1109
  (args) => handleQuery(args, ctx)
1088
1110
  );
1089
1111
 
1090
- server.tool(
1112
+ registerTool(
1091
1113
  "gno_query_diagnose",
1092
- MCP_TOOL_DESCRIPTIONS.queryDiagnose,
1093
- queryDiagnoseInputSchema.shape,
1114
+ {
1115
+ description: MCP_TOOL_DESCRIPTIONS.queryDiagnose,
1116
+ inputSchema: queryDiagnoseInputSchema,
1117
+ },
1094
1118
  (args) => handleQueryDiagnose(args, ctx)
1095
1119
  );
1096
1120
 
1097
- server.tool(
1121
+ registerTool(
1098
1122
  "gno_get",
1099
- MCP_TOOL_DESCRIPTIONS.get,
1100
- getInputSchema.shape,
1123
+ {
1124
+ description: describe("gno_get", MCP_TOOL_DESCRIPTIONS.get),
1125
+ inputSchema: getInputSchema,
1126
+ },
1101
1127
  (args) => handleGet(args, ctx)
1102
1128
  );
1103
1129
 
1104
- server.registerTool(
1130
+ registerTool(
1105
1131
  "gno_section",
1106
1132
  {
1107
1133
  description: MCP_TOOL_DESCRIPTIONS.section,
@@ -1112,14 +1138,16 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1112
1138
  (args) => handleSection(args, ctx)
1113
1139
  );
1114
1140
 
1115
- server.tool(
1141
+ registerTool(
1116
1142
  "gno_multi_get",
1117
- MCP_TOOL_DESCRIPTIONS.multiGet,
1118
- multiGetInputSchema.shape,
1143
+ {
1144
+ description: describe("gno_multi_get", MCP_TOOL_DESCRIPTIONS.multiGet),
1145
+ inputSchema: multiGetInputSchema,
1146
+ },
1119
1147
  (args) => handleMultiGet(args, ctx)
1120
1148
  );
1121
1149
 
1122
- server.registerTool(
1150
+ registerTool(
1123
1151
  "gno_peek",
1124
1152
  {
1125
1153
  description: MCP_TOOL_DESCRIPTIONS.peek,
@@ -1129,24 +1157,26 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1129
1157
  (args) => handlePeek(args, ctx)
1130
1158
  );
1131
1159
 
1132
- server.tool(
1160
+ registerTool(
1133
1161
  "gno_status",
1134
- MCP_TOOL_DESCRIPTIONS.status,
1135
- statusInputSchema.shape,
1162
+ {
1163
+ description: MCP_TOOL_DESCRIPTIONS.status,
1164
+ inputSchema: statusInputSchema,
1165
+ },
1136
1166
  (args) => handleStatus(args, ctx)
1137
1167
  );
1138
1168
 
1139
- server.registerTool(
1169
+ registerTool(
1140
1170
  "gno_audit",
1141
1171
  {
1142
1172
  description: MCP_TOOL_DESCRIPTIONS.audit,
1143
1173
  inputSchema: auditInputSchema,
1144
1174
  annotations: AUDIT_MCP_ANNOTATIONS,
1145
1175
  },
1146
- (args, extra) => handleAudit(args, ctx, extra.signal)
1176
+ (args, request) => handleAudit(args, ctx, request.mcpReq.signal)
1147
1177
  );
1148
1178
 
1149
- server.registerTool(
1179
+ registerTool(
1150
1180
  "gno_egress_policy_get",
1151
1181
  {
1152
1182
  description:
@@ -1156,7 +1186,7 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1156
1186
  (args) => handleEgressPolicyGet(args, ctx)
1157
1187
  );
1158
1188
 
1159
- server.registerTool(
1189
+ registerTool(
1160
1190
  "gno_egress_check",
1161
1191
  {
1162
1192
  description:
@@ -1166,7 +1196,7 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1166
1196
  (args) => handleEgressCheck(args, ctx)
1167
1197
  );
1168
1198
 
1169
- server.registerTool(
1199
+ registerTool(
1170
1200
  "gno_egress_audit_list",
1171
1201
  {
1172
1202
  description:
@@ -1176,7 +1206,7 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1176
1206
  (args) => handleEgressAuditList(args, ctx)
1177
1207
  );
1178
1208
 
1179
- server.registerTool(
1209
+ registerTool(
1180
1210
  "gno_egress_audit_show",
1181
1211
  {
1182
1212
  description: "Inspect one content-free local egress decision receipt.",
@@ -1185,7 +1215,7 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1185
1215
  (args) => handleEgressAuditShow(args, ctx)
1186
1216
  );
1187
1217
 
1188
- server.registerTool(
1218
+ registerTool(
1189
1219
  "gno_egress_audit_status",
1190
1220
  {
1191
1221
  description: "Show local egress audit retention and storage status.",
@@ -1194,99 +1224,140 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1194
1224
  (args) => handleEgressAuditStatus(args, ctx)
1195
1225
  );
1196
1226
 
1197
- server.tool(
1227
+ registerTool(
1198
1228
  "gno_changes",
1199
- "List retained metadata-only document changes with opaque cursor pagination and retention disclosure.",
1200
- changesInputSchema.shape,
1229
+ {
1230
+ description: describe(
1231
+ "gno_changes",
1232
+ "List retained metadata-only document changes with opaque cursor pagination and retention disclosure."
1233
+ ),
1234
+ inputSchema: changesInputSchema,
1235
+ },
1201
1236
  (args) => handleChanges(args, ctx)
1202
1237
  );
1203
1238
 
1204
- server.tool(
1239
+ registerTool(
1205
1240
  "gno_diff",
1206
- "Inspect one retained metadata-only structural document change. Source bodies are never returned.",
1207
- diffInputSchema.shape,
1241
+ {
1242
+ description:
1243
+ "Inspect one retained metadata-only structural document change. Source bodies are never returned.",
1244
+ inputSchema: diffInputSchema,
1245
+ },
1208
1246
  (args) => handleDiff(args, ctx)
1209
1247
  );
1210
1248
 
1211
- server.tool(
1249
+ registerTool(
1212
1250
  "gno_impact",
1213
- "Find bounded inbound typed, wiki, and Markdown dependencies with deterministic evidence paths.",
1214
- impactInputSchema.shape,
1251
+ {
1252
+ description:
1253
+ "Find bounded inbound typed, wiki, and Markdown dependencies with deterministic evidence paths.",
1254
+ inputSchema: impactInputSchema,
1255
+ },
1215
1256
  (args) => handleImpact(args, ctx)
1216
1257
  );
1217
1258
 
1218
- server.tool(
1259
+ registerTool(
1219
1260
  "gno_trace_list",
1220
- "List bounded metadata-only summaries of private local retrieval traces. Raw replay queries are omitted from history.",
1221
- traceListInputSchema.shape,
1261
+ {
1262
+ description:
1263
+ "List bounded metadata-only summaries of private local retrieval traces. Raw replay queries are omitted from history.",
1264
+ inputSchema: traceListInputSchema,
1265
+ },
1222
1266
  (args) => handleTraceList(args, ctx)
1223
1267
  );
1224
1268
 
1225
- server.tool(
1269
+ registerTool(
1226
1270
  "gno_trace_show",
1227
- "Inspect one bounded local retrieval trace. Replay-mode content is returned only for the explicitly requested trace.",
1228
- traceShowInputSchema.shape,
1271
+ {
1272
+ description:
1273
+ "Inspect one bounded local retrieval trace. Replay-mode content is returned only for the explicitly requested trace.",
1274
+ inputSchema: traceShowInputSchema,
1275
+ },
1229
1276
  (args) => handleTraceShow(args, ctx)
1230
1277
  );
1231
1278
 
1232
- server.tool(
1279
+ registerTool(
1233
1280
  "gno_list_tags",
1234
- "List all tags with document counts. Use prefix to filter hierarchical tags (e.g. 'project/').",
1235
- listTagsInputSchema.shape,
1281
+ {
1282
+ description:
1283
+ "List all tags with document counts. Use prefix to filter hierarchical tags (e.g. 'project/').",
1284
+ inputSchema: listTagsInputSchema,
1285
+ },
1236
1286
  (args) => handleListTags(args, ctx)
1237
1287
  );
1238
1288
 
1239
- server.tool(
1289
+ registerTool(
1240
1290
  "gno_links",
1241
- "Get outgoing wiki ([[links]]) and markdown links from one document. Use after gno_query when you need immediate local expansion from a known source document; use gno_graph_neighbors for bidirectional graph navigation.",
1242
- linksInputSchema.shape,
1291
+ {
1292
+ description:
1293
+ "Get outgoing wiki ([[links]]) and markdown links from one document. Use after gno_query when you need immediate local expansion from a known source document; use gno_graph_neighbors for bidirectional graph navigation.",
1294
+ inputSchema: linksInputSchema,
1295
+ },
1243
1296
  (args) => handleLinks(args, ctx)
1244
1297
  );
1245
1298
 
1246
- server.tool(
1299
+ registerTool(
1247
1300
  "gno_backlinks",
1248
- "Find all documents that link TO a given document. Use after gno_query/gno_get to discover incoming references around a known target; use gno_graph_path for 'how are X and Y connected?' questions.",
1249
- backlinksInputSchema.shape,
1301
+ {
1302
+ description:
1303
+ "Find all documents that link TO a given document. Use after gno_query/gno_get to discover incoming references around a known target; use gno_graph_path for 'how are X and Y connected?' questions.",
1304
+ inputSchema: backlinksInputSchema,
1305
+ },
1250
1306
  (args) => handleBacklinks(args, ctx)
1251
1307
  );
1252
1308
 
1253
- server.tool(
1309
+ registerTool(
1254
1310
  "gno_similar",
1255
- "Find semantically similar documents using vector embeddings. Use for local expansion when wording differs; use gno_query as the default retrieval entry point and gno_graph_neighbors/path for explicit relationship questions.",
1256
- similarInputSchema.shape,
1311
+ {
1312
+ description:
1313
+ "Find semantically similar documents using vector embeddings. Use for local expansion when wording differs; use gno_query as the default retrieval entry point and gno_graph_neighbors/path for explicit relationship questions.",
1314
+ inputSchema: similarInputSchema,
1315
+ },
1257
1316
  (args) => handleSimilar(args, ctx)
1258
1317
  );
1259
1318
 
1260
- server.tool(
1319
+ registerTool(
1261
1320
  "gno_graph",
1262
- "Get graph report/stats plus nodes/edges for corpus navigation. Use for unfamiliar corpus structure, hubs/isolates/unresolved links, or custom graph analysis; do not replace normal retrieval with this. Start with gno_query for content questions, then graph tools for relationship context, then gno_get for targeted reads.",
1263
- graphInputSchema.shape,
1321
+ {
1322
+ description:
1323
+ "Get graph report/stats plus nodes/edges for corpus navigation. Use for unfamiliar corpus structure, hubs/isolates/unresolved links, or custom graph analysis; do not replace normal retrieval with this. Start with gno_query for content questions, then graph tools for relationship context, then gno_get for targeted reads.",
1324
+ inputSchema: graphInputSchema,
1325
+ },
1264
1326
  (args) => handleGraph(args, ctx)
1265
1327
  );
1266
1328
 
1267
- server.tool(
1329
+ registerTool(
1268
1330
  "gno_graph_query",
1269
- "Run bounded traversal over typed doc_edges from one root document. Use for explicit relationship questions like 'what does Alice work_at within 2 hops?' or to inspect typed graph hints; returns schemaVersion, root, nodes, edges, caps, and truncation.",
1270
- graphQueryInputSchema.shape,
1331
+ {
1332
+ description:
1333
+ "Run bounded traversal over typed doc_edges from one root document. Use for explicit relationship questions like 'what does Alice work_at within 2 hops?' or to inspect typed graph hints; returns schemaVersion, root, nodes, edges, caps, and truncation.",
1334
+ inputSchema: graphQueryInputSchema,
1335
+ },
1271
1336
  (args) => handleGraphQuery(args, ctx)
1272
1337
  );
1273
1338
 
1274
- server.tool(
1339
+ registerTool(
1275
1340
  "gno_graph_neighbors",
1276
- "Find graph neighbors around a document/node. Use for relationship questions, missed obvious related docs, or unfamiliar corpus navigation after gno_query identifies a seed; returns incoming/outgoing wiki, markdown, and optional similarity edges. Follow with gno_get for targeted reads.",
1277
- graphNeighborsInputSchema.shape,
1341
+ {
1342
+ description:
1343
+ "Find graph neighbors around a document/node. Use for relationship questions, missed obvious related docs, or unfamiliar corpus navigation after gno_query identifies a seed; returns incoming/outgoing wiki, markdown, and optional similarity edges. Follow with gno_get for targeted reads.",
1344
+ inputSchema: graphNeighborsInputSchema,
1345
+ },
1278
1346
  (args) => handleGraphNeighbors(args, ctx)
1279
1347
  );
1280
1348
 
1281
- server.tool(
1349
+ registerTool(
1282
1350
  "gno_graph_path",
1283
- "Find the shortest relationship path between two documents/nodes. Use for prompts like 'how are X and Y connected?' or to explain corpus relationships. Use gno_query for finding candidate refs first, then gno_get on path nodes for evidence.",
1284
- graphPathInputSchema.shape,
1351
+ {
1352
+ description:
1353
+ "Find the shortest relationship path between two documents/nodes. Use for prompts like 'how are X and Y connected?' or to explain corpus relationships. Use gno_query for finding candidate refs first, then gno_get on path nodes for evidence.",
1354
+ inputSchema: graphPathInputSchema,
1355
+ },
1285
1356
  (args) => handleGraphPath(args, ctx)
1286
1357
  );
1287
1358
 
1288
1359
  if (ctx.enableWrite) {
1289
- server.registerTool(
1360
+ registerTool(
1290
1361
  "gno_egress_policy_set",
1291
1362
  {
1292
1363
  description:
@@ -1296,7 +1367,7 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1296
1367
  (args) => handleEgressPolicySet(args, ctx)
1297
1368
  );
1298
1369
 
1299
- server.registerTool(
1370
+ registerTool(
1300
1371
  "gno_egress_audit_delete",
1301
1372
  {
1302
1373
  description:
@@ -1306,7 +1377,7 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1306
1377
  (args) => handleEgressAuditDelete(args, ctx)
1307
1378
  );
1308
1379
 
1309
- server.registerTool(
1380
+ registerTool(
1310
1381
  "gno_egress_audit_purge",
1311
1382
  {
1312
1383
  description:
@@ -1316,105 +1387,142 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1316
1387
  (args) => handleEgressAuditPurge(args, ctx)
1317
1388
  );
1318
1389
 
1319
- server.tool(
1390
+ registerTool(
1320
1391
  "gno_trace_label",
1321
- "Append an explicit relevant, irrelevant, or missing_expected judgment to a local retrieval trace.",
1322
- traceLabelInputSchema.shape,
1392
+ {
1393
+ description:
1394
+ "Append an explicit relevant, irrelevant, or missing_expected judgment to a local retrieval trace.",
1395
+ inputSchema: traceLabelInputSchema,
1396
+ },
1323
1397
  (args) => handleTraceLabel(args, ctx)
1324
1398
  );
1325
1399
 
1326
- server.tool(
1400
+ registerTool(
1327
1401
  "gno_trace_export",
1328
- "Build a deterministic local agentic receipt from one or more immutable terminal retrieval traces.",
1329
- traceExportInputSchema.shape,
1402
+ {
1403
+ description:
1404
+ "Build a deterministic local agentic receipt from one or more immutable terminal retrieval traces.",
1405
+ inputSchema: traceExportInputSchema,
1406
+ },
1330
1407
  (args) => handleTraceExport(args, ctx)
1331
1408
  );
1332
1409
 
1333
- server.tool(
1410
+ registerTool(
1334
1411
  "gno_trace_delete",
1335
- "Delete one private local retrieval trace and all owned receipt records.",
1336
- traceDeleteInputSchema.shape,
1412
+ {
1413
+ description:
1414
+ "Delete one private local retrieval trace and all owned receipt records.",
1415
+ inputSchema: traceDeleteInputSchema,
1416
+ },
1337
1417
  (args) => handleTraceDelete(args, ctx)
1338
1418
  );
1339
1419
 
1340
- server.tool(
1420
+ registerTool(
1341
1421
  "gno_trace_purge",
1342
- "Purge every private local retrieval trace receipt. Requires confirm=true.",
1343
- tracePurgeInputSchema.shape,
1422
+ {
1423
+ description:
1424
+ "Purge every private local retrieval trace receipt. Requires confirm=true.",
1425
+ inputSchema: tracePurgeInputSchema,
1426
+ },
1344
1427
  (args) => handleTracePurge(args, ctx)
1345
1428
  );
1346
1429
 
1347
- server.registerTool(
1430
+ registerTool(
1348
1431
  "gno_remember",
1349
1432
  {
1350
- description: MCP_TOOL_DESCRIPTIONS.remember,
1433
+ description: describe("gno_remember", MCP_TOOL_DESCRIPTIONS.remember),
1351
1434
  inputSchema: rememberInputSchema,
1352
1435
  annotations: REMEMBER_MCP_ANNOTATIONS,
1353
1436
  },
1354
- (args, extra) =>
1437
+ (args, request) =>
1355
1438
  handleRemember(args, ctx, {
1356
1439
  clientName: server.server.getClientVersion()?.name,
1357
- sessionId: extra.sessionId,
1440
+ sessionId: request.sessionId,
1441
+ requestIdentity: ctx.getRequestIdentity?.(),
1358
1442
  })
1359
1443
  );
1360
1444
 
1361
- server.tool(
1445
+ registerTool(
1362
1446
  "gno_capture",
1363
- "Create a new document in a collection. Writes to disk. Does NOT auto-embed; run gno_index after to make it searchable via vector search.",
1364
- captureInputSchema.shape,
1447
+ {
1448
+ description: describe(
1449
+ "gno_capture",
1450
+ "Create a new document in a collection. Writes to disk. Does NOT auto-embed; run gno_index after to make it searchable via vector search."
1451
+ ),
1452
+ inputSchema: captureInputSchema,
1453
+ },
1365
1454
  (args) => handleCapture(args, ctx)
1366
1455
  );
1367
1456
 
1368
- server.tool(
1457
+ registerTool(
1369
1458
  "gno_add_collection",
1370
- "Add a directory as a new collection and start indexing. Returns a job ID for tracking.",
1371
- addCollectionInputSchema.shape,
1459
+ {
1460
+ description:
1461
+ "Add a directory as a new collection and start indexing. Returns a job ID for tracking.",
1462
+ inputSchema: addCollectionInputSchema,
1463
+ },
1372
1464
  (args) => handleAddCollection(args, ctx)
1373
1465
  );
1374
1466
 
1375
- server.tool(
1467
+ registerTool(
1376
1468
  "gno_sync",
1377
- "Sync files from disk into the index (FTS only, no embeddings). Does NOT auto-embed; run gno_embed after if vector search needed.",
1378
- syncInputSchema.shape,
1469
+ {
1470
+ description:
1471
+ "Sync files from disk into the index (FTS only, no embeddings). Does NOT auto-embed; run gno_embed after if vector search needed.",
1472
+ inputSchema: syncInputSchema,
1473
+ },
1379
1474
  (args) => handleSync(args, ctx)
1380
1475
  );
1381
1476
 
1382
- server.tool(
1477
+ registerTool(
1383
1478
  "gno_embed",
1384
- "Generate vector embeddings for all unembedded chunks, optionally scoped to one collection. Async: returns a job ID. Poll with gno_job_status.",
1385
- embedInputSchema.shape,
1479
+ {
1480
+ description:
1481
+ "Generate vector embeddings for all unembedded chunks, optionally scoped to one collection. Async: returns a job ID. Poll with gno_job_status.",
1482
+ inputSchema: embedInputSchema,
1483
+ },
1386
1484
  (args) => handleEmbed(args, ctx)
1387
1485
  );
1388
1486
 
1389
- server.tool(
1487
+ registerTool(
1390
1488
  "gno_index",
1391
- "Full index: sync files from disk + generate embeddings. Async: returns a job ID. Poll with gno_job_status.",
1392
- indexInputSchema.shape,
1489
+ {
1490
+ description:
1491
+ "Full index: sync files from disk + generate embeddings. Async: returns a job ID. Poll with gno_job_status.",
1492
+ inputSchema: indexInputSchema,
1493
+ },
1393
1494
  (args) => handleIndex(args, ctx)
1394
1495
  );
1395
1496
 
1396
- server.tool(
1497
+ registerTool(
1397
1498
  "gno_remove_collection",
1398
- "Remove a collection from config and delete its indexed data.",
1399
- removeCollectionInputSchema.shape,
1499
+ {
1500
+ description:
1501
+ "Remove a collection from config and delete its indexed data.",
1502
+ inputSchema: removeCollectionInputSchema,
1503
+ },
1400
1504
  (args) => handleRemoveCollection(args, ctx)
1401
1505
  );
1402
1506
 
1403
- server.tool(
1507
+ registerTool(
1404
1508
  "gno_clear_collection_embeddings",
1405
- "Remove stale or all embeddings for one collection.",
1406
- clearCollectionEmbeddingsInputSchema.shape,
1509
+ {
1510
+ description: "Remove stale or all embeddings for one collection.",
1511
+ inputSchema: clearCollectionEmbeddingsInputSchema,
1512
+ },
1407
1513
  (args) => handleClearCollectionEmbeddings(args, ctx)
1408
1514
  );
1409
1515
 
1410
- server.tool(
1516
+ registerTool(
1411
1517
  "gno_create_folder",
1412
- "Create a folder inside an existing collection.",
1413
- createFolderInputSchema.shape,
1518
+ {
1519
+ description: "Create a folder inside an existing collection.",
1520
+ inputSchema: createFolderInputSchema,
1521
+ },
1414
1522
  (args) => handleCreateFolder(args, ctx)
1415
1523
  );
1416
1524
 
1417
- server.registerTool(
1525
+ registerTool(
1418
1526
  "gno_rename_note",
1419
1527
  {
1420
1528
  description:
@@ -1425,7 +1533,7 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1425
1533
  (args) => handleRenameNote(args, ctx)
1426
1534
  );
1427
1535
 
1428
- server.registerTool(
1536
+ registerTool(
1429
1537
  "gno_move_note",
1430
1538
  {
1431
1539
  description:
@@ -1436,25 +1544,34 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
1436
1544
  (args) => handleMoveNote(args, ctx)
1437
1545
  );
1438
1546
 
1439
- server.tool(
1547
+ registerTool(
1440
1548
  "gno_duplicate_note",
1441
- "Duplicate an editable note into the current or another folder.",
1442
- duplicateNoteInputSchema.shape,
1549
+ {
1550
+ description:
1551
+ "Duplicate an editable note into the current or another folder.",
1552
+ inputSchema: duplicateNoteInputSchema,
1553
+ },
1443
1554
  (args) => handleDuplicateNote(args, ctx)
1444
1555
  );
1445
1556
  }
1446
1557
 
1447
- server.tool(
1558
+ registerTool(
1448
1559
  "gno_job_status",
1449
- "Check status of an async job (embed, index). Returns progress percentage and completion state.",
1450
- jobStatusInputSchema.shape,
1560
+ {
1561
+ description:
1562
+ "Check status of an async job (embed, index). Returns progress percentage and completion state.",
1563
+ inputSchema: jobStatusInputSchema,
1564
+ },
1451
1565
  (args) => handleJobStatus(args, ctx)
1452
1566
  );
1453
1567
 
1454
- server.tool(
1568
+ registerTool(
1455
1569
  "gno_list_jobs",
1456
- "List active and recently completed async jobs with their status and progress.",
1457
- listJobsInputSchema.shape,
1570
+ {
1571
+ description:
1572
+ "List active and recently completed async jobs with their status and progress.",
1573
+ inputSchema: listJobsInputSchema,
1574
+ },
1458
1575
  (args) => handleListJobs(args, ctx)
1459
1576
  );
1460
1577
  }