@mcp-ts/sdk 2.0.0 → 2.1.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 +2 -2
- package/dist/adapters/agui-adapter.d.ts +2 -2
- package/dist/adapters/agui-adapter.js +1 -0
- package/dist/adapters/agui-adapter.js.map +1 -1
- package/dist/adapters/agui-adapter.mjs +1 -0
- package/dist/adapters/agui-adapter.mjs.map +1 -1
- package/dist/adapters/agui-middleware.d.mts +2 -2
- package/dist/adapters/agui-middleware.d.ts +2 -2
- package/dist/adapters/ai-adapter.d.mts +2 -2
- package/dist/adapters/ai-adapter.d.ts +2 -2
- package/dist/adapters/ai-adapter.js +1 -0
- package/dist/adapters/ai-adapter.js.map +1 -1
- package/dist/adapters/ai-adapter.mjs +1 -0
- package/dist/adapters/ai-adapter.mjs.map +1 -1
- package/dist/adapters/langchain-adapter.d.mts +2 -2
- package/dist/adapters/langchain-adapter.d.ts +2 -2
- package/dist/adapters/langchain-adapter.js +1 -0
- package/dist/adapters/langchain-adapter.js.map +1 -1
- package/dist/adapters/langchain-adapter.mjs +1 -0
- package/dist/adapters/langchain-adapter.mjs.map +1 -1
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/react.d.mts +4 -4
- package/dist/client/react.d.ts +4 -4
- package/dist/client/react.js.map +1 -1
- package/dist/client/react.mjs.map +1 -1
- package/dist/client/vue.d.mts +4 -4
- package/dist/client/vue.d.ts +4 -4
- package/dist/{index-eaH14_5u.d.mts → index-Cfjsme-a.d.mts} +1 -1
- package/dist/{index-C9gvpxy5.d.ts → index-CmjMd2ac.d.ts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -4
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/shared/index.d.mts +6 -6
- package/dist/shared/index.d.ts +6 -6
- package/dist/shared/index.js +27 -4
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +27 -4
- package/dist/shared/index.mjs.map +1 -1
- package/dist/{tool-router-Ddtybmr0.d.ts → tool-router-BP8TT9mI.d.ts} +17 -1
- package/dist/{tool-router-Dnd6IOKC.d.mts → tool-router-BkQnso27.d.mts} +17 -1
- package/dist/{types-BCAG20P6.d.mts → types-CxFaaZrM.d.mts} +2 -1
- package/dist/{types-BCAG20P6.d.ts → types-CxFaaZrM.d.ts} +2 -1
- package/package.json +1 -1
- package/src/shared/meta-tools.ts +5 -4
- package/src/shared/tool-index.ts +1 -0
- package/src/shared/tool-router.ts +38 -3
- package/src/shared/types.ts +2 -1
package/dist/index.mjs
CHANGED
|
@@ -4647,7 +4647,7 @@ function createRegexSearchToolDefinition() {
|
|
|
4647
4647
|
function createGetSchemaToolDefinition() {
|
|
4648
4648
|
return {
|
|
4649
4649
|
name: "mcp_get_tool_schema",
|
|
4650
|
-
description: "Get the full input schema (parameters) for a specific tool. Call this after mcp_search_tools to get the parameter details needed to call a tool correctly. Do NOT call the discovered tool directly; after reading the schema, call mcp_execute_tool.",
|
|
4650
|
+
description: "Get the full input schema (parameters) and output schema (result shape) for a specific tool. Call this after mcp_search_tools to get the parameter details needed to call a tool correctly and understand what it returns. Do NOT call the discovered tool directly; after reading the schema, call mcp_execute_tool.",
|
|
4651
4651
|
inputSchema: {
|
|
4652
4652
|
type: "object",
|
|
4653
4653
|
properties: {
|
|
@@ -4832,6 +4832,7 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
|
|
|
4832
4832
|
name: tool.name,
|
|
4833
4833
|
description: tool.description,
|
|
4834
4834
|
inputSchema: tool.inputSchema,
|
|
4835
|
+
outputSchema: tool.outputSchema,
|
|
4835
4836
|
executionInstructions: {
|
|
4836
4837
|
nextTool: "mcp_execute_tool",
|
|
4837
4838
|
toolName: tool.name,
|
|
@@ -4927,18 +4928,26 @@ var ToolRouter = class {
|
|
|
4927
4928
|
this.options = options;
|
|
4928
4929
|
__publicField(this, "index");
|
|
4929
4930
|
__publicField(this, "allTools", []);
|
|
4931
|
+
__publicField(this, "pinnedTools", []);
|
|
4932
|
+
__publicField(this, "discoverableTools", []);
|
|
4930
4933
|
__publicField(this, "groupsMap", /* @__PURE__ */ new Map());
|
|
4931
4934
|
__publicField(this, "strategy");
|
|
4932
4935
|
__publicField(this, "maxTools");
|
|
4933
4936
|
__publicField(this, "compactSchemas");
|
|
4934
4937
|
__publicField(this, "activeGroups");
|
|
4935
4938
|
__publicField(this, "customGroups");
|
|
4939
|
+
__publicField(this, "pinnedToolNames");
|
|
4940
|
+
__publicField(this, "excludeToolMatchers");
|
|
4936
4941
|
__publicField(this, "initialized", false);
|
|
4937
4942
|
this.strategy = options.strategy ?? "all";
|
|
4938
4943
|
this.maxTools = options.maxTools ?? 40;
|
|
4939
4944
|
this.compactSchemas = options.compactSchemas ?? false;
|
|
4940
4945
|
this.activeGroups = new Set(options.activeGroups ?? []);
|
|
4941
4946
|
this.customGroups = options.groups;
|
|
4947
|
+
this.pinnedToolNames = new Set(options.pinnedTools ?? []);
|
|
4948
|
+
this.excludeToolMatchers = (options.excludeTools ?? []).map(
|
|
4949
|
+
(pattern) => globToRegExp(pattern)
|
|
4950
|
+
);
|
|
4942
4951
|
this.index = new ToolIndex({
|
|
4943
4952
|
embedFn: options.embedFn,
|
|
4944
4953
|
keywordWeight: options.keywordWeight
|
|
@@ -4959,7 +4968,7 @@ var ToolRouter = class {
|
|
|
4959
4968
|
await this.ensureInitialized();
|
|
4960
4969
|
switch (this.strategy) {
|
|
4961
4970
|
case "search":
|
|
4962
|
-
return this.getMetaToolDefinitions();
|
|
4971
|
+
return [...this.getMetaToolDefinitions(), ...this.pinnedTools];
|
|
4963
4972
|
case "groups":
|
|
4964
4973
|
return this.getGroupFilteredTools();
|
|
4965
4974
|
case "all":
|
|
@@ -5086,8 +5095,11 @@ var ToolRouter = class {
|
|
|
5086
5095
|
/** Lazy initialization — fetches tools from all connected clients. */
|
|
5087
5096
|
async ensureInitialized() {
|
|
5088
5097
|
if (this.initialized) return;
|
|
5089
|
-
|
|
5090
|
-
|
|
5098
|
+
const fetchedTools = await this.fetchAllTools();
|
|
5099
|
+
this.allTools = fetchedTools.filter((tool) => !this.matchesExcludedTool(tool.name));
|
|
5100
|
+
this.pinnedTools = this.allTools.filter((tool) => this.matchesPinnedTool(tool.name));
|
|
5101
|
+
this.discoverableTools = this.allTools.filter((tool) => !this.matchesPinnedTool(tool.name));
|
|
5102
|
+
await this.index.buildIndex(this.discoverableTools);
|
|
5091
5103
|
this.buildGroups();
|
|
5092
5104
|
this.initialized = true;
|
|
5093
5105
|
}
|
|
@@ -5186,7 +5198,18 @@ var ToolRouter = class {
|
|
|
5186
5198
|
createExecuteToolDefinition()
|
|
5187
5199
|
];
|
|
5188
5200
|
}
|
|
5201
|
+
matchesPinnedTool(toolName) {
|
|
5202
|
+
return this.pinnedToolNames.has(toolName);
|
|
5203
|
+
}
|
|
5204
|
+
matchesExcludedTool(toolName) {
|
|
5205
|
+
return this.excludeToolMatchers.some((matcher) => matcher.test(toolName));
|
|
5206
|
+
}
|
|
5189
5207
|
};
|
|
5208
|
+
function globToRegExp(pattern) {
|
|
5209
|
+
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
5210
|
+
const regexPattern = `^${escaped.replace(/\*/g, ".*")}$`;
|
|
5211
|
+
return new RegExp(regexPattern);
|
|
5212
|
+
}
|
|
5190
5213
|
|
|
5191
5214
|
export { APP_HOST_DEFAULTS, AppHost, AuthenticationError, ConfigurationError, ConnectionError, DEFAULT_CLIENT_NAME, DEFAULT_CLIENT_URI, DEFAULT_HEARTBEAT_INTERVAL_MS, DEFAULT_LOGO_URI, DEFAULT_MCP_APP_CSP, DEFAULT_POLICY_URI, DisposableStore, Emitter, InvalidStateError, MCPClient, MCP_CLIENT_NAME, MCP_CLIENT_VERSION, McpError, MultiSessionClient, NotConnectedError, REDIS_KEY_PREFIX, RpcErrorCodes, SANDBOX_PROXY_READY_METHOD, SANDBOX_RESOURCE_READY_METHOD, SESSION_TTL_SECONDS, SOFTWARE_ID, SOFTWARE_VERSION, SSEClient, SSEConnectionManager, STATE_EXPIRATION_MS, SchemaCompressor, SessionNotFoundError, SessionValidationError, StorageOAuthClientProvider, TOKEN_EXPIRY_BUFFER_MS, ToolExecutionError, ToolIndex, ToolRouter, UnauthorizedError, createExecuteToolDefinition, createGetSchemaToolDefinition, createListServersToolDefinition, createNextMcpHandler, createRegexSearchToolDefinition, createSSEHandler, createSearchToolDefinition, executeMetaTool, findToolByName, getToolUiResourceUri, isCallToolSuccess, isConnectAuthRequired, isConnectError, isConnectSuccess, isListToolsSuccess, isMetaTool, resolveMetaToolProxy, sanitizeServerLabel, sessions };
|
|
5192
5215
|
//# sourceMappingURL=index.mjs.map
|