@gmickel/gno 2.15.0 → 2.16.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.
- package/README.md +1 -1
- package/assets/skill/cli-reference.md +4 -2
- package/assets/spa-production.json.gz +0 -0
- package/browser-extension/artifacts/{gno-browser-clipper-v2.15.0.zip → gno-browser-clipper-v2.16.0.zip} +0 -0
- package/browser-extension/artifacts/gno-browser-clipper-v2.16.0.zip.sha256 +1 -0
- package/browser-extension/dist/manifest.json +1 -1
- package/package.json +1 -1
- package/spec/cli.md +1 -1
- package/src/cli/commands/agents/commands.ts +1 -1
- package/src/cli/commands/ask.ts +1 -1
- package/src/cli/commands/context-build.ts +1 -1
- package/src/cli/commands/embed.ts +2 -2
- package/src/cli/commands/links.ts +1 -1
- package/src/cli/commands/mcp/install.ts +2 -2
- package/src/cli/commands/mcp/status.ts +1 -1
- package/src/cli/commands/mcp/uninstall.ts +1 -1
- package/src/cli/commands/query.ts +1 -1
- package/src/cli/commands/shared.ts +4 -4
- package/src/cli/commands/skill/install.ts +1 -1
- package/src/cli/commands/skill/paths-cmd.ts +1 -1
- package/src/cli/commands/skill/uninstall.ts +1 -1
- package/src/cli/commands/status.ts +75 -58
- package/src/cli/config-cache.ts +86 -0
- package/src/cli/globals.ts +64 -0
- package/src/cli/program.ts +20 -36
- package/src/cli/run.ts +121 -67
- package/src/cli/runtime-health.ts +132 -122
- package/src/cli/session-binding.ts +11 -2
- package/src/config/saver.ts +8 -0
- package/src/converters/adapters/browser-export/formats.ts +25 -15
- package/src/converters/adapters/email/adapter.ts +37 -53
- package/src/converters/adapters/email/html.ts +37 -20
- package/src/converters/adapters/email/mime.ts +71 -39
- package/src/converters/adapters/ical/adapter.ts +20 -12
- package/src/converters/adapters/jsonl/adapter.ts +8 -6
- package/src/converters/adapters/shared/html-text.ts +55 -37
- package/src/converters/adapters/shared/ooxml-protection.ts +5 -13
- package/src/converters/adapters/shared/utf8-lines.ts +69 -31
- package/src/converters/adapters/transcript/adapter.ts +12 -7
- package/src/converters/adapters/xlsx/adapter.ts +10 -7
- package/src/converters/adapters/xlsx/sheet-markdown.ts +93 -50
- package/src/converters/canonicalize.ts +17 -3
- package/src/converters/native/markdown.ts +24 -17
- package/src/converters/native/plaintext.ts +5 -6
- package/src/converters/registry.ts +130 -8
- package/src/core/activation-status.ts +4 -8
- package/src/core/change-diff.ts +38 -11
- package/src/core/context-compiler.ts +17 -18
- package/src/core/context-evidence.ts +116 -25
- package/src/core/context-verifier.ts +70 -31
- package/src/core/file-lock.ts +10 -2
- package/src/core/graph-analysis.ts +3 -3
- package/src/core/link-inventory-markdown.ts +2 -2
- package/src/core/links.ts +20 -87
- package/src/core/memory-fence.ts +16 -9
- package/src/core/memory-recall.ts +168 -34
- package/src/core/path-rules.ts +143 -0
- package/src/core/section-parse.ts +16 -6
- package/src/core/typed-metadata.ts +68 -0
- package/src/core/wiki-link-syntax.ts +88 -0
- package/src/embed/backlog.ts +142 -60
- package/src/embed/retry.ts +39 -33
- package/src/embed/variant-backlog.ts +546 -114
- package/src/embed/variant-retry.ts +157 -48
- package/src/index.ts +3 -3
- package/src/ingestion/budget-error-codes.ts +13 -0
- package/src/ingestion/chunker.ts +60 -49
- package/src/ingestion/compiled-context.ts +4 -5
- package/src/ingestion/convert-file.ts +1 -1
- package/src/ingestion/document-metadata.ts +16 -9
- package/src/ingestion/excluded-ranges.ts +97 -0
- package/src/ingestion/file-processor.ts +122 -37
- package/src/ingestion/frontmatter.ts +35 -7
- package/src/ingestion/graph-reconciliation.ts +187 -51
- package/src/ingestion/language.ts +66 -61
- package/src/ingestion/position.ts +5 -5
- package/src/ingestion/prepare-file.ts +50 -29
- package/src/ingestion/record-adapter-canonical.ts +37 -26
- package/src/ingestion/record-adapter.ts +46 -26
- package/src/ingestion/record-container.ts +121 -53
- package/src/ingestion/record-path.ts +5 -2
- package/src/ingestion/source-availability/darwin-io.ts +10 -7
- package/src/ingestion/source-availability/darwin-path.ts +21 -3
- package/src/ingestion/source-availability/readers.ts +51 -0
- package/src/ingestion/strip.ts +39 -105
- package/src/ingestion/sync.ts +692 -386
- package/src/ingestion/typed-metadata.ts +10 -4
- package/src/ingestion/walker.ts +485 -158
- package/src/llm/cache.ts +128 -84
- package/src/llm/http-inference.ts +112 -35
- package/src/llm/http-policy.ts +101 -0
- package/src/llm/httpEmbedding.ts +8 -1
- package/src/llm/httpGeneration.ts +5 -1
- package/src/llm/httpRerank.ts +5 -1
- package/src/llm/inference-scope.ts +15 -2
- package/src/llm/lazy-ports.ts +33 -3
- package/src/llm/lockfile.ts +34 -7
- package/src/llm/model-cleanup.ts +24 -0
- package/src/llm/native-worker/client.ts +23 -12
- package/src/llm/native-worker/dispatcher.ts +19 -9
- package/src/llm/native-worker/embedding-identity.ts +42 -16
- package/src/llm/native-worker/entry.ts +2 -1
- package/src/llm/native-worker/owner.ts +1 -0
- package/src/llm/native-worker/ports.ts +86 -23
- package/src/llm/native-worker/protocol.ts +386 -55
- package/src/llm/nodeLlamaCpp/adapter.ts +46 -29
- package/src/llm/nodeLlamaCpp/embedding.ts +93 -40
- package/src/llm/nodeLlamaCpp/generation.ts +194 -30
- package/src/llm/nodeLlamaCpp/lifecycle.ts +2 -0
- package/src/llm/nodeLlamaCpp/rerank-capacity.ts +101 -23
- package/src/llm/nodeLlamaCpp/rerank.ts +253 -44
- package/src/llm/types.ts +14 -0
- package/src/mcp/context.ts +342 -23
- package/src/mcp/http-transport.ts +21 -3
- package/src/mcp/tool-profile-types.ts +62 -0
- package/src/mcp/tool-profile.ts +32 -56
- package/src/mcp/tools/context.ts +5 -1
- package/src/mcp/tools/index.ts +269 -191
- package/src/mcp/tools/links.ts +7 -5
- package/src/mcp/tools/query.ts +60 -37
- package/src/mcp/tools/vsearch.ts +25 -14
- package/src/pipeline/answer.ts +133 -40
- package/src/pipeline/claim-verification.ts +293 -189
- package/src/pipeline/claim-verifier.ts +6 -7
- package/src/pipeline/egress-lineage.ts +37 -26
- package/src/pipeline/exclude.ts +34 -11
- package/src/pipeline/expansion.ts +233 -19
- package/src/pipeline/filters.ts +169 -33
- package/src/pipeline/graph-retrieval.ts +117 -61
- package/src/pipeline/hybrid.ts +598 -329
- package/src/pipeline/hydration.ts +86 -24
- package/src/pipeline/intent.ts +15 -7
- package/src/pipeline/owner-fusion.ts +61 -19
- package/src/pipeline/query-language.ts +15 -2
- package/src/pipeline/rerank.ts +15 -22
- package/src/pipeline/search.ts +193 -72
- package/src/pipeline/snippet.ts +15 -2
- package/src/pipeline/temporal.ts +51 -10
- package/src/pipeline/vsearch.ts +250 -152
- package/src/publish/attachment-raster.ts +2 -16
- package/src/publish/encrypted-export.ts +15 -5
- package/src/serve/browse-tree.ts +50 -42
- package/src/serve/connectors.ts +2 -1
- package/src/serve/context.ts +13 -4
- package/src/serve/doc-events.ts +3 -0
- package/src/serve/public/app.tsx +49 -21
- package/src/serve/public/components/BrowseTreeSidebar.tsx +163 -23
- package/src/serve/public/components/CaptureModal.tsx +14 -10
- package/src/serve/public/components/ai-elements/code-block.tsx +87 -50
- package/src/serve/public/components/editor/MarkdownPreview.tsx +99 -67
- package/src/serve/public/globals.built.css +1 -1
- package/src/serve/public/globals.css +19 -0
- package/src/serve/public/hooks/useCaptureModal.tsx +23 -10
- package/src/serve/public/lib/metadata-filter.ts +234 -9
- package/src/serve/public/pages/Browse.tsx +61 -27
- package/src/serve/public/pages/DocView.tsx +44 -25
- package/src/serve/public/pages/GraphView.tsx +8 -3
- package/src/serve/resident-runtime.ts +199 -48
- package/src/serve/routes/api.ts +98 -67
- package/src/serve/routes/links.ts +18 -4
- package/src/serve/server.ts +1370 -1180
- package/src/serve/spa-bundle-source.ts +52 -27
- package/src/serve/status.ts +101 -52
- package/src/serve/watch-reconciliation-fallback.ts +11 -7
- package/src/serve/watch-reconciliation-shared.ts +42 -4
- package/src/serve/watch-reconciliation.ts +21 -8
- package/src/serve/watch-service-events.ts +7 -1
- package/src/serve/watch-service-hosts.ts +3 -1
- package/src/serve/watch-service.ts +46 -21
- package/src/serve/watch-snapshot-scan.ts +6 -15
- package/src/sessions/archive.ts +20 -8
- package/src/sessions/sanitize.ts +38 -18
- package/src/sessions/service.ts +180 -102
- package/src/store/migrations/037-performance-indexes.ts +56 -0
- package/src/store/migrations/index.ts +2 -0
- package/src/store/sqlite/adapter.ts +1217 -651
- package/src/store/sqlite/chunking-policy.ts +15 -1
- package/src/store/sqlite/eligibility.ts +110 -70
- package/src/store/sqlite/graph-neighbors.ts +71 -46
- package/src/store/sqlite/graph-reference-state.ts +27 -3
- package/src/store/sqlite/graph-similarity.ts +59 -12
- package/src/store/sqlite/metadata-predicate.ts +123 -28
- package/src/store/sqlite/retrieval-trace-management-store.ts +126 -33
- package/src/store/sqlite/retrieval-trace-retention.ts +88 -76
- package/src/store/sqlite/retrieval-trace-rows.ts +7 -3
- package/src/store/types.ts +32 -0
- package/src/store/vector/eligibility.ts +39 -0
- package/src/store/vector/lazy.ts +17 -0
- package/src/store/vector/partition-index.ts +28 -45
- package/src/store/vector/proof-cache.ts +103 -0
- package/src/store/vector/sqlite-vec.ts +230 -139
- package/src/store/vector/stats.ts +29 -73
- package/src/store/vector/status.ts +151 -52
- package/src/store/vector/stored-vectors.ts +131 -45
- package/src/store/vector/types.ts +10 -0
- package/src/store/vector/variant-search.ts +771 -109
- package/src/store/vector/variants.ts +495 -139
- package/browser-extension/artifacts/gno-browser-clipper-v2.15.0.zip.sha256 +0 -1
package/src/mcp/tools/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
McpServer,
|
|
3
|
+
StandardSchemaWithJSON,
|
|
4
|
+
ToolAnnotations,
|
|
5
|
+
} from "@modelcontextprotocol/server";
|
|
2
6
|
/**
|
|
3
7
|
* MCP tool registration and shared utilities.
|
|
4
8
|
*
|
|
@@ -37,6 +41,7 @@ import {
|
|
|
37
41
|
import {
|
|
38
42
|
assertInferenceActive,
|
|
39
43
|
acquireInferencePermit,
|
|
44
|
+
withInferenceScope,
|
|
40
45
|
} from "../../llm/inference-scope";
|
|
41
46
|
import { envIsSet } from "../../llm/policy";
|
|
42
47
|
import { staleCollectionsMessage } from "../../store/sqlite/adapter";
|
|
@@ -44,8 +49,10 @@ import { MCP_ACTIVATION_VERIFICATION_ENV } from "../activation-verification-mode
|
|
|
44
49
|
import { exposesHostPaths } from "../context";
|
|
45
50
|
import { profileToolDescription } from "../tool-descriptions-core";
|
|
46
51
|
import {
|
|
47
|
-
createProfileToolRegistrar,
|
|
48
52
|
DEFAULT_MCP_TOOL_PROFILE,
|
|
53
|
+
type McpToolProfile,
|
|
54
|
+
mcpToolProfileAllowlist,
|
|
55
|
+
rejectUnknownKeys,
|
|
49
56
|
} from "../tool-profile";
|
|
50
57
|
import { handleAddCollection } from "./add-collection";
|
|
51
58
|
import { askInputSchema, handleAsk } from "./ask";
|
|
@@ -1049,8 +1056,15 @@ export async function runTool<T>(
|
|
|
1049
1056
|
};
|
|
1050
1057
|
}
|
|
1051
1058
|
|
|
1052
|
-
//
|
|
1053
|
-
|
|
1059
|
+
// Shared read lock for read-only HTTP tools; stdio keeps its strict serial
|
|
1060
|
+
// dispatch and mutating tools always retain exclusive access.
|
|
1061
|
+
const isHttpRequest = ctx.getEgressContext?.() !== undefined;
|
|
1062
|
+
const isReadOnlyTool = isHttpRequest && READ_ONLY_LOCK_TOOLS.has(name);
|
|
1063
|
+
const release = await acquireInferencePermit(() =>
|
|
1064
|
+
isReadOnlyTool && ctx.toolMutex.acquireRead
|
|
1065
|
+
? ctx.toolMutex.acquireRead()
|
|
1066
|
+
: ctx.toolMutex.acquire()
|
|
1067
|
+
);
|
|
1054
1068
|
try {
|
|
1055
1069
|
assertConfiguredCollections(ctx, name);
|
|
1056
1070
|
assertInferenceActive();
|
|
@@ -1101,6 +1115,41 @@ const READ_CONNECTION_TOOLS = new Set([
|
|
|
1101
1115
|
"gno_similar",
|
|
1102
1116
|
]);
|
|
1103
1117
|
|
|
1118
|
+
/**
|
|
1119
|
+
* Pure read-only tools that can share the reader side of `toolMutex`
|
|
1120
|
+
* concurrently on the WAL read connection while write tools and `shutdown()`
|
|
1121
|
+
* retain exclusive access.
|
|
1122
|
+
*/
|
|
1123
|
+
const READ_ONLY_LOCK_TOOLS = new Set([
|
|
1124
|
+
...READ_CONNECTION_TOOLS,
|
|
1125
|
+
"gno_section",
|
|
1126
|
+
"gno_peek",
|
|
1127
|
+
"gno_list_metadata",
|
|
1128
|
+
"gno_graph",
|
|
1129
|
+
"gno_graph_query",
|
|
1130
|
+
"gno_graph_neighbors",
|
|
1131
|
+
"gno_graph_path",
|
|
1132
|
+
"gno_changes",
|
|
1133
|
+
"gno_diff",
|
|
1134
|
+
"gno_impact",
|
|
1135
|
+
"gno_trace_list",
|
|
1136
|
+
"gno_trace_show",
|
|
1137
|
+
"gno_egress_policy_get",
|
|
1138
|
+
"gno_egress_check",
|
|
1139
|
+
"gno_egress_audit_list",
|
|
1140
|
+
"gno_egress_audit_show",
|
|
1141
|
+
"gno_egress_audit_status",
|
|
1142
|
+
"gno_sessions_status",
|
|
1143
|
+
"gno_context",
|
|
1144
|
+
"gno_context_compiled_preview",
|
|
1145
|
+
"gno_context_compiled_check",
|
|
1146
|
+
"gno_context_verify",
|
|
1147
|
+
"gno_recall",
|
|
1148
|
+
"gno_query_diagnose",
|
|
1149
|
+
"gno_ask",
|
|
1150
|
+
"gno_audit",
|
|
1151
|
+
]);
|
|
1152
|
+
|
|
1104
1153
|
/** Store test doubles may lack the read connection; they read as before. */
|
|
1105
1154
|
function readConnection<T>(
|
|
1106
1155
|
ctx: ToolContext,
|
|
@@ -1195,24 +1244,69 @@ function parseErrorMessage(message: string): { [x: string]: unknown } {
|
|
|
1195
1244
|
// Tool Registration
|
|
1196
1245
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
1197
1246
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1247
|
+
// Pre-built static ask surface schema (hoisted so WeakMap strict-schema cache hits on every request).
|
|
1248
|
+
const askSurfaceInputSchema = z.object(askInputSchema.shape);
|
|
1249
|
+
|
|
1250
|
+
interface StaticToolDefinition {
|
|
1251
|
+
name: string;
|
|
1252
|
+
config: {
|
|
1253
|
+
title?: string;
|
|
1254
|
+
description?: string;
|
|
1255
|
+
inputSchema?: StandardSchemaWithJSON;
|
|
1256
|
+
outputSchema?: StandardSchemaWithJSON;
|
|
1257
|
+
annotations?: ToolAnnotations;
|
|
1258
|
+
};
|
|
1259
|
+
invoke: (
|
|
1260
|
+
args: unknown,
|
|
1261
|
+
request: { sessionId?: string; mcpReq: { signal: AbortSignal } },
|
|
1262
|
+
server: McpServer,
|
|
1263
|
+
ctx: ToolContext
|
|
1264
|
+
) => Promise<ToolResult>;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
const staticToolTables = new Map<string, readonly StaticToolDefinition[]>();
|
|
1268
|
+
|
|
1269
|
+
function getStaticToolTable(
|
|
1270
|
+
profile: McpToolProfile,
|
|
1271
|
+
enableWrite: boolean
|
|
1272
|
+
): readonly StaticToolDefinition[] {
|
|
1273
|
+
const key = `${profile}:${enableWrite ? "1" : "0"}`;
|
|
1274
|
+
const cached = staticToolTables.get(key);
|
|
1275
|
+
if (cached) {
|
|
1276
|
+
return cached;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
const allowlist = mcpToolProfileAllowlist(profile);
|
|
1204
1280
|
const describe = (name: string, fullDescription: string) =>
|
|
1205
1281
|
profileToolDescription(profile, name, fullDescription);
|
|
1206
|
-
|
|
1282
|
+
const entries: StaticToolDefinition[] = [];
|
|
1283
|
+
const add = (
|
|
1284
|
+
name: string,
|
|
1285
|
+
config: StaticToolDefinition["config"],
|
|
1286
|
+
invoke: StaticToolDefinition["invoke"]
|
|
1287
|
+
): void => {
|
|
1288
|
+
if (allowlist !== null && !allowlist.has(name)) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
entries.push({
|
|
1292
|
+
name,
|
|
1293
|
+
config: {
|
|
1294
|
+
...config,
|
|
1295
|
+
inputSchema: rejectUnknownKeys(config.inputSchema),
|
|
1296
|
+
},
|
|
1297
|
+
invoke,
|
|
1298
|
+
});
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
add(
|
|
1207
1302
|
"gno_context",
|
|
1208
1303
|
{
|
|
1209
1304
|
description: describe("gno_context", MCP_TOOL_DESCRIPTIONS.context),
|
|
1210
1305
|
inputSchema: contextBuildSurfaceSchema,
|
|
1211
1306
|
},
|
|
1212
|
-
(args) => handleContext(args, ctx)
|
|
1307
|
+
(args, _req, _server, ctx) => handleContext(args as never, ctx)
|
|
1213
1308
|
);
|
|
1214
|
-
|
|
1215
|
-
registerTool(
|
|
1309
|
+
add(
|
|
1216
1310
|
"gno_context_compiled_preview",
|
|
1217
1311
|
{
|
|
1218
1312
|
description:
|
|
@@ -1226,9 +1320,10 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1226
1320
|
openWorldHint: false,
|
|
1227
1321
|
},
|
|
1228
1322
|
},
|
|
1229
|
-
(args
|
|
1323
|
+
(args, _req, _server, ctx) =>
|
|
1324
|
+
handleCompiledContextPreview(args as never, ctx)
|
|
1230
1325
|
);
|
|
1231
|
-
|
|
1326
|
+
add(
|
|
1232
1327
|
"gno_context_compiled_check",
|
|
1233
1328
|
{
|
|
1234
1329
|
description:
|
|
@@ -1242,45 +1337,41 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1242
1337
|
openWorldHint: false,
|
|
1243
1338
|
},
|
|
1244
1339
|
},
|
|
1245
|
-
(args) => handleCompiledContextCheck(args, ctx)
|
|
1340
|
+
(args, _req, _server, ctx) => handleCompiledContextCheck(args as never, ctx)
|
|
1246
1341
|
);
|
|
1247
|
-
|
|
1248
|
-
registerTool(
|
|
1342
|
+
add(
|
|
1249
1343
|
"gno_context_verify",
|
|
1250
1344
|
{
|
|
1251
1345
|
description: MCP_TOOL_DESCRIPTIONS.contextVerify,
|
|
1252
1346
|
inputSchema: contextVerifySurfaceSchema,
|
|
1253
1347
|
},
|
|
1254
|
-
(args) => handleContextVerify(args, ctx)
|
|
1348
|
+
(args, _req, _server, ctx) => handleContextVerify(args as never, ctx)
|
|
1255
1349
|
);
|
|
1256
|
-
|
|
1257
|
-
registerTool(
|
|
1350
|
+
add(
|
|
1258
1351
|
"gno_ask",
|
|
1259
1352
|
{
|
|
1260
1353
|
description: MCP_TOOL_DESCRIPTIONS.ask,
|
|
1261
1354
|
// The advertised 2025-11-25 schema is the non-strict shape (SDK v1
|
|
1262
1355
|
// registered `.shape`); the handler still parses with the strict schema.
|
|
1263
|
-
inputSchema:
|
|
1356
|
+
inputSchema: askSurfaceInputSchema,
|
|
1264
1357
|
},
|
|
1265
|
-
(args) => handleAsk(args, ctx)
|
|
1358
|
+
(args, _req, _server, ctx) => handleAsk(args as never, ctx)
|
|
1266
1359
|
);
|
|
1267
|
-
|
|
1268
|
-
registerTool(
|
|
1360
|
+
add(
|
|
1269
1361
|
"gno_recall",
|
|
1270
1362
|
{
|
|
1271
1363
|
description: describe("gno_recall", MCP_TOOL_DESCRIPTIONS.recall),
|
|
1272
1364
|
inputSchema: recallInputSchema,
|
|
1273
1365
|
annotations: RECALL_MCP_ANNOTATIONS,
|
|
1274
1366
|
},
|
|
1275
|
-
(args, request) =>
|
|
1276
|
-
handleRecall(args, ctx, {
|
|
1367
|
+
(args, request, server, ctx) =>
|
|
1368
|
+
handleRecall(args as never, ctx, {
|
|
1277
1369
|
clientName: server.server.getClientVersion()?.name,
|
|
1278
1370
|
sessionId: request.sessionId,
|
|
1279
1371
|
requestIdentity: ctx.getRequestIdentity?.(),
|
|
1280
1372
|
})
|
|
1281
1373
|
);
|
|
1282
|
-
|
|
1283
|
-
registerTool(
|
|
1374
|
+
add(
|
|
1284
1375
|
"gno_sessions_status",
|
|
1285
1376
|
{
|
|
1286
1377
|
description:
|
|
@@ -1288,55 +1379,49 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1288
1379
|
inputSchema: sessionsStatusInputSchema,
|
|
1289
1380
|
annotations: SESSIONS_STATUS_MCP_ANNOTATIONS,
|
|
1290
1381
|
},
|
|
1291
|
-
() => handleSessionsStatus(ctx)
|
|
1382
|
+
(_args, _req, _server, ctx) => handleSessionsStatus(ctx)
|
|
1292
1383
|
);
|
|
1293
|
-
|
|
1294
|
-
registerTool(
|
|
1384
|
+
add(
|
|
1295
1385
|
"gno_search",
|
|
1296
1386
|
{
|
|
1297
1387
|
description: describe("gno_search", MCP_TOOL_DESCRIPTIONS.search),
|
|
1298
1388
|
inputSchema: searchInputSchema,
|
|
1299
1389
|
},
|
|
1300
|
-
(args) => handleSearch(args, ctx)
|
|
1390
|
+
(args, _req, _server, ctx) => handleSearch(args as never, ctx)
|
|
1301
1391
|
);
|
|
1302
|
-
|
|
1303
|
-
registerTool(
|
|
1392
|
+
add(
|
|
1304
1393
|
"gno_vsearch",
|
|
1305
1394
|
{
|
|
1306
1395
|
description: MCP_TOOL_DESCRIPTIONS.vsearch,
|
|
1307
1396
|
inputSchema: vsearchInputSchema,
|
|
1308
1397
|
},
|
|
1309
|
-
(args) => handleVsearch(args, ctx)
|
|
1398
|
+
(args, _req, _server, ctx) => handleVsearch(args as never, ctx)
|
|
1310
1399
|
);
|
|
1311
|
-
|
|
1312
|
-
registerTool(
|
|
1400
|
+
add(
|
|
1313
1401
|
"gno_query",
|
|
1314
1402
|
{
|
|
1315
1403
|
description: describe("gno_query", MCP_TOOL_DESCRIPTIONS.query),
|
|
1316
1404
|
inputSchema: queryInputSchema,
|
|
1317
1405
|
},
|
|
1318
|
-
(args) => handleQuery(args, ctx)
|
|
1406
|
+
(args, _req, _server, ctx) => handleQuery(args as never, ctx)
|
|
1319
1407
|
);
|
|
1320
|
-
|
|
1321
|
-
registerTool(
|
|
1408
|
+
add(
|
|
1322
1409
|
"gno_query_diagnose",
|
|
1323
1410
|
{
|
|
1324
1411
|
description: MCP_TOOL_DESCRIPTIONS.queryDiagnose,
|
|
1325
1412
|
inputSchema: queryDiagnoseInputSchema,
|
|
1326
1413
|
},
|
|
1327
|
-
(args) => handleQueryDiagnose(args, ctx)
|
|
1414
|
+
(args, _req, _server, ctx) => handleQueryDiagnose(args as never, ctx)
|
|
1328
1415
|
);
|
|
1329
|
-
|
|
1330
|
-
registerTool(
|
|
1416
|
+
add(
|
|
1331
1417
|
"gno_get",
|
|
1332
1418
|
{
|
|
1333
1419
|
description: describe("gno_get", MCP_TOOL_DESCRIPTIONS.get),
|
|
1334
1420
|
inputSchema: getInputSchema,
|
|
1335
1421
|
},
|
|
1336
|
-
(args) => handleGet(args, ctx)
|
|
1422
|
+
(args, _req, _server, ctx) => handleGet(args as never, ctx)
|
|
1337
1423
|
);
|
|
1338
|
-
|
|
1339
|
-
registerTool(
|
|
1424
|
+
add(
|
|
1340
1425
|
"gno_section",
|
|
1341
1426
|
{
|
|
1342
1427
|
description: MCP_TOOL_DESCRIPTIONS.section,
|
|
@@ -1344,96 +1429,87 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1344
1429
|
outputSchema: sectionOutputSchema,
|
|
1345
1430
|
annotations: SECTION_MCP_ANNOTATIONS,
|
|
1346
1431
|
},
|
|
1347
|
-
(args) => handleSection(args, ctx)
|
|
1432
|
+
(args, _req, _server, ctx) => handleSection(args as never, ctx)
|
|
1348
1433
|
);
|
|
1349
|
-
|
|
1350
|
-
registerTool(
|
|
1434
|
+
add(
|
|
1351
1435
|
"gno_multi_get",
|
|
1352
1436
|
{
|
|
1353
1437
|
description: describe("gno_multi_get", MCP_TOOL_DESCRIPTIONS.multiGet),
|
|
1354
1438
|
inputSchema: multiGetInputSchema,
|
|
1355
1439
|
},
|
|
1356
|
-
(args) => handleMultiGet(args, ctx)
|
|
1440
|
+
(args, _req, _server, ctx) => handleMultiGet(args as never, ctx)
|
|
1357
1441
|
);
|
|
1358
|
-
|
|
1359
|
-
registerTool(
|
|
1442
|
+
add(
|
|
1360
1443
|
"gno_peek",
|
|
1361
1444
|
{
|
|
1362
1445
|
description: MCP_TOOL_DESCRIPTIONS.peek,
|
|
1363
1446
|
inputSchema: peekInputSchema,
|
|
1364
1447
|
annotations: PEEK_MCP_ANNOTATIONS,
|
|
1365
1448
|
},
|
|
1366
|
-
(args) => handlePeek(args, ctx)
|
|
1449
|
+
(args, _req, _server, ctx) => handlePeek(args as never, ctx)
|
|
1367
1450
|
);
|
|
1368
|
-
|
|
1369
|
-
registerTool(
|
|
1451
|
+
add(
|
|
1370
1452
|
"gno_status",
|
|
1371
1453
|
{
|
|
1372
1454
|
description: MCP_TOOL_DESCRIPTIONS.status,
|
|
1373
1455
|
inputSchema: statusInputSchema,
|
|
1374
1456
|
},
|
|
1375
|
-
(args) => handleStatus(args, ctx)
|
|
1457
|
+
(args, _req, _server, ctx) => handleStatus(args as never, ctx)
|
|
1376
1458
|
);
|
|
1377
|
-
|
|
1378
|
-
registerTool(
|
|
1459
|
+
add(
|
|
1379
1460
|
"gno_audit",
|
|
1380
1461
|
{
|
|
1381
1462
|
description: MCP_TOOL_DESCRIPTIONS.audit,
|
|
1382
1463
|
inputSchema: auditInputSchema,
|
|
1383
1464
|
annotations: AUDIT_MCP_ANNOTATIONS,
|
|
1384
1465
|
},
|
|
1385
|
-
(args, request
|
|
1466
|
+
(args, request, _server, ctx) =>
|
|
1467
|
+
handleAudit(args as never, ctx, request.mcpReq.signal)
|
|
1386
1468
|
);
|
|
1387
|
-
|
|
1388
|
-
registerTool(
|
|
1469
|
+
add(
|
|
1389
1470
|
"gno_egress_policy_get",
|
|
1390
1471
|
{
|
|
1391
1472
|
description:
|
|
1392
1473
|
"Show one collection's configured and effective egress policy, provenance source, and confirmation-bound version.",
|
|
1393
1474
|
inputSchema: egressPolicyGetInputSchema,
|
|
1394
1475
|
},
|
|
1395
|
-
(args) => handleEgressPolicyGet(args, ctx)
|
|
1476
|
+
(args, _req, _server, ctx) => handleEgressPolicyGet(args as never, ctx)
|
|
1396
1477
|
);
|
|
1397
|
-
|
|
1398
|
-
registerTool(
|
|
1478
|
+
add(
|
|
1399
1479
|
"gno_egress_check",
|
|
1400
1480
|
{
|
|
1401
1481
|
description:
|
|
1402
1482
|
"Check or explain an exact action, destination, caller, content class, and collection scope without performing the action.",
|
|
1403
1483
|
inputSchema: egressCheckInputSchema,
|
|
1404
1484
|
},
|
|
1405
|
-
(args) => handleEgressCheck(args, ctx)
|
|
1485
|
+
(args, _req, _server, ctx) => handleEgressCheck(args as never, ctx)
|
|
1406
1486
|
);
|
|
1407
|
-
|
|
1408
|
-
registerTool(
|
|
1487
|
+
add(
|
|
1409
1488
|
"gno_egress_audit_list",
|
|
1410
1489
|
{
|
|
1411
1490
|
description:
|
|
1412
1491
|
"List content-free local egress decisions newest-first through an opaque cursor.",
|
|
1413
1492
|
inputSchema: egressAuditListInputSchema,
|
|
1414
1493
|
},
|
|
1415
|
-
(args) => handleEgressAuditList(args, ctx)
|
|
1494
|
+
(args, _req, _server, ctx) => handleEgressAuditList(args as never, ctx)
|
|
1416
1495
|
);
|
|
1417
|
-
|
|
1418
|
-
registerTool(
|
|
1496
|
+
add(
|
|
1419
1497
|
"gno_egress_audit_show",
|
|
1420
1498
|
{
|
|
1421
1499
|
description: "Inspect one content-free local egress decision receipt.",
|
|
1422
1500
|
inputSchema: egressAuditIdInputSchema,
|
|
1423
1501
|
},
|
|
1424
|
-
(args) => handleEgressAuditShow(args, ctx)
|
|
1502
|
+
(args, _req, _server, ctx) => handleEgressAuditShow(args as never, ctx)
|
|
1425
1503
|
);
|
|
1426
|
-
|
|
1427
|
-
registerTool(
|
|
1504
|
+
add(
|
|
1428
1505
|
"gno_egress_audit_status",
|
|
1429
1506
|
{
|
|
1430
1507
|
description: "Show local egress audit retention and storage status.",
|
|
1431
1508
|
inputSchema: egressAuditStatusInputSchema,
|
|
1432
1509
|
},
|
|
1433
|
-
(args) => handleEgressAuditStatus(args, ctx)
|
|
1510
|
+
(args, _req, _server, ctx) => handleEgressAuditStatus(args as never, ctx)
|
|
1434
1511
|
);
|
|
1435
|
-
|
|
1436
|
-
registerTool(
|
|
1512
|
+
add(
|
|
1437
1513
|
"gno_changes",
|
|
1438
1514
|
{
|
|
1439
1515
|
description: describe(
|
|
@@ -1442,232 +1518,211 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1442
1518
|
),
|
|
1443
1519
|
inputSchema: changesInputSchema,
|
|
1444
1520
|
},
|
|
1445
|
-
(args) => handleChanges(args, ctx)
|
|
1521
|
+
(args, _req, _server, ctx) => handleChanges(args as never, ctx)
|
|
1446
1522
|
);
|
|
1447
|
-
|
|
1448
|
-
registerTool(
|
|
1523
|
+
add(
|
|
1449
1524
|
"gno_diff",
|
|
1450
1525
|
{
|
|
1451
1526
|
description:
|
|
1452
1527
|
"Inspect one retained metadata-only structural document change. Source bodies are never returned.",
|
|
1453
1528
|
inputSchema: diffInputSchema,
|
|
1454
1529
|
},
|
|
1455
|
-
(args) => handleDiff(args, ctx)
|
|
1530
|
+
(args, _req, _server, ctx) => handleDiff(args as never, ctx)
|
|
1456
1531
|
);
|
|
1457
|
-
|
|
1458
|
-
registerTool(
|
|
1532
|
+
add(
|
|
1459
1533
|
"gno_impact",
|
|
1460
1534
|
{
|
|
1461
1535
|
description:
|
|
1462
1536
|
"Find bounded inbound typed, wiki, and Markdown dependencies with deterministic evidence paths.",
|
|
1463
1537
|
inputSchema: impactInputSchema,
|
|
1464
1538
|
},
|
|
1465
|
-
(args) => handleImpact(args, ctx)
|
|
1539
|
+
(args, _req, _server, ctx) => handleImpact(args as never, ctx)
|
|
1466
1540
|
);
|
|
1467
|
-
|
|
1468
|
-
registerTool(
|
|
1541
|
+
add(
|
|
1469
1542
|
"gno_trace_list",
|
|
1470
1543
|
{
|
|
1471
1544
|
description:
|
|
1472
1545
|
"List bounded metadata-only summaries of private local retrieval traces. Raw replay queries are omitted from history.",
|
|
1473
1546
|
inputSchema: traceListInputSchema,
|
|
1474
1547
|
},
|
|
1475
|
-
(args) => handleTraceList(args, ctx)
|
|
1548
|
+
(args, _req, _server, ctx) => handleTraceList(args as never, ctx)
|
|
1476
1549
|
);
|
|
1477
|
-
|
|
1478
|
-
registerTool(
|
|
1550
|
+
add(
|
|
1479
1551
|
"gno_trace_show",
|
|
1480
1552
|
{
|
|
1481
1553
|
description:
|
|
1482
1554
|
"Inspect one bounded local retrieval trace. Replay-mode content is returned only for the explicitly requested trace.",
|
|
1483
1555
|
inputSchema: traceShowInputSchema,
|
|
1484
1556
|
},
|
|
1485
|
-
(args) => handleTraceShow(args, ctx)
|
|
1557
|
+
(args, _req, _server, ctx) => handleTraceShow(args as never, ctx)
|
|
1486
1558
|
);
|
|
1487
|
-
|
|
1488
|
-
registerTool(
|
|
1559
|
+
add(
|
|
1489
1560
|
"gno_list_metadata",
|
|
1490
1561
|
{
|
|
1491
1562
|
description:
|
|
1492
1563
|
"List the typed metadata keys indexed documents carry, with observed types, document counts and the most common values. Call before writing a filter predicate on custom metadata you have not seen.",
|
|
1493
1564
|
inputSchema: listMetadataInputSchema,
|
|
1494
1565
|
},
|
|
1495
|
-
(args) =>
|
|
1566
|
+
(args, _req, _server, ctx) =>
|
|
1496
1567
|
runTool(
|
|
1497
1568
|
ctx,
|
|
1498
1569
|
"gno_list_metadata",
|
|
1499
|
-
() => readMetadataSummary(ctx.store, args),
|
|
1570
|
+
() => readMetadataSummary(ctx.store, args as never),
|
|
1500
1571
|
formatMetadataSummary
|
|
1501
1572
|
)
|
|
1502
1573
|
);
|
|
1503
|
-
|
|
1504
|
-
registerTool(
|
|
1574
|
+
add(
|
|
1505
1575
|
"gno_list_tags",
|
|
1506
1576
|
{
|
|
1507
1577
|
description:
|
|
1508
1578
|
"List all tags with document counts. Use prefix to filter hierarchical tags (e.g. 'project/').",
|
|
1509
1579
|
inputSchema: listTagsInputSchema,
|
|
1510
1580
|
},
|
|
1511
|
-
(args) => handleListTags(args, ctx)
|
|
1581
|
+
(args, _req, _server, ctx) => handleListTags(args as never, ctx)
|
|
1512
1582
|
);
|
|
1513
|
-
|
|
1514
|
-
registerTool(
|
|
1583
|
+
add(
|
|
1515
1584
|
"gno_links",
|
|
1516
1585
|
{
|
|
1517
1586
|
description:
|
|
1518
1587
|
"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.",
|
|
1519
1588
|
inputSchema: linksInputSchema,
|
|
1520
1589
|
},
|
|
1521
|
-
(args) => handleLinks(args, ctx)
|
|
1590
|
+
(args, _req, _server, ctx) => handleLinks(args as never, ctx)
|
|
1522
1591
|
);
|
|
1523
|
-
|
|
1524
|
-
registerTool(
|
|
1592
|
+
add(
|
|
1525
1593
|
"gno_backlinks",
|
|
1526
1594
|
{
|
|
1527
1595
|
description:
|
|
1528
1596
|
"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.",
|
|
1529
1597
|
inputSchema: backlinksInputSchema,
|
|
1530
1598
|
},
|
|
1531
|
-
(args) => handleBacklinks(args, ctx)
|
|
1599
|
+
(args, _req, _server, ctx) => handleBacklinks(args as never, ctx)
|
|
1532
1600
|
);
|
|
1533
|
-
|
|
1534
|
-
registerTool(
|
|
1601
|
+
add(
|
|
1535
1602
|
"gno_similar",
|
|
1536
1603
|
{
|
|
1537
1604
|
description:
|
|
1538
1605
|
"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.",
|
|
1539
1606
|
inputSchema: similarInputSchema,
|
|
1540
1607
|
},
|
|
1541
|
-
(args) => handleSimilar(args, ctx)
|
|
1608
|
+
(args, _req, _server, ctx) => handleSimilar(args as never, ctx)
|
|
1542
1609
|
);
|
|
1543
|
-
|
|
1544
|
-
registerTool(
|
|
1610
|
+
add(
|
|
1545
1611
|
"gno_graph",
|
|
1546
1612
|
{
|
|
1547
1613
|
description:
|
|
1548
1614
|
"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.",
|
|
1549
1615
|
inputSchema: graphInputSchema,
|
|
1550
1616
|
},
|
|
1551
|
-
(args) => handleGraph(args, ctx)
|
|
1617
|
+
(args, _req, _server, ctx) => handleGraph(args as never, ctx)
|
|
1552
1618
|
);
|
|
1553
|
-
|
|
1554
|
-
registerTool(
|
|
1619
|
+
add(
|
|
1555
1620
|
"gno_graph_query",
|
|
1556
1621
|
{
|
|
1557
1622
|
description:
|
|
1558
1623
|
"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.",
|
|
1559
1624
|
inputSchema: graphQueryInputSchema,
|
|
1560
1625
|
},
|
|
1561
|
-
(args) => handleGraphQuery(args, ctx)
|
|
1626
|
+
(args, _req, _server, ctx) => handleGraphQuery(args as never, ctx)
|
|
1562
1627
|
);
|
|
1563
|
-
|
|
1564
|
-
registerTool(
|
|
1628
|
+
add(
|
|
1565
1629
|
"gno_graph_neighbors",
|
|
1566
1630
|
{
|
|
1567
1631
|
description:
|
|
1568
1632
|
"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.",
|
|
1569
1633
|
inputSchema: graphNeighborsInputSchema,
|
|
1570
1634
|
},
|
|
1571
|
-
(args) => handleGraphNeighbors(args, ctx)
|
|
1635
|
+
(args, _req, _server, ctx) => handleGraphNeighbors(args as never, ctx)
|
|
1572
1636
|
);
|
|
1573
|
-
|
|
1574
|
-
registerTool(
|
|
1637
|
+
add(
|
|
1575
1638
|
"gno_graph_path",
|
|
1576
1639
|
{
|
|
1577
1640
|
description:
|
|
1578
1641
|
"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.",
|
|
1579
1642
|
inputSchema: graphPathInputSchema,
|
|
1580
1643
|
},
|
|
1581
|
-
(args) => handleGraphPath(args, ctx)
|
|
1644
|
+
(args, _req, _server, ctx) => handleGraphPath(args as never, ctx)
|
|
1582
1645
|
);
|
|
1583
1646
|
|
|
1584
|
-
if (
|
|
1585
|
-
|
|
1647
|
+
if (enableWrite) {
|
|
1648
|
+
add(
|
|
1586
1649
|
"gno_egress_policy_set",
|
|
1587
1650
|
{
|
|
1588
1651
|
description:
|
|
1589
1652
|
"Set one collection policy. Relaxation requires confirmation bound to the current policy and version.",
|
|
1590
1653
|
inputSchema: egressPolicySetInputSchema,
|
|
1591
1654
|
},
|
|
1592
|
-
(args) => handleEgressPolicySet(args, ctx)
|
|
1655
|
+
(args, _req, _server, ctx) => handleEgressPolicySet(args as never, ctx)
|
|
1593
1656
|
);
|
|
1594
|
-
|
|
1595
|
-
registerTool(
|
|
1657
|
+
add(
|
|
1596
1658
|
"gno_egress_audit_delete",
|
|
1597
1659
|
{
|
|
1598
1660
|
description:
|
|
1599
1661
|
"Delete exactly one local egress audit receipt with physical cleanup status.",
|
|
1600
1662
|
inputSchema: egressAuditIdInputSchema,
|
|
1601
1663
|
},
|
|
1602
|
-
(args) => handleEgressAuditDelete(args, ctx)
|
|
1664
|
+
(args, _req, _server, ctx) => handleEgressAuditDelete(args as never, ctx)
|
|
1603
1665
|
);
|
|
1604
|
-
|
|
1605
|
-
registerTool(
|
|
1666
|
+
add(
|
|
1606
1667
|
"gno_egress_audit_purge",
|
|
1607
1668
|
{
|
|
1608
1669
|
description:
|
|
1609
1670
|
"Purge local egress audit receipts only. Requires confirm=true.",
|
|
1610
1671
|
inputSchema: egressAuditPurgeInputSchema,
|
|
1611
1672
|
},
|
|
1612
|
-
(args) => handleEgressAuditPurge(args, ctx)
|
|
1673
|
+
(args, _req, _server, ctx) => handleEgressAuditPurge(args as never, ctx)
|
|
1613
1674
|
);
|
|
1614
|
-
|
|
1615
|
-
registerTool(
|
|
1675
|
+
add(
|
|
1616
1676
|
"gno_trace_label",
|
|
1617
1677
|
{
|
|
1618
1678
|
description:
|
|
1619
1679
|
"Append an explicit relevant, irrelevant, or missing_expected judgment to a local retrieval trace.",
|
|
1620
1680
|
inputSchema: traceLabelInputSchema,
|
|
1621
1681
|
},
|
|
1622
|
-
(args) => handleTraceLabel(args, ctx)
|
|
1682
|
+
(args, _req, _server, ctx) => handleTraceLabel(args as never, ctx)
|
|
1623
1683
|
);
|
|
1624
|
-
|
|
1625
|
-
registerTool(
|
|
1684
|
+
add(
|
|
1626
1685
|
"gno_trace_export",
|
|
1627
1686
|
{
|
|
1628
1687
|
description:
|
|
1629
1688
|
"Build a deterministic local agentic receipt from one or more immutable terminal retrieval traces.",
|
|
1630
1689
|
inputSchema: traceExportInputSchema,
|
|
1631
1690
|
},
|
|
1632
|
-
(args) => handleTraceExport(args, ctx)
|
|
1691
|
+
(args, _req, _server, ctx) => handleTraceExport(args as never, ctx)
|
|
1633
1692
|
);
|
|
1634
|
-
|
|
1635
|
-
registerTool(
|
|
1693
|
+
add(
|
|
1636
1694
|
"gno_trace_delete",
|
|
1637
1695
|
{
|
|
1638
1696
|
description:
|
|
1639
1697
|
"Delete one private local retrieval trace and all owned receipt records.",
|
|
1640
1698
|
inputSchema: traceDeleteInputSchema,
|
|
1641
1699
|
},
|
|
1642
|
-
(args) => handleTraceDelete(args, ctx)
|
|
1700
|
+
(args, _req, _server, ctx) => handleTraceDelete(args as never, ctx)
|
|
1643
1701
|
);
|
|
1644
|
-
|
|
1645
|
-
registerTool(
|
|
1702
|
+
add(
|
|
1646
1703
|
"gno_trace_purge",
|
|
1647
1704
|
{
|
|
1648
1705
|
description:
|
|
1649
1706
|
"Purge every private local retrieval trace receipt. Requires confirm=true.",
|
|
1650
1707
|
inputSchema: tracePurgeInputSchema,
|
|
1651
1708
|
},
|
|
1652
|
-
(args) => handleTracePurge(args, ctx)
|
|
1709
|
+
(args, _req, _server, ctx) => handleTracePurge(args as never, ctx)
|
|
1653
1710
|
);
|
|
1654
|
-
|
|
1655
|
-
registerTool(
|
|
1711
|
+
add(
|
|
1656
1712
|
"gno_remember",
|
|
1657
1713
|
{
|
|
1658
1714
|
description: describe("gno_remember", MCP_TOOL_DESCRIPTIONS.remember),
|
|
1659
1715
|
inputSchema: rememberInputSchema,
|
|
1660
1716
|
annotations: REMEMBER_MCP_ANNOTATIONS,
|
|
1661
1717
|
},
|
|
1662
|
-
(args, request) =>
|
|
1663
|
-
handleRemember(args, ctx, {
|
|
1718
|
+
(args, request, server, ctx) =>
|
|
1719
|
+
handleRemember(args as never, ctx, {
|
|
1664
1720
|
clientName: server.server.getClientVersion()?.name,
|
|
1665
1721
|
sessionId: request.sessionId,
|
|
1666
1722
|
requestIdentity: ctx.getRequestIdentity?.(),
|
|
1667
1723
|
})
|
|
1668
1724
|
);
|
|
1669
|
-
|
|
1670
|
-
registerTool(
|
|
1725
|
+
add(
|
|
1671
1726
|
"gno_sessions_import",
|
|
1672
1727
|
{
|
|
1673
1728
|
description:
|
|
@@ -1675,10 +1730,9 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1675
1730
|
inputSchema: sessionsImportInputSchema,
|
|
1676
1731
|
annotations: SESSIONS_IMPORT_MCP_ANNOTATIONS,
|
|
1677
1732
|
},
|
|
1678
|
-
(args) => handleSessionsImport(args, ctx)
|
|
1733
|
+
(args, _req, _server, ctx) => handleSessionsImport(args as never, ctx)
|
|
1679
1734
|
);
|
|
1680
|
-
|
|
1681
|
-
registerTool(
|
|
1735
|
+
add(
|
|
1682
1736
|
"gno_sessions_automation_run",
|
|
1683
1737
|
{
|
|
1684
1738
|
description:
|
|
@@ -1686,10 +1740,10 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1686
1740
|
inputSchema: sessionsAutomationRunInputSchema,
|
|
1687
1741
|
annotations: SESSIONS_AUTOMATION_RUN_MCP_ANNOTATIONS,
|
|
1688
1742
|
},
|
|
1689
|
-
(args
|
|
1743
|
+
(args, _req, _server, ctx) =>
|
|
1744
|
+
handleSessionsAutomationRun(args as never, ctx)
|
|
1690
1745
|
);
|
|
1691
|
-
|
|
1692
|
-
registerTool(
|
|
1746
|
+
add(
|
|
1693
1747
|
"gno_capture",
|
|
1694
1748
|
{
|
|
1695
1749
|
description: describe(
|
|
@@ -1698,10 +1752,9 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1698
1752
|
),
|
|
1699
1753
|
inputSchema: captureInputSchema,
|
|
1700
1754
|
},
|
|
1701
|
-
(args) => handleCapture(args, ctx)
|
|
1755
|
+
(args, _req, _server, ctx) => handleCapture(args as never, ctx)
|
|
1702
1756
|
);
|
|
1703
|
-
|
|
1704
|
-
registerTool(
|
|
1757
|
+
add(
|
|
1705
1758
|
"gno_request_status",
|
|
1706
1759
|
{
|
|
1707
1760
|
description: describe(
|
|
@@ -1711,78 +1764,71 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1711
1764
|
inputSchema: requestStatusInputSchema,
|
|
1712
1765
|
annotations: REQUEST_STATUS_MCP_ANNOTATIONS,
|
|
1713
1766
|
},
|
|
1714
|
-
(args) => handleRequestStatus(args, ctx)
|
|
1767
|
+
(args, _req, _server, ctx) => handleRequestStatus(args as never, ctx)
|
|
1715
1768
|
);
|
|
1716
|
-
|
|
1717
|
-
registerTool(
|
|
1769
|
+
add(
|
|
1718
1770
|
"gno_add_collection",
|
|
1719
1771
|
{
|
|
1720
1772
|
description:
|
|
1721
1773
|
"Add a directory as a new collection and start indexing. Returns a job ID for tracking.",
|
|
1722
1774
|
inputSchema: addCollectionInputSchema,
|
|
1723
1775
|
},
|
|
1724
|
-
(args) => handleAddCollection(args, ctx)
|
|
1776
|
+
(args, _req, _server, ctx) => handleAddCollection(args as never, ctx)
|
|
1725
1777
|
);
|
|
1726
|
-
|
|
1727
|
-
registerTool(
|
|
1778
|
+
add(
|
|
1728
1779
|
"gno_sync",
|
|
1729
1780
|
{
|
|
1730
1781
|
description:
|
|
1731
1782
|
"Sync files from disk into the index (FTS only, no embeddings). Does NOT auto-embed; run gno_embed after if vector search needed.",
|
|
1732
1783
|
inputSchema: syncInputSchema,
|
|
1733
1784
|
},
|
|
1734
|
-
(args) => handleSync(args, ctx)
|
|
1785
|
+
(args, _req, _server, ctx) => handleSync(args as never, ctx)
|
|
1735
1786
|
);
|
|
1736
|
-
|
|
1737
|
-
registerTool(
|
|
1787
|
+
add(
|
|
1738
1788
|
"gno_embed",
|
|
1739
1789
|
{
|
|
1740
1790
|
description:
|
|
1741
1791
|
"Generate vector embeddings for all unembedded chunks, optionally scoped to one collection. Async: returns a job ID. Poll with gno_job_status.",
|
|
1742
1792
|
inputSchema: embedInputSchema,
|
|
1743
1793
|
},
|
|
1744
|
-
(args) => handleEmbed(args, ctx)
|
|
1794
|
+
(args, _req, _server, ctx) => handleEmbed(args as never, ctx)
|
|
1745
1795
|
);
|
|
1746
|
-
|
|
1747
|
-
registerTool(
|
|
1796
|
+
add(
|
|
1748
1797
|
"gno_index",
|
|
1749
1798
|
{
|
|
1750
1799
|
description:
|
|
1751
1800
|
"Full index: sync files from disk + generate embeddings. Async: returns a job ID. Poll with gno_job_status.",
|
|
1752
1801
|
inputSchema: indexInputSchema,
|
|
1753
1802
|
},
|
|
1754
|
-
(args) => handleIndex(args, ctx)
|
|
1803
|
+
(args, _req, _server, ctx) => handleIndex(args as never, ctx)
|
|
1755
1804
|
);
|
|
1756
|
-
|
|
1757
|
-
registerTool(
|
|
1805
|
+
add(
|
|
1758
1806
|
"gno_remove_collection",
|
|
1759
1807
|
{
|
|
1760
1808
|
description:
|
|
1761
1809
|
"Remove a collection from config and delete its indexed data.",
|
|
1762
1810
|
inputSchema: removeCollectionInputSchema,
|
|
1763
1811
|
},
|
|
1764
|
-
(args) => handleRemoveCollection(args, ctx)
|
|
1812
|
+
(args, _req, _server, ctx) => handleRemoveCollection(args as never, ctx)
|
|
1765
1813
|
);
|
|
1766
|
-
|
|
1767
|
-
registerTool(
|
|
1814
|
+
add(
|
|
1768
1815
|
"gno_clear_collection_embeddings",
|
|
1769
1816
|
{
|
|
1770
1817
|
description: "Remove stale or all embeddings for one collection.",
|
|
1771
1818
|
inputSchema: clearCollectionEmbeddingsInputSchema,
|
|
1772
1819
|
},
|
|
1773
|
-
(args
|
|
1820
|
+
(args, _req, _server, ctx) =>
|
|
1821
|
+
handleClearCollectionEmbeddings(args as never, ctx)
|
|
1774
1822
|
);
|
|
1775
|
-
|
|
1776
|
-
registerTool(
|
|
1823
|
+
add(
|
|
1777
1824
|
"gno_create_folder",
|
|
1778
1825
|
{
|
|
1779
1826
|
description: "Create a folder inside an existing collection.",
|
|
1780
1827
|
inputSchema: createFolderInputSchema,
|
|
1781
1828
|
},
|
|
1782
|
-
(args) => handleCreateFolder(args, ctx)
|
|
1829
|
+
(args, _req, _server, ctx) => handleCreateFolder(args as never, ctx)
|
|
1783
1830
|
);
|
|
1784
|
-
|
|
1785
|
-
registerTool(
|
|
1831
|
+
add(
|
|
1786
1832
|
"gno_rename_note",
|
|
1787
1833
|
{
|
|
1788
1834
|
description:
|
|
@@ -1790,10 +1836,9 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1790
1836
|
inputSchema: renameNoteInputSchema,
|
|
1791
1837
|
annotations: RENAME_NOTE_MCP_ANNOTATIONS,
|
|
1792
1838
|
},
|
|
1793
|
-
(args) => handleRenameNote(args, ctx)
|
|
1839
|
+
(args, _req, _server, ctx) => handleRenameNote(args as never, ctx)
|
|
1794
1840
|
);
|
|
1795
|
-
|
|
1796
|
-
registerTool(
|
|
1841
|
+
add(
|
|
1797
1842
|
"gno_move_note",
|
|
1798
1843
|
{
|
|
1799
1844
|
description:
|
|
@@ -1801,37 +1846,70 @@ export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
|
1801
1846
|
inputSchema: moveNoteInputSchema,
|
|
1802
1847
|
annotations: MOVE_NOTE_MCP_ANNOTATIONS,
|
|
1803
1848
|
},
|
|
1804
|
-
(args) => handleMoveNote(args, ctx)
|
|
1849
|
+
(args, _req, _server, ctx) => handleMoveNote(args as never, ctx)
|
|
1805
1850
|
);
|
|
1806
|
-
|
|
1807
|
-
registerTool(
|
|
1851
|
+
add(
|
|
1808
1852
|
"gno_duplicate_note",
|
|
1809
1853
|
{
|
|
1810
1854
|
description:
|
|
1811
1855
|
"Duplicate an editable note into the current or another folder.",
|
|
1812
1856
|
inputSchema: duplicateNoteInputSchema,
|
|
1813
1857
|
},
|
|
1814
|
-
(args) => handleDuplicateNote(args, ctx)
|
|
1858
|
+
(args, _req, _server, ctx) => handleDuplicateNote(args as never, ctx)
|
|
1815
1859
|
);
|
|
1816
1860
|
}
|
|
1817
1861
|
|
|
1818
|
-
|
|
1862
|
+
add(
|
|
1819
1863
|
"gno_job_status",
|
|
1820
1864
|
{
|
|
1821
1865
|
description:
|
|
1822
1866
|
"Check status of an async job (embed, index). Returns progress percentage and completion state.",
|
|
1823
1867
|
inputSchema: jobStatusInputSchema,
|
|
1824
1868
|
},
|
|
1825
|
-
(args) => handleJobStatus(args, ctx)
|
|
1869
|
+
(args, _req, _server, ctx) => handleJobStatus(args as never, ctx)
|
|
1826
1870
|
);
|
|
1827
|
-
|
|
1828
|
-
registerTool(
|
|
1871
|
+
add(
|
|
1829
1872
|
"gno_list_jobs",
|
|
1830
1873
|
{
|
|
1831
1874
|
description:
|
|
1832
1875
|
"List active and recently completed async jobs with their status and progress.",
|
|
1833
1876
|
inputSchema: listJobsInputSchema,
|
|
1834
1877
|
},
|
|
1835
|
-
(args) => handleListJobs(args, ctx)
|
|
1878
|
+
(args, _req, _server, ctx) => handleListJobs(args as never, ctx)
|
|
1836
1879
|
);
|
|
1880
|
+
|
|
1881
|
+
staticToolTables.set(key, entries);
|
|
1882
|
+
return entries;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
export function registerTools(server: McpServer, ctx: ToolContext): void {
|
|
1886
|
+
// Tool IDs use underscores (MCP pattern: ^[a-zA-Z0-9_-]{1,64}$)
|
|
1887
|
+
const profile = ctx.toolProfile ?? DEFAULT_MCP_TOOL_PROFILE;
|
|
1888
|
+
const table = getStaticToolTable(profile, ctx.enableWrite);
|
|
1889
|
+
const connection = new AbortController();
|
|
1890
|
+
const previousClose = server.server.onclose;
|
|
1891
|
+
server.server.onclose = () => {
|
|
1892
|
+
connection.abort();
|
|
1893
|
+
previousClose?.();
|
|
1894
|
+
};
|
|
1895
|
+
|
|
1896
|
+
for (const entry of table) {
|
|
1897
|
+
server.registerTool(
|
|
1898
|
+
entry.name,
|
|
1899
|
+
entry.config as never,
|
|
1900
|
+
((...args: unknown[]) => {
|
|
1901
|
+
const request = args.at(-1) as {
|
|
1902
|
+
sessionId?: string;
|
|
1903
|
+
mcpReq: { signal: AbortSignal };
|
|
1904
|
+
};
|
|
1905
|
+
const input = args.length === 1 ? undefined : args[0];
|
|
1906
|
+
return withInferenceScope(
|
|
1907
|
+
{
|
|
1908
|
+
signal: AbortSignal.any([connection.signal, request.mcpReq.signal]),
|
|
1909
|
+
},
|
|
1910
|
+
() => entry.invoke(input, request, server, ctx)
|
|
1911
|
+
);
|
|
1912
|
+
}) as never
|
|
1913
|
+
);
|
|
1914
|
+
}
|
|
1837
1915
|
}
|