@mcp-ts/sdk 2.3.1 → 2.3.3

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.
@@ -2,8 +2,8 @@ export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, M as M
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
3
  import { v as ToolInfo } from '../types-CxFaaZrM.mjs';
4
4
  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, w as TransportType, x as isCallToolSuccess, y as isConnectAuthRequired, z as isConnectError, A as isConnectSuccess, B as isListToolsSuccess } from '../types-CxFaaZrM.mjs';
5
- import { d as ToolRouter } from '../tool-router-BfE_9tay.mjs';
6
- 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, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSearchOptions, i as ToolServerSummary, j as ToolSummary } from '../tool-router-BfE_9tay.mjs';
5
+ import { d as ToolRouter } from '../tool-router-BhHsvBfP.mjs';
6
+ 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, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSearchOptions, i as ToolServerSummary, j as ToolSummary } from '../tool-router-BhHsvBfP.mjs';
7
7
  import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
8
8
 
9
9
  /**
@@ -2,8 +2,8 @@ export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, M as M
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
3
  import { v as ToolInfo } from '../types-CxFaaZrM.js';
4
4
  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, w as TransportType, x as isCallToolSuccess, y as isConnectAuthRequired, z as isConnectError, A as isConnectSuccess, B as isListToolsSuccess } from '../types-CxFaaZrM.js';
5
- import { d as ToolRouter } from '../tool-router-CP7qLk1J.js';
6
- 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, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSearchOptions, i as ToolServerSummary, j as ToolSummary } from '../tool-router-CP7qLk1J.js';
5
+ import { d as ToolRouter } from '../tool-router-BMzhoNYt.js';
6
+ 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, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSearchOptions, i as ToolServerSummary, j as ToolSummary } from '../tool-router-BMzhoNYt.js';
7
7
  import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
8
8
 
9
9
  /**
@@ -1143,7 +1143,7 @@ var ToolRouter = class {
1143
1143
  * If tool name is ambiguous, use namespace to specify the server.
1144
1144
  */
1145
1145
  getToolSchema(toolName, namespace, options = {}) {
1146
- const matches = this.index.getTool(toolName, namespace, options);
1146
+ const matches = this.getIndexedToolMatches(toolName, namespace, options);
1147
1147
  if (matches.length === 0) return void 0;
1148
1148
  if (matches.length > 1) {
1149
1149
  const servers = matches.map((m) => m.serverId).join(", ");
@@ -1350,6 +1350,23 @@ var ToolRouter = class {
1350
1350
  getDirectlyVisibleTools() {
1351
1351
  return this.allTools.filter((tool) => !this.matchesDeferredTool(tool) || this.matchesPinnedTool(tool.name));
1352
1352
  }
1353
+ getIndexedToolMatches(toolName, namespace, options = {}) {
1354
+ const indexedMatches = this.index.getTool(toolName, namespace, options);
1355
+ if (indexedMatches.length > 0 || !this.matchesPinnedTool(toolName)) {
1356
+ return indexedMatches;
1357
+ }
1358
+ return this.matchTools(this.pinnedTools.filter((tool) => tool.name === toolName), namespace, options);
1359
+ }
1360
+ matchTools(tools, namespace, options = {}) {
1361
+ if (!namespace) return tools;
1362
+ const exactMatches = tools.filter(
1363
+ (tool) => tool.sessionId === namespace || tool.serverId === namespace
1364
+ );
1365
+ if (exactMatches.length > 0) return exactMatches;
1366
+ if (!options.allowServerNameFragment) return [];
1367
+ const namespaceLower = namespace.toLowerCase();
1368
+ return tools.filter((tool) => tool.serverName.toLowerCase().includes(namespaceLower));
1369
+ }
1353
1370
  };
1354
1371
  function globToRegExp(pattern) {
1355
1372
  const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");