@mcp-ts/sdk 2.2.0 → 2.3.1
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-adapter.js +9 -5
- package/dist/adapters/agui-adapter.js.map +1 -1
- package/dist/adapters/agui-adapter.mjs +9 -5
- package/dist/adapters/agui-adapter.mjs.map +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/ai-adapter.js +9 -5
- package/dist/adapters/ai-adapter.js.map +1 -1
- package/dist/adapters/ai-adapter.mjs +9 -5
- package/dist/adapters/ai-adapter.mjs.map +1 -1
- package/dist/adapters/langchain-adapter.d.mts +1 -1
- package/dist/adapters/langchain-adapter.d.ts +1 -1
- package/dist/adapters/langchain-adapter.js +9 -5
- package/dist/adapters/langchain-adapter.js.map +1 -1
- package/dist/adapters/langchain-adapter.mjs +9 -5
- package/dist/adapters/langchain-adapter.mjs.map +1 -1
- package/dist/client/react.js.map +1 -1
- package/dist/client/react.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +83 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -7
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +13 -1
- package/dist/server/index.d.ts +13 -1
- package/dist/server/index.js +66 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +66 -2
- package/dist/server/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 +17 -5
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +17 -5
- package/dist/shared/index.mjs.map +1 -1
- package/dist/{tool-router-C8hIA-tg.d.mts → tool-router-BfE_9tay.d.mts} +5 -0
- package/dist/{tool-router-CdX8e9bk.d.ts → tool-router-CP7qLk1J.d.ts} +5 -0
- package/package.json +1 -1
- package/src/server/index.ts +8 -1
- package/src/server/storage/index.ts +77 -2
- package/src/server/storage/types.ts +14 -0
- package/src/shared/meta-tools.ts +16 -7
- package/src/shared/tool-router.ts +13 -0
package/dist/shared/index.d.mts
CHANGED
|
@@ -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-
|
|
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-
|
|
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';
|
|
7
7
|
import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
|
|
9
9
|
/**
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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';
|
|
7
7
|
import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
|
|
9
9
|
/**
|
package/dist/shared/index.js
CHANGED
|
@@ -807,8 +807,13 @@ function createExecuteToolDefinition() {
|
|
|
807
807
|
};
|
|
808
808
|
}
|
|
809
809
|
async function executeMetaTool(toolName, args, router, callToolFn) {
|
|
810
|
-
const resolveToolSchema = (name, namespace, options) => {
|
|
810
|
+
const resolveToolSchema = async (name, namespace, options) => {
|
|
811
811
|
try {
|
|
812
|
+
if (typeof router.resolveToolSchema === "function") {
|
|
813
|
+
return {
|
|
814
|
+
tool: await router.resolveToolSchema(name, namespace, options)
|
|
815
|
+
};
|
|
816
|
+
}
|
|
812
817
|
return { tool: router.getToolSchema(name, namespace, options) };
|
|
813
818
|
} catch (err) {
|
|
814
819
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
@@ -860,13 +865,12 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
|
|
|
860
865
|
const searchOptions = { serverId, serverName };
|
|
861
866
|
const selectMatch = query.match(/^select:(.+)$/i);
|
|
862
867
|
if (selectMatch) {
|
|
863
|
-
await router.listTools({ serverId, serverName, limit: 1 });
|
|
864
868
|
const requested = selectMatch[1].split(",").map((s) => s.trim()).filter(Boolean);
|
|
865
869
|
const found = [];
|
|
866
870
|
const errors = [];
|
|
867
871
|
const namespace = serverId ?? serverName;
|
|
868
872
|
for (const requestedToolName of requested) {
|
|
869
|
-
const { tool, error } = resolveToolSchema(requestedToolName, namespace, {
|
|
873
|
+
const { tool, error } = await resolveToolSchema(requestedToolName, namespace, {
|
|
870
874
|
allowServerNameFragment: Boolean(serverName && !serverId)
|
|
871
875
|
});
|
|
872
876
|
if (error) {
|
|
@@ -930,7 +934,7 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
|
|
|
930
934
|
case "mcp_get_tool_schema": {
|
|
931
935
|
const name = String(args.toolName ?? "");
|
|
932
936
|
const namespace = String(args.serverId ?? "") || void 0;
|
|
933
|
-
const { tool, error } = resolveToolSchema(name, namespace);
|
|
937
|
+
const { tool, error } = await resolveToolSchema(name, namespace);
|
|
934
938
|
if (error) {
|
|
935
939
|
return error;
|
|
936
940
|
}
|
|
@@ -972,7 +976,7 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
|
|
|
972
976
|
isError: true
|
|
973
977
|
};
|
|
974
978
|
}
|
|
975
|
-
const { tool, error } = resolveToolSchema(targetToolName, namespace);
|
|
979
|
+
const { tool, error } = await resolveToolSchema(targetToolName, namespace);
|
|
976
980
|
if (error) {
|
|
977
981
|
return error;
|
|
978
982
|
}
|
|
@@ -1149,6 +1153,14 @@ var ToolRouter = class {
|
|
|
1149
1153
|
}
|
|
1150
1154
|
return matches[0];
|
|
1151
1155
|
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Resolve the full tool definition by name, ensuring the router index has
|
|
1158
|
+
* been initialized first.
|
|
1159
|
+
*/
|
|
1160
|
+
async resolveToolSchema(toolName, namespace, options = {}) {
|
|
1161
|
+
await this.ensureInitialized();
|
|
1162
|
+
return this.getToolSchema(toolName, namespace, options);
|
|
1163
|
+
}
|
|
1152
1164
|
/**
|
|
1153
1165
|
* Get compact (schema-less) summaries for all tools.
|
|
1154
1166
|
*/
|