perf(mcp): add opt-in hot/cold tool discovery (#9046)

Add per-connection discovery that loads canonical named tools on demand while preserving the default full catalog. Bound discovery replies before changing visibility, preserve family exclusions and Evidence workflows, and reset visibility on HTTP reconnect.

Verified with focused protocol tests and real Codex CLI artifact investigations; token costs remain task-dependent, so the profile is opt-in.
This commit is contained in:
gensokyo-dev authored and GitHub committed 2026-11-05 20:27:31 +00:00
1 parent ad518cff65
commit 0beedcd712
22 files changed
+956 -42

No files matched your search

+14 -9
View File
@@ -8,6 +8,7 @@ import { providerCapabilitySets } from "./binary/BinarySessionStatus.js";
import { sqliteDatabaseCapability } from "./sqlite/SqliteDatabaseCapability.js";
import { CURRENT_ENTRYPOINT_PATH } from "../process/CurrentEntrypointPath.js";
import { catalogIdentityForToolFamilies } from "../catalogIdentity.js";
import { progressiveCatalogIdentity } from "../catalogDiscovery.js";
import { compactPresentationForMcpInputSchemaProfile } from "../config/mcpInputSchemaProfile.js";
import {
directAnalysisCleanupFailure,
@@ -31,6 +32,15 @@ export const runSessionStatus = async (
session,
async () => {
const status = jsonObjectSchema.parse(await session.status());
const catalog = catalogIdentityForToolFamilies(
compactPresentationForMcpInputSchemaProfile(
config.value.mcpInputSchemaProfile,
),
config.value.mcpOutputSchemaProfile ?? "full",
config.value.mcpToolFamilies === undefined
? undefined
: new Set(config.value.mcpToolFamilies),
);
return {
...status,
capabilities: [
@@ -42,15 +52,10 @@ export const runSessionStatus = async (
server_identity: createServerIdentity({
startedAt: new Date().toISOString(),
commandPath: CURRENT_ENTRYPOINT_PATH,
catalog: catalogIdentityForToolFamilies(
compactPresentationForMcpInputSchemaProfile(
config.value.mcpInputSchemaProfile,
),
config.value.mcpOutputSchemaProfile ?? "full",
config.value.mcpToolFamilies === undefined
? undefined
: new Set(config.value.mcpToolFamilies),
),
catalog:
config.value.mcpToolCatalogProfile === "hot-cold"
? progressiveCatalogIdentity(catalog)
: catalog,
}),
};
},