@mcp-ts/sdk 2.1.0 → 2.2.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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -3
- package/dist/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/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
|
@@ -7,6 +7,6 @@ export { OAuthClientInformation, OAuthClientInformationFull, OAuthClientMetadata
|
|
|
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
|
@@ -7,6 +7,6 @@ export { OAuthClientInformation, OAuthClientInformationFull, OAuthClientMetadata
|
|
|
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
|
@@ -5029,6 +5029,7 @@ var ToolRouter = class {
|
|
|
5029
5029
|
__publicField(this, "index");
|
|
5030
5030
|
__publicField(this, "allTools", []);
|
|
5031
5031
|
__publicField(this, "pinnedTools", []);
|
|
5032
|
+
__publicField(this, "deferredTools", []);
|
|
5032
5033
|
__publicField(this, "discoverableTools", []);
|
|
5033
5034
|
__publicField(this, "groupsMap", /* @__PURE__ */ new Map());
|
|
5034
5035
|
__publicField(this, "strategy");
|
|
@@ -5037,6 +5038,7 @@ var ToolRouter = class {
|
|
|
5037
5038
|
__publicField(this, "activeGroups");
|
|
5038
5039
|
__publicField(this, "customGroups");
|
|
5039
5040
|
__publicField(this, "pinnedToolNames");
|
|
5041
|
+
__publicField(this, "deferredToolNames");
|
|
5040
5042
|
__publicField(this, "excludeToolMatchers");
|
|
5041
5043
|
__publicField(this, "initialized", false);
|
|
5042
5044
|
this.strategy = options.strategy ?? "all";
|
|
@@ -5045,6 +5047,7 @@ var ToolRouter = class {
|
|
|
5045
5047
|
this.activeGroups = new Set(options.activeGroups ?? []);
|
|
5046
5048
|
this.customGroups = options.groups;
|
|
5047
5049
|
this.pinnedToolNames = new Set(options.pinnedTools ?? []);
|
|
5050
|
+
this.deferredToolNames = new Set(options.deferredTools ?? []);
|
|
5048
5051
|
this.excludeToolMatchers = (options.excludeTools ?? []).map(
|
|
5049
5052
|
(pattern) => globToRegExp(pattern)
|
|
5050
5053
|
);
|
|
@@ -5073,8 +5076,9 @@ var ToolRouter = class {
|
|
|
5073
5076
|
return this.getGroupFilteredTools();
|
|
5074
5077
|
case "all":
|
|
5075
5078
|
default:
|
|
5079
|
+
const directlyVisibleTools = this.getDirectlyVisibleTools();
|
|
5076
5080
|
if (this.compactSchemas) {
|
|
5077
|
-
return
|
|
5081
|
+
return directlyVisibleTools.map((t) => {
|
|
5078
5082
|
const compact = SchemaCompressor.toCompact(t);
|
|
5079
5083
|
return {
|
|
5080
5084
|
name: compact.name,
|
|
@@ -5083,7 +5087,7 @@ var ToolRouter = class {
|
|
|
5083
5087
|
};
|
|
5084
5088
|
});
|
|
5085
5089
|
}
|
|
5086
|
-
return [...
|
|
5090
|
+
return [...directlyVisibleTools];
|
|
5087
5091
|
}
|
|
5088
5092
|
}
|
|
5089
5093
|
/**
|
|
@@ -5198,6 +5202,9 @@ var ToolRouter = class {
|
|
|
5198
5202
|
const fetchedTools = await this.fetchAllTools();
|
|
5199
5203
|
this.allTools = fetchedTools.filter((tool) => !this.matchesExcludedTool(tool.name));
|
|
5200
5204
|
this.pinnedTools = this.allTools.filter((tool) => this.matchesPinnedTool(tool.name));
|
|
5205
|
+
this.deferredTools = this.allTools.filter(
|
|
5206
|
+
(tool) => !this.matchesPinnedTool(tool.name) && this.matchesDeferredTool(tool)
|
|
5207
|
+
);
|
|
5201
5208
|
this.discoverableTools = this.allTools.filter((tool) => !this.matchesPinnedTool(tool.name));
|
|
5202
5209
|
await this.index.buildIndex(this.discoverableTools);
|
|
5203
5210
|
this.buildGroups();
|
|
@@ -5275,7 +5282,7 @@ var ToolRouter = class {
|
|
|
5275
5282
|
}
|
|
5276
5283
|
}
|
|
5277
5284
|
}
|
|
5278
|
-
const filtered = this.
|
|
5285
|
+
const filtered = this.getDirectlyVisibleTools().filter((t) => activeToolNames.has(t.name));
|
|
5279
5286
|
if (this.compactSchemas) {
|
|
5280
5287
|
return filtered.slice(0, this.maxTools).map((t) => {
|
|
5281
5288
|
const compact = SchemaCompressor.toCompact(t);
|
|
@@ -5301,9 +5308,19 @@ var ToolRouter = class {
|
|
|
5301
5308
|
matchesPinnedTool(toolName) {
|
|
5302
5309
|
return this.pinnedToolNames.has(toolName);
|
|
5303
5310
|
}
|
|
5311
|
+
matchesDeferredTool(tool) {
|
|
5312
|
+
if (this.deferredToolNames.has(tool.name)) {
|
|
5313
|
+
return true;
|
|
5314
|
+
}
|
|
5315
|
+
const meta = tool._meta;
|
|
5316
|
+
return meta?.toolRouter?.deferred === true;
|
|
5317
|
+
}
|
|
5304
5318
|
matchesExcludedTool(toolName) {
|
|
5305
5319
|
return this.excludeToolMatchers.some((matcher) => matcher.test(toolName));
|
|
5306
5320
|
}
|
|
5321
|
+
getDirectlyVisibleTools() {
|
|
5322
|
+
return this.allTools.filter((tool) => !this.matchesDeferredTool(tool) || this.matchesPinnedTool(tool.name));
|
|
5323
|
+
}
|
|
5307
5324
|
};
|
|
5308
5325
|
function globToRegExp(pattern) {
|
|
5309
5326
|
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|