@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
package/dist/index.mjs
CHANGED
|
@@ -5090,7 +5090,7 @@ var ToolRouter = class {
|
|
|
5090
5090
|
* If tool name is ambiguous, use namespace to specify the server.
|
|
5091
5091
|
*/
|
|
5092
5092
|
getToolSchema(toolName, namespace, options = {}) {
|
|
5093
|
-
const matches = this.
|
|
5093
|
+
const matches = this.getIndexedToolMatches(toolName, namespace, options);
|
|
5094
5094
|
if (matches.length === 0) return void 0;
|
|
5095
5095
|
if (matches.length > 1) {
|
|
5096
5096
|
const servers = matches.map((m) => m.serverId).join(", ");
|
|
@@ -5297,6 +5297,23 @@ var ToolRouter = class {
|
|
|
5297
5297
|
getDirectlyVisibleTools() {
|
|
5298
5298
|
return this.allTools.filter((tool) => !this.matchesDeferredTool(tool) || this.matchesPinnedTool(tool.name));
|
|
5299
5299
|
}
|
|
5300
|
+
getIndexedToolMatches(toolName, namespace, options = {}) {
|
|
5301
|
+
const indexedMatches = this.index.getTool(toolName, namespace, options);
|
|
5302
|
+
if (indexedMatches.length > 0 || !this.matchesPinnedTool(toolName)) {
|
|
5303
|
+
return indexedMatches;
|
|
5304
|
+
}
|
|
5305
|
+
return this.matchTools(this.pinnedTools.filter((tool) => tool.name === toolName), namespace, options);
|
|
5306
|
+
}
|
|
5307
|
+
matchTools(tools, namespace, options = {}) {
|
|
5308
|
+
if (!namespace) return tools;
|
|
5309
|
+
const exactMatches = tools.filter(
|
|
5310
|
+
(tool) => tool.sessionId === namespace || tool.serverId === namespace
|
|
5311
|
+
);
|
|
5312
|
+
if (exactMatches.length > 0) return exactMatches;
|
|
5313
|
+
if (!options.allowServerNameFragment) return [];
|
|
5314
|
+
const namespaceLower = namespace.toLowerCase();
|
|
5315
|
+
return tools.filter((tool) => tool.serverName.toLowerCase().includes(namespaceLower));
|
|
5316
|
+
}
|
|
5300
5317
|
};
|
|
5301
5318
|
function globToRegExp(pattern) {
|
|
5302
5319
|
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|