@mcp-ts/sdk 2.1.0 → 2.3.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/dist/adapters/agui-adapter.d.mts +1 -1
- package/dist/adapters/agui-adapter.d.ts +1 -1
- package/dist/adapters/agui-middleware.d.mts +1 -1
- package/dist/adapters/agui-middleware.d.ts +1 -1
- package/dist/adapters/ai-adapter.d.mts +1 -1
- package/dist/adapters/ai-adapter.d.ts +1 -1
- package/dist/adapters/langchain-adapter.d.mts +1 -1
- package/dist/adapters/langchain-adapter.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +86 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -5
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +13 -1
- package/dist/server/index.d.ts +13 -1
- package/dist/server/index.js +66 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +66 -2
- package/dist/server/index.mjs.map +1 -1
- package/dist/shared/index.d.mts +2 -2
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +20 -3
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +20 -3
- package/dist/shared/index.mjs.map +1 -1
- package/dist/{tool-router-BkQnso27.d.mts → tool-router-C8hIA-tg.d.mts} +9 -0
- package/dist/{tool-router-BP8TT9mI.d.ts → tool-router-CdX8e9bk.d.ts} +9 -0
- package/package.json +1 -1
- package/src/server/index.ts +8 -1
- package/src/server/storage/index.ts +77 -2
- package/src/server/storage/types.ts +14 -0
- package/src/shared/tool-router.ts +31 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-DYNe6az3.mjs';
|
|
2
|
-
import { d as ToolRouter } from '../tool-router-
|
|
2
|
+
import { d as ToolRouter } from '../tool-router-C8hIA-tg.mjs';
|
|
3
3
|
import '../events-CK3N--3g.mjs';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-BYtguGJm.js';
|
|
2
|
-
import { d as ToolRouter } from '../tool-router-
|
|
2
|
+
import { d as ToolRouter } from '../tool-router-CdX8e9bk.js';
|
|
3
3
|
import '../events-CK3N--3g.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
@@ -7,7 +7,7 @@ import '../events-CK3N--3g.mjs';
|
|
|
7
7
|
import '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
9
9
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
10
|
-
import '../tool-router-
|
|
10
|
+
import '../tool-router-C8hIA-tg.mjs';
|
|
11
11
|
import '../types-CxFaaZrM.mjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -7,7 +7,7 @@ import '../events-CK3N--3g.js';
|
|
|
7
7
|
import '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
9
9
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
10
|
-
import '../tool-router-
|
|
10
|
+
import '../tool-router-CdX8e9bk.js';
|
|
11
11
|
import '../types-CxFaaZrM.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-DYNe6az3.mjs';
|
|
2
2
|
import { ToolSet } from 'ai';
|
|
3
|
-
import { d as ToolRouter } from '../tool-router-
|
|
3
|
+
import { d as ToolRouter } from '../tool-router-C8hIA-tg.mjs';
|
|
4
4
|
import '../events-CK3N--3g.mjs';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-BYtguGJm.js';
|
|
2
2
|
import { ToolSet } from 'ai';
|
|
3
|
-
import { d as ToolRouter } from '../tool-router-
|
|
3
|
+
import { d as ToolRouter } from '../tool-router-CdX8e9bk.js';
|
|
4
4
|
import '../events-CK3N--3g.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-DYNe6az3.mjs';
|
|
2
2
|
import { StructuredTool } from '@langchain/core/tools';
|
|
3
|
-
import { d as ToolRouter } from '../tool-router-
|
|
3
|
+
import { d as ToolRouter } from '../tool-router-C8hIA-tg.mjs';
|
|
4
4
|
import '../events-CK3N--3g.mjs';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-BYtguGJm.js';
|
|
2
2
|
import { StructuredTool } from '@langchain/core/tools';
|
|
3
|
-
import { d as ToolRouter } from '../tool-router-
|
|
3
|
+
import { d as ToolRouter } from '../tool-router-CdX8e9bk.js';
|
|
4
4
|
import '../events-CK3N--3g.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { M as MCPClient, a as MultiSessionClient, S as StorageOAuthClientProvider } from './multi-session-client-DYNe6az3.mjs';
|
|
2
2
|
export { A as AuthenticationError, C as ConfigurationError, a as ConnectionError, I as InvalidStateError, M as McpError, N as NotConnectedError, R as RpcErrorCode, b as RpcErrorCodes, S as SessionNotFoundError, c as SessionValidationError, T as ToolExecutionError, U as UnauthorizedError, s as sanitizeServerLabel } from './utils-DELRKQPU.mjs';
|
|
3
|
-
export { ClientMetadata, NextMcpHandlerOptions, SSEConnectionManager, SSEHandlerOptions, SessionStore, createNextMcpHandler, createSSEHandler, sessions } from './server/index.mjs';
|
|
3
|
+
export { ClientMetadata, NextMcpHandlerOptions, SSEConnectionManager, SSEHandlerOptions, Session, SessionMutationEvent, SessionMutationListener, SessionMutationType, SessionStore, createNextMcpHandler, createSSEHandler, onSessionMutation, sessions } from './server/index.mjs';
|
|
4
4
|
export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, M as McpConnectionEvent, c as McpConnectionState, d as McpObservabilityEvent } from './events-CK3N--3g.mjs';
|
|
5
5
|
export { C as CallToolParams, a as CallToolRequest, b as CallToolResponse, c as ConnectAuthRequiredResponse, d as ConnectErrorResponse, e as ConnectParams, f as ConnectRequest, g as ConnectResponse, h as ConnectResult, i as ConnectSuccessResponse, D as DisconnectParams, j as DisconnectResult, F as FinishAuthParams, k as FinishAuthResult, G as GetPromptParams, l as GetSessionResult, L as ListPromptsResult, m as ListResourcesResult, n as ListToolsResponse, o as ListToolsRpcResult, M as McpRpcMethod, p as McpRpcParams, q as McpRpcRequest, r as McpRpcResponse, R as ReadResourceParams, S as SessionInfo, s as SessionListResult, t as SessionParams, T as ToolClient, u as ToolClientProvider, v as ToolInfo, w as TransportType, x as isCallToolSuccess, y as isConnectAuthRequired, z as isConnectError, A as isConnectSuccess, B as isListToolsSuccess } from './types-CxFaaZrM.mjs';
|
|
6
6
|
export { OAuthClientInformation, OAuthClientInformationFull, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
7
7
|
export { CallToolResult, ListToolsResult, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from './index-Cfjsme-a.mjs';
|
|
9
9
|
export { CallToolFn, DEFAULT_CLIENT_NAME, DEFAULT_CLIENT_URI, DEFAULT_HEARTBEAT_INTERVAL_MS, DEFAULT_LOGO_URI, DEFAULT_POLICY_URI, MCP_CLIENT_NAME, MCP_CLIENT_VERSION, REDIS_KEY_PREFIX, SESSION_TTL_SECONDS, SOFTWARE_ID, SOFTWARE_VERSION, STATE_EXPIRATION_MS, TOKEN_EXPIRY_BUFFER_MS, ToolUiConfig, createExecuteToolDefinition, createGetSchemaToolDefinition, createListServersToolDefinition, createRegexSearchToolDefinition, createSearchToolDefinition, executeMetaTool, findToolByName, getToolUiResourceUri, isMetaTool, resolveMetaToolProxy } from './shared/index.mjs';
|
|
10
|
-
export { C as CompactTool, E as EmbedFn, I as IndexedTool, S as SchemaCompressor, T as ToolGroupInfo, a as ToolIndex, b as ToolIndexOptions, c as ToolListResult, d as ToolRouter, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSearchOptions, i as ToolServerSummary, j as ToolSummary } from './tool-router-
|
|
10
|
+
export { C as CompactTool, E as EmbedFn, I as IndexedTool, S as SchemaCompressor, T as ToolGroupInfo, a as ToolIndex, b as ToolIndexOptions, c as ToolListResult, d as ToolRouter, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSearchOptions, i as ToolServerSummary, j as ToolSummary } from './tool-router-C8hIA-tg.mjs';
|
|
11
11
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
12
12
|
import '@modelcontextprotocol/ext-apps/app-bridge';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { M as MCPClient, a as MultiSessionClient, S as StorageOAuthClientProvider } from './multi-session-client-BYtguGJm.js';
|
|
2
2
|
export { A as AuthenticationError, C as ConfigurationError, a as ConnectionError, I as InvalidStateError, M as McpError, N as NotConnectedError, R as RpcErrorCode, b as RpcErrorCodes, S as SessionNotFoundError, c as SessionValidationError, T as ToolExecutionError, U as UnauthorizedError, s as sanitizeServerLabel } from './utils-DELRKQPU.js';
|
|
3
|
-
export { ClientMetadata, NextMcpHandlerOptions, SSEConnectionManager, SSEHandlerOptions, SessionStore, createNextMcpHandler, createSSEHandler, sessions } from './server/index.js';
|
|
3
|
+
export { ClientMetadata, NextMcpHandlerOptions, SSEConnectionManager, SSEHandlerOptions, Session, SessionMutationEvent, SessionMutationListener, SessionMutationType, SessionStore, createNextMcpHandler, createSSEHandler, onSessionMutation, sessions } from './server/index.js';
|
|
4
4
|
export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, M as McpConnectionEvent, c as McpConnectionState, d as McpObservabilityEvent } from './events-CK3N--3g.js';
|
|
5
5
|
export { C as CallToolParams, a as CallToolRequest, b as CallToolResponse, c as ConnectAuthRequiredResponse, d as ConnectErrorResponse, e as ConnectParams, f as ConnectRequest, g as ConnectResponse, h as ConnectResult, i as ConnectSuccessResponse, D as DisconnectParams, j as DisconnectResult, F as FinishAuthParams, k as FinishAuthResult, G as GetPromptParams, l as GetSessionResult, L as ListPromptsResult, m as ListResourcesResult, n as ListToolsResponse, o as ListToolsRpcResult, M as McpRpcMethod, p as McpRpcParams, q as McpRpcRequest, r as McpRpcResponse, R as ReadResourceParams, S as SessionInfo, s as SessionListResult, t as SessionParams, T as ToolClient, u as ToolClientProvider, v as ToolInfo, w as TransportType, x as isCallToolSuccess, y as isConnectAuthRequired, z as isConnectError, A as isConnectSuccess, B as isListToolsSuccess } from './types-CxFaaZrM.js';
|
|
6
6
|
export { OAuthClientInformation, OAuthClientInformationFull, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
7
7
|
export { CallToolResult, ListToolsResult, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from './index-CmjMd2ac.js';
|
|
9
9
|
export { CallToolFn, DEFAULT_CLIENT_NAME, DEFAULT_CLIENT_URI, DEFAULT_HEARTBEAT_INTERVAL_MS, DEFAULT_LOGO_URI, DEFAULT_POLICY_URI, MCP_CLIENT_NAME, MCP_CLIENT_VERSION, REDIS_KEY_PREFIX, SESSION_TTL_SECONDS, SOFTWARE_ID, SOFTWARE_VERSION, STATE_EXPIRATION_MS, TOKEN_EXPIRY_BUFFER_MS, ToolUiConfig, createExecuteToolDefinition, createGetSchemaToolDefinition, createListServersToolDefinition, createRegexSearchToolDefinition, createSearchToolDefinition, executeMetaTool, findToolByName, getToolUiResourceUri, isMetaTool, resolveMetaToolProxy } from './shared/index.js';
|
|
10
|
-
export { C as CompactTool, E as EmbedFn, I as IndexedTool, S as SchemaCompressor, T as ToolGroupInfo, a as ToolIndex, b as ToolIndexOptions, c as ToolListResult, d as ToolRouter, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSearchOptions, i as ToolServerSummary, j as ToolSummary } from './tool-router-
|
|
10
|
+
export { C as CompactTool, E as EmbedFn, I as IndexedTool, S as SchemaCompressor, T as ToolGroupInfo, a as ToolIndex, b as ToolIndexOptions, c as ToolListResult, d as ToolRouter, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSearchOptions, i as ToolServerSummary, j as ToolSummary } from './tool-router-CdX8e9bk.js';
|
|
11
11
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
12
12
|
import '@modelcontextprotocol/ext-apps/app-bridge';
|
package/dist/index.js
CHANGED
|
@@ -1242,6 +1242,59 @@ function warnIfNeonConnectionStringIsInsecure(connectionString) {
|
|
|
1242
1242
|
}
|
|
1243
1243
|
var storageInstance = null;
|
|
1244
1244
|
var storagePromise = null;
|
|
1245
|
+
var sessionMutationListeners = /* @__PURE__ */ new Set();
|
|
1246
|
+
function emitSessionMutation(event) {
|
|
1247
|
+
for (const listener of sessionMutationListeners) {
|
|
1248
|
+
try {
|
|
1249
|
+
const result = listener(event);
|
|
1250
|
+
if (result && typeof result.catch === "function") {
|
|
1251
|
+
void result.catch((error) => {
|
|
1252
|
+
console.error("[mcp-ts][Storage] Session mutation listener failed:", error);
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
} catch (error) {
|
|
1256
|
+
console.error("[mcp-ts][Storage] Session mutation listener failed:", error);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
function createSessionMutationEvent(prop, args) {
|
|
1261
|
+
const timestamp = Date.now();
|
|
1262
|
+
if (prop === "create") {
|
|
1263
|
+
const [session, ttl] = args;
|
|
1264
|
+
if (!session?.userId || !session?.sessionId) return null;
|
|
1265
|
+
return {
|
|
1266
|
+
type: "create",
|
|
1267
|
+
userId: session.userId,
|
|
1268
|
+
sessionId: session.sessionId,
|
|
1269
|
+
session,
|
|
1270
|
+
ttl,
|
|
1271
|
+
timestamp
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
if (prop === "update") {
|
|
1275
|
+
const [userId, sessionId, patch, ttl] = args;
|
|
1276
|
+
if (!userId || !sessionId) return null;
|
|
1277
|
+
return {
|
|
1278
|
+
type: "update",
|
|
1279
|
+
userId,
|
|
1280
|
+
sessionId,
|
|
1281
|
+
patch,
|
|
1282
|
+
ttl,
|
|
1283
|
+
timestamp
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
if (prop === "delete") {
|
|
1287
|
+
const [userId, sessionId] = args;
|
|
1288
|
+
if (!userId || !sessionId) return null;
|
|
1289
|
+
return {
|
|
1290
|
+
type: "delete",
|
|
1291
|
+
userId,
|
|
1292
|
+
sessionId,
|
|
1293
|
+
timestamp
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
return null;
|
|
1297
|
+
}
|
|
1245
1298
|
async function initializeStorage(store) {
|
|
1246
1299
|
if (typeof store.init === "function") {
|
|
1247
1300
|
await store.init();
|
|
@@ -1379,13 +1432,24 @@ async function getStorage() {
|
|
|
1379
1432
|
storageInstance = await storagePromise;
|
|
1380
1433
|
return storageInstance;
|
|
1381
1434
|
}
|
|
1435
|
+
function onSessionMutation(listener) {
|
|
1436
|
+
sessionMutationListeners.add(listener);
|
|
1437
|
+
return () => {
|
|
1438
|
+
sessionMutationListeners.delete(listener);
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1382
1441
|
var sessions = new Proxy({}, {
|
|
1383
1442
|
get(_target, prop) {
|
|
1384
1443
|
return async (...args) => {
|
|
1385
1444
|
const instance = await getStorage();
|
|
1386
1445
|
const value = instance[prop];
|
|
1387
1446
|
if (typeof value === "function") {
|
|
1388
|
-
|
|
1447
|
+
const result = await value.apply(instance, args);
|
|
1448
|
+
const event = createSessionMutationEvent(prop, args);
|
|
1449
|
+
if (event) {
|
|
1450
|
+
emitSessionMutation(event);
|
|
1451
|
+
}
|
|
1452
|
+
return result;
|
|
1389
1453
|
}
|
|
1390
1454
|
return value;
|
|
1391
1455
|
};
|
|
@@ -5029,6 +5093,7 @@ var ToolRouter = class {
|
|
|
5029
5093
|
__publicField(this, "index");
|
|
5030
5094
|
__publicField(this, "allTools", []);
|
|
5031
5095
|
__publicField(this, "pinnedTools", []);
|
|
5096
|
+
__publicField(this, "deferredTools", []);
|
|
5032
5097
|
__publicField(this, "discoverableTools", []);
|
|
5033
5098
|
__publicField(this, "groupsMap", /* @__PURE__ */ new Map());
|
|
5034
5099
|
__publicField(this, "strategy");
|
|
@@ -5037,6 +5102,7 @@ var ToolRouter = class {
|
|
|
5037
5102
|
__publicField(this, "activeGroups");
|
|
5038
5103
|
__publicField(this, "customGroups");
|
|
5039
5104
|
__publicField(this, "pinnedToolNames");
|
|
5105
|
+
__publicField(this, "deferredToolNames");
|
|
5040
5106
|
__publicField(this, "excludeToolMatchers");
|
|
5041
5107
|
__publicField(this, "initialized", false);
|
|
5042
5108
|
this.strategy = options.strategy ?? "all";
|
|
@@ -5045,6 +5111,7 @@ var ToolRouter = class {
|
|
|
5045
5111
|
this.activeGroups = new Set(options.activeGroups ?? []);
|
|
5046
5112
|
this.customGroups = options.groups;
|
|
5047
5113
|
this.pinnedToolNames = new Set(options.pinnedTools ?? []);
|
|
5114
|
+
this.deferredToolNames = new Set(options.deferredTools ?? []);
|
|
5048
5115
|
this.excludeToolMatchers = (options.excludeTools ?? []).map(
|
|
5049
5116
|
(pattern) => globToRegExp(pattern)
|
|
5050
5117
|
);
|
|
@@ -5073,8 +5140,9 @@ var ToolRouter = class {
|
|
|
5073
5140
|
return this.getGroupFilteredTools();
|
|
5074
5141
|
case "all":
|
|
5075
5142
|
default:
|
|
5143
|
+
const directlyVisibleTools = this.getDirectlyVisibleTools();
|
|
5076
5144
|
if (this.compactSchemas) {
|
|
5077
|
-
return
|
|
5145
|
+
return directlyVisibleTools.map((t) => {
|
|
5078
5146
|
const compact = SchemaCompressor.toCompact(t);
|
|
5079
5147
|
return {
|
|
5080
5148
|
name: compact.name,
|
|
@@ -5083,7 +5151,7 @@ var ToolRouter = class {
|
|
|
5083
5151
|
};
|
|
5084
5152
|
});
|
|
5085
5153
|
}
|
|
5086
|
-
return [...
|
|
5154
|
+
return [...directlyVisibleTools];
|
|
5087
5155
|
}
|
|
5088
5156
|
}
|
|
5089
5157
|
/**
|
|
@@ -5198,6 +5266,9 @@ var ToolRouter = class {
|
|
|
5198
5266
|
const fetchedTools = await this.fetchAllTools();
|
|
5199
5267
|
this.allTools = fetchedTools.filter((tool) => !this.matchesExcludedTool(tool.name));
|
|
5200
5268
|
this.pinnedTools = this.allTools.filter((tool) => this.matchesPinnedTool(tool.name));
|
|
5269
|
+
this.deferredTools = this.allTools.filter(
|
|
5270
|
+
(tool) => !this.matchesPinnedTool(tool.name) && this.matchesDeferredTool(tool)
|
|
5271
|
+
);
|
|
5201
5272
|
this.discoverableTools = this.allTools.filter((tool) => !this.matchesPinnedTool(tool.name));
|
|
5202
5273
|
await this.index.buildIndex(this.discoverableTools);
|
|
5203
5274
|
this.buildGroups();
|
|
@@ -5275,7 +5346,7 @@ var ToolRouter = class {
|
|
|
5275
5346
|
}
|
|
5276
5347
|
}
|
|
5277
5348
|
}
|
|
5278
|
-
const filtered = this.
|
|
5349
|
+
const filtered = this.getDirectlyVisibleTools().filter((t) => activeToolNames.has(t.name));
|
|
5279
5350
|
if (this.compactSchemas) {
|
|
5280
5351
|
return filtered.slice(0, this.maxTools).map((t) => {
|
|
5281
5352
|
const compact = SchemaCompressor.toCompact(t);
|
|
@@ -5301,9 +5372,19 @@ var ToolRouter = class {
|
|
|
5301
5372
|
matchesPinnedTool(toolName) {
|
|
5302
5373
|
return this.pinnedToolNames.has(toolName);
|
|
5303
5374
|
}
|
|
5375
|
+
matchesDeferredTool(tool) {
|
|
5376
|
+
if (this.deferredToolNames.has(tool.name)) {
|
|
5377
|
+
return true;
|
|
5378
|
+
}
|
|
5379
|
+
const meta = tool._meta;
|
|
5380
|
+
return meta?.toolRouter?.deferred === true;
|
|
5381
|
+
}
|
|
5304
5382
|
matchesExcludedTool(toolName) {
|
|
5305
5383
|
return this.excludeToolMatchers.some((matcher) => matcher.test(toolName));
|
|
5306
5384
|
}
|
|
5385
|
+
getDirectlyVisibleTools() {
|
|
5386
|
+
return this.allTools.filter((tool) => !this.matchesDeferredTool(tool) || this.matchesPinnedTool(tool.name));
|
|
5387
|
+
}
|
|
5307
5388
|
};
|
|
5308
5389
|
function globToRegExp(pattern) {
|
|
5309
5390
|
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -5366,6 +5447,7 @@ exports.isConnectError = isConnectError;
|
|
|
5366
5447
|
exports.isConnectSuccess = isConnectSuccess;
|
|
5367
5448
|
exports.isListToolsSuccess = isListToolsSuccess;
|
|
5368
5449
|
exports.isMetaTool = isMetaTool;
|
|
5450
|
+
exports.onSessionMutation = onSessionMutation;
|
|
5369
5451
|
exports.resolveMetaToolProxy = resolveMetaToolProxy;
|
|
5370
5452
|
exports.sanitizeServerLabel = sanitizeServerLabel;
|
|
5371
5453
|
exports.sessions = sessions;
|