@mcp-ts/sdk 2.3.1 → 2.3.2
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 +18 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -1
- 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 +18 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +18 -1
- package/dist/shared/index.mjs.map +1 -1
- package/dist/{tool-router-CP7qLk1J.d.ts → tool-router-BMzhoNYt.d.ts} +2 -0
- package/dist/{tool-router-BfE_9tay.d.mts → tool-router-BhHsvBfP.d.mts} +2 -0
- package/package.json +1 -1
- package/src/shared/tool-router.ts +32 -1
|
@@ -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-BhHsvBfP.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-BMzhoNYt.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-BhHsvBfP.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-BMzhoNYt.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-BhHsvBfP.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-BMzhoNYt.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-BhHsvBfP.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-BMzhoNYt.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-BhHsvBfP.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-BMzhoNYt.js';
|
|
11
11
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
12
12
|
import '@modelcontextprotocol/ext-apps/app-bridge';
|
package/dist/index.js
CHANGED
|
@@ -5190,7 +5190,7 @@ var ToolRouter = class {
|
|
|
5190
5190
|
* If tool name is ambiguous, use namespace to specify the server.
|
|
5191
5191
|
*/
|
|
5192
5192
|
getToolSchema(toolName, namespace, options = {}) {
|
|
5193
|
-
const matches = this.
|
|
5193
|
+
const matches = this.getIndexedToolMatches(toolName, namespace, options);
|
|
5194
5194
|
if (matches.length === 0) return void 0;
|
|
5195
5195
|
if (matches.length > 1) {
|
|
5196
5196
|
const servers = matches.map((m) => m.serverId).join(", ");
|
|
@@ -5397,6 +5397,23 @@ var ToolRouter = class {
|
|
|
5397
5397
|
getDirectlyVisibleTools() {
|
|
5398
5398
|
return this.allTools.filter((tool) => !this.matchesDeferredTool(tool) || this.matchesPinnedTool(tool.name));
|
|
5399
5399
|
}
|
|
5400
|
+
getIndexedToolMatches(toolName, namespace, options = {}) {
|
|
5401
|
+
const indexedMatches = this.index.getTool(toolName, namespace, options);
|
|
5402
|
+
if (indexedMatches.length > 0 || !this.matchesPinnedTool(toolName)) {
|
|
5403
|
+
return indexedMatches;
|
|
5404
|
+
}
|
|
5405
|
+
return this.matchTools(this.pinnedTools.filter((tool) => tool.name === toolName), namespace, options);
|
|
5406
|
+
}
|
|
5407
|
+
matchTools(tools, namespace, options = {}) {
|
|
5408
|
+
if (!namespace) return tools;
|
|
5409
|
+
const exactMatches = tools.filter(
|
|
5410
|
+
(tool) => tool.sessionId === namespace || tool.serverId === namespace
|
|
5411
|
+
);
|
|
5412
|
+
if (exactMatches.length > 0) return exactMatches;
|
|
5413
|
+
if (!options.allowServerNameFragment) return [];
|
|
5414
|
+
const namespaceLower = namespace.toLowerCase();
|
|
5415
|
+
return tools.filter((tool) => tool.serverName.toLowerCase().includes(namespaceLower));
|
|
5416
|
+
}
|
|
5400
5417
|
};
|
|
5401
5418
|
function globToRegExp(pattern) {
|
|
5402
5419
|
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|