@mcpjam/sdk 0.8.0 → 0.8.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/index.d.mts CHANGED
@@ -2,11 +2,9 @@ import { ClientOptions, Client } from '@modelcontextprotocol/sdk/client/index.js
2
2
  import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
3
3
  import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
4
4
  import { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
5
- import { ElicitResult, ElicitRequest, Tool as Tool$1, CallToolResult, ListToolsResult as ListToolsResult$1, ServerCapabilities, LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
6
- export { ElicitResult, PromptListChangedNotificationSchema, ResourceListChangedNotificationSchema, ResourceUpdatedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
7
- import { ToolSet, ToolCallOptions, dynamicTool, Tool as Tool$2, CoreMessage, CoreUserMessage, CoreAssistantMessage, CoreToolMessage, GenerateTextResult } from 'ai';
8
- export { CoreAssistantMessage, CoreMessage, CoreToolMessage, CoreUserMessage } from 'ai';
9
- import { JSONSchema7 } from 'json-schema';
5
+ import { ElicitResult, ElicitRequest, Tool as Tool$1, CallToolResult, ServerCapabilities, LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
6
+ export { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
7
+ import { ToolSet, dynamicTool, AssistantModelMessage, ModelMessage, ToolModelMessage, UserModelMessage } from 'ai';
10
8
  import { createOpenAI } from '@ai-sdk/openai';
11
9
 
12
10
  /**
@@ -252,22 +250,6 @@ type NotificationHandler = Parameters<Client["setNotificationHandler"]>[1];
252
250
  * Tool conversion utilities for integrating MCP tools with Vercel AI SDK
253
251
  */
254
252
 
255
- /**
256
- * Normalizes a schema to a valid JSON Schema object.
257
- * Many MCP tools omit the top-level type; Anthropic requires an object schema.
258
- *
259
- * @param schema - The input schema (may be incomplete)
260
- * @returns A normalized JSONSchema7 object
261
- */
262
- declare function ensureJsonSchemaObject(schema: unknown): JSONSchema7;
263
- /**
264
- * Function type for executing tool calls
265
- */
266
- type CallToolExecutor = (params: {
267
- name: string;
268
- args: unknown;
269
- options: ToolCallOptions;
270
- }) => Promise<CallToolResult>;
271
253
  /**
272
254
  * Input schema type for tool definitions
273
255
  */
@@ -280,46 +262,33 @@ type ToolSchemaOverrides = Record<string, {
280
262
  inputSchema: ToolInputSchema;
281
263
  }>;
282
264
  /**
283
- * Result type for converted tools
284
- * When explicit schemas are provided, returns typed object
285
- * When "automatic", returns generic record
265
+ * Checks whether a tool is an MCP App by inspecting its _meta for a UI resource URI.
266
+ *
267
+ * @param toolMeta - The tool's _meta field from listTools result
268
+ * @returns true if the tool is an MCP App
286
269
  */
287
- type ConvertedToolSet<SCHEMAS extends ToolSchemaOverrides | "automatic"> = SCHEMAS extends ToolSchemaOverrides ? {
288
- [K in keyof SCHEMAS]: Tool$2;
289
- } : Record<string, Tool$2>;
270
+ declare function isMcpAppTool(toolMeta: Record<string, unknown> | undefined): boolean;
290
271
  /**
291
- * Options for tool conversion
272
+ * Checks whether a tool is a ChatGPT App by inspecting its _meta for an output template.
273
+ *
274
+ * @param toolMeta - The tool's _meta field from listTools result
275
+ * @returns true if the tool is a ChatGPT App
292
276
  */
293
- interface ConvertOptions<TOOL_SCHEMAS extends ToolSchemaOverrides | "automatic"> {
294
- /** Schema overrides or "automatic" for dynamic conversion */
295
- schemas?: TOOL_SCHEMAS;
296
- /** Function to execute tool calls */
297
- callTool: CallToolExecutor;
298
- }
277
+ declare function isChatGPTAppTool(toolMeta: Record<string, unknown> | undefined): boolean;
299
278
  /**
300
- * Converts MCP tools to Vercel AI SDK format.
279
+ * Removes only the _meta field from a tool result (shallow copy).
301
280
  *
302
- * @param listToolsResult - The result from listTools()
303
- * @param options - Conversion options including callTool executor
304
- * @returns A ToolSet compatible with Vercel AI SDK
305
- *
306
- * @example
307
- * ```typescript
308
- * const tools = await convertMCPToolsToVercelTools(listToolsResult, {
309
- * callTool: async ({ name, args, options }) => {
310
- * return await mcpClient.callTool({ name, arguments: args });
311
- * },
312
- * });
281
+ * @param result - The full tool call result
282
+ * @returns A shallow copy of the result without _meta
283
+ */
284
+ declare function scrubMetaFromToolResult(result: CallToolResult): CallToolResult;
285
+ /**
286
+ * Returns a shallow copy of a CallToolResult with _meta and structuredContent removed.
313
287
  *
314
- * // Use with Vercel AI SDK
315
- * const result = await generateText({
316
- * model: openai("gpt-4"),
317
- * tools,
318
- * messages: [{ role: "user", content: "..." }],
319
- * });
320
- * ```
288
+ * @param result - The full tool call result
289
+ * @returns A scrubbed shallow copy without _meta and structuredContent
321
290
  */
322
- declare function convertMCPToolsToVercelTools(listToolsResult: ListToolsResult$1, { schemas, callTool, }: ConvertOptions<ToolSchemaOverrides | "automatic">): Promise<ToolSet>;
291
+ declare function scrubMetaAndStructuredContentFromToolResult(result: CallToolResult): CallToolResult;
323
292
 
324
293
  /**
325
294
  * Manages multiple MCP server connections with support for tools, resources,
@@ -998,39 +967,6 @@ declare class MCPClientManager {
998
967
  private isStdioConfig;
999
968
  }
1000
969
 
1001
- /**
1002
- * Transport utilities for MCPClientManager
1003
- */
1004
-
1005
- /**
1006
- * Builds the requestInit object, merging accessToken into Authorization header if provided.
1007
- *
1008
- * @param accessToken - Optional access token for Bearer auth
1009
- * @param requestInit - Optional existing requestInit config
1010
- * @returns Merged requestInit with Authorization header if accessToken provided
1011
- */
1012
- declare function buildRequestInit(accessToken: string | undefined, requestInit: StreamableHTTPClientTransportOptions["requestInit"]): StreamableHTTPClientTransportOptions["requestInit"];
1013
-
1014
- /**
1015
- * Error handling utilities for MCPClientManager
1016
- */
1017
- /**
1018
- * Checks if an error indicates that a method is not available/implemented by the server.
1019
- * Used for graceful degradation when servers don't support certain MCP features.
1020
- *
1021
- * @param error - The error to check
1022
- * @param method - The MCP method name (e.g., "tools/list", "resources/list")
1023
- * @returns True if the error indicates the method is unavailable
1024
- */
1025
- declare function isMethodUnavailableError(error: unknown, method: string): boolean;
1026
- /**
1027
- * Formats an error for display in error messages.
1028
- *
1029
- * @param error - The error to format
1030
- * @returns A string representation of the error
1031
- */
1032
- declare function formatError(error: unknown): string;
1033
-
1034
970
  /**
1035
971
  * Custom error classes for MCP SDK
1036
972
  */
@@ -1068,37 +1004,14 @@ declare function isAuthError(error: unknown): {
1068
1004
  statusCode?: number;
1069
1005
  };
1070
1006
 
1071
- /**
1072
- * MCP Tasks support (experimental feature - spec 2025-11-25)
1073
- */
1074
-
1075
- /**
1076
- * Checks if server supports task-augmented tool calls.
1077
- * Checks both top-level tasks and experimental.tasks namespaces.
1078
- *
1079
- * @param capabilities - The server capabilities
1080
- * @returns True if server supports task-augmented tool calls
1081
- */
1082
- declare function supportsTasksForToolCalls(capabilities: ServerCapabilities | undefined): boolean;
1083
- /**
1084
- * Checks if server supports tasks/list operation.
1085
- *
1086
- * @param capabilities - The server capabilities
1087
- * @returns True if server supports listing tasks
1088
- */
1089
- declare function supportsTasksList(capabilities: ServerCapabilities | undefined): boolean;
1090
- /**
1091
- * Checks if server supports tasks/cancel operation.
1092
- *
1093
- * @param capabilities - The server capabilities
1094
- * @returns True if server supports canceling tasks
1095
- */
1096
- declare function supportsTasksCancel(capabilities: ServerCapabilities | undefined): boolean;
1097
-
1098
1007
  /**
1099
1008
  * Core types for SDK evals functionality
1100
1009
  */
1101
1010
 
1011
+ type CoreMessage = ModelMessage;
1012
+ type CoreUserMessage = UserModelMessage;
1013
+ type CoreAssistantMessage = AssistantModelMessage;
1014
+ type CoreToolMessage = ToolModelMessage;
1102
1015
  /**
1103
1016
  * Built-in LLM providers with native SDK support
1104
1017
  */
@@ -1171,7 +1084,7 @@ interface PromptResultData {
1171
1084
  /** The original prompt/query that was sent */
1172
1085
  prompt: string;
1173
1086
  /** The full conversation history (user, assistant, tool messages) */
1174
- messages: CoreMessage[];
1087
+ messages: ModelMessage[];
1175
1088
  text: string;
1176
1089
  toolCalls: ToolCall[];
1177
1090
  usage: TokenUsage;
@@ -1433,9 +1346,9 @@ declare class TestAgent {
1433
1346
  */
1434
1347
  private createInstrumentedTools;
1435
1348
  /**
1436
- * Build an array of CoreMessages from previous PromptResult(s) for multi-turn context.
1349
+ * Build an array of ModelMessages from previous PromptResult(s) for multi-turn context.
1437
1350
  * @param context - Single PromptResult or array of PromptResults to include as context
1438
- * @returns Array of CoreMessages representing the conversation history
1351
+ * @returns Array of ModelMessages representing the conversation history
1439
1352
  */
1440
1353
  private buildContextMessages;
1441
1354
  /**
@@ -1525,27 +1438,6 @@ declare class TestAgent {
1525
1438
  getPromptHistory(): PromptResult[];
1526
1439
  }
1527
1440
 
1528
- /**
1529
- * Tool extraction utilities for AI SDK generateText results
1530
- */
1531
-
1532
- /**
1533
- * Extract all tool calls from an AI SDK generateText result.
1534
- * Collects tool calls from all steps in the agentic loop.
1535
- *
1536
- * @param result - The result from AI SDK's generateText
1537
- * @returns Array of ToolCall objects with toolName and arguments
1538
- */
1539
- declare function extractToolCalls(result: GenerateTextResult<ToolSet, never>): ToolCall[];
1540
- /**
1541
- * Extract tool names from an AI SDK generateText result.
1542
- * Convenience function that returns just the tool names.
1543
- *
1544
- * @param result - The result from AI SDK's generateText
1545
- * @returns Array of tool names that were called
1546
- */
1547
- declare function extractToolNames(result: GenerateTextResult<ToolSet, never>): string[];
1548
-
1549
1441
  /**
1550
1442
  * Validators for matching tool calls in eval tests
1551
1443
  *
@@ -1680,18 +1572,6 @@ declare function matchToolArgument(toolName: string, argKey: string, expectedVal
1680
1572
  */
1681
1573
  declare function matchToolArgumentWith(toolName: string, argKey: string, predicate: (value: unknown) => boolean, toolCalls: ToolCall[]): boolean;
1682
1574
 
1683
- /**
1684
- * Percentile calculation utilities for latency statistics
1685
- */
1686
- /**
1687
- * Calculate a specific percentile from sorted values.
1688
- *
1689
- * @param sortedValues - Array of numbers sorted in ascending order
1690
- * @param percentile - The percentile to calculate (0-100)
1691
- * @returns The percentile value
1692
- * @throws Error if array is empty or percentile is out of range
1693
- */
1694
- declare function calculatePercentile(sortedValues: number[], percentile: number): number;
1695
1575
  /**
1696
1576
  * Statistics for latency values
1697
1577
  */
@@ -1709,14 +1589,6 @@ interface LatencyStats {
1709
1589
  /** Number of values */
1710
1590
  count: number;
1711
1591
  }
1712
- /**
1713
- * Calculate comprehensive latency statistics for a set of values.
1714
- *
1715
- * @param values - Array of latency values (milliseconds)
1716
- * @returns LatencyStats object with min, max, mean, p50, p95, and count
1717
- * @throws Error if array is empty
1718
- */
1719
- declare function calculateLatencyStats(values: number[]): LatencyStats;
1720
1592
 
1721
1593
  /**
1722
1594
  * Configuration for an EvalTest
@@ -2067,4 +1939,4 @@ declare const PROVIDER_PRESETS: {
2067
1939
  readonly litellm: (baseUrl: string | undefined, modelIds: string[]) => CustomProvider;
2068
1940
  };
2069
1941
 
2070
- export { type AiSdkTool, type BaseServerConfig, type BaseUrls, type CallToolExecutor, type ClientCapabilityOptions, type CompatibleProtocol, type ConvertedToolSet, type CreateModelOptions, type CustomProvider, type ElicitationCallback, type ElicitationCallbackRequest, type ElicitationHandler, type EvalRunResult, EvalSuite, type EvalSuiteConfig, type EvalSuiteResult, EvalTest, type EvalTestConfig, type EvalTestRunOptions, type ExecuteToolArguments, type HttpServerConfig, type IterationResult, type LLMConfig, type LLMProvider, type LatencyBreakdown, type LatencyStats, type ListToolsResult, MCPAuthError, MCPClientManager, type MCPClientManagerConfig, type MCPClientManagerOptions, type MCPConnectionStatus, MCPError, type MCPGetPromptResult, type MCPListTasksResult, type MCPPrompt, type MCPPromptListResult, type MCPReadResourceResult, type MCPResource, type MCPResourceListResult, type MCPResourceTemplate, type MCPResourceTemplateListResult, type MCPServerConfig, type MCPServerSummary, type MCPTask, type MCPTaskStatus, PROVIDER_PRESETS, type ParsedLLMString, type ProgressEvent, type ProgressHandler, type PromptOptions, PromptResult, type PromptResultData, type ProviderLanguageModel, type RpcLogEvent, type RpcLogger, type ServerSummary, type StdioServerConfig, type TaskOptions, TestAgent, type TestAgentConfig, type TestResult, type TokenUsage, type Tool, type ToolCall, type ToolExecuteOptions, type ToolSchemaOverrides, buildRequestInit, calculateLatencyStats, calculatePercentile, convertMCPToolsToVercelTools, createCustomProvider, createModelFromString, ensureJsonSchemaObject, extractToolCalls, extractToolNames, formatError, isAuthError, isMCPAuthError, isMethodUnavailableError, matchAnyToolCall, matchNoToolCalls, matchToolArgument, matchToolArgumentWith, matchToolCallCount, matchToolCallWithArgs, matchToolCallWithPartialArgs, matchToolCalls, matchToolCallsSubset, parseLLMString, parseModelIds, supportsTasksCancel, supportsTasksForToolCalls, supportsTasksList };
1942
+ export { type AiSdkTool, type BaseServerConfig, type BaseUrls, type ClientCapabilityOptions, type CompatibleProtocol, type CoreAssistantMessage, type CoreMessage, type CoreToolMessage, type CoreUserMessage, type CreateModelOptions, type CustomProvider, type ElicitationCallback, type ElicitationCallbackRequest, type ElicitationHandler, type EvalRunResult, EvalSuite, type EvalSuiteConfig, type EvalSuiteResult, EvalTest, type EvalTestConfig, type EvalTestRunOptions, type ExecuteToolArguments, type HttpServerConfig, type IterationResult, type LLMConfig, type LLMProvider, type LatencyBreakdown, type ListToolsResult, MCPAuthError, MCPClientManager, type MCPClientManagerConfig, type MCPClientManagerOptions, type MCPConnectionStatus, MCPError, type MCPGetPromptResult, type MCPListTasksResult, type MCPPrompt, type MCPPromptListResult, type MCPReadResourceResult, type MCPResource, type MCPResourceListResult, type MCPResourceTemplate, type MCPResourceTemplateListResult, type MCPServerConfig, type MCPServerSummary, type MCPTask, type MCPTaskStatus, PROVIDER_PRESETS, type ParsedLLMString, type ProgressEvent, type ProgressHandler, type PromptOptions, PromptResult, type PromptResultData, type ProviderLanguageModel, type RpcLogEvent, type RpcLogger, type ServerSummary, type StdioServerConfig, type TaskOptions, TestAgent, type TestAgentConfig, type TestResult, type TokenUsage, type Tool, type ToolCall, type ToolExecuteOptions, createCustomProvider, createModelFromString, isAuthError, isChatGPTAppTool, isMCPAuthError, isMcpAppTool, matchAnyToolCall, matchNoToolCalls, matchToolArgument, matchToolArgumentWith, matchToolCallCount, matchToolCallWithArgs, matchToolCallWithPartialArgs, matchToolCalls, matchToolCallsSubset, parseLLMString, parseModelIds, scrubMetaAndStructuredContentFromToolResult, scrubMetaFromToolResult };
package/dist/index.d.ts CHANGED
@@ -2,11 +2,9 @@ import { ClientOptions, Client } from '@modelcontextprotocol/sdk/client/index.js
2
2
  import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
3
3
  import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
4
4
  import { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
5
- import { ElicitResult, ElicitRequest, Tool as Tool$1, CallToolResult, ListToolsResult as ListToolsResult$1, ServerCapabilities, LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
6
- export { ElicitResult, PromptListChangedNotificationSchema, ResourceListChangedNotificationSchema, ResourceUpdatedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
7
- import { ToolSet, ToolCallOptions, dynamicTool, Tool as Tool$2, CoreMessage, CoreUserMessage, CoreAssistantMessage, CoreToolMessage, GenerateTextResult } from 'ai';
8
- export { CoreAssistantMessage, CoreMessage, CoreToolMessage, CoreUserMessage } from 'ai';
9
- import { JSONSchema7 } from 'json-schema';
5
+ import { ElicitResult, ElicitRequest, Tool as Tool$1, CallToolResult, ServerCapabilities, LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
6
+ export { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
7
+ import { ToolSet, dynamicTool, AssistantModelMessage, ModelMessage, ToolModelMessage, UserModelMessage } from 'ai';
10
8
  import { createOpenAI } from '@ai-sdk/openai';
11
9
 
12
10
  /**
@@ -252,22 +250,6 @@ type NotificationHandler = Parameters<Client["setNotificationHandler"]>[1];
252
250
  * Tool conversion utilities for integrating MCP tools with Vercel AI SDK
253
251
  */
254
252
 
255
- /**
256
- * Normalizes a schema to a valid JSON Schema object.
257
- * Many MCP tools omit the top-level type; Anthropic requires an object schema.
258
- *
259
- * @param schema - The input schema (may be incomplete)
260
- * @returns A normalized JSONSchema7 object
261
- */
262
- declare function ensureJsonSchemaObject(schema: unknown): JSONSchema7;
263
- /**
264
- * Function type for executing tool calls
265
- */
266
- type CallToolExecutor = (params: {
267
- name: string;
268
- args: unknown;
269
- options: ToolCallOptions;
270
- }) => Promise<CallToolResult>;
271
253
  /**
272
254
  * Input schema type for tool definitions
273
255
  */
@@ -280,46 +262,33 @@ type ToolSchemaOverrides = Record<string, {
280
262
  inputSchema: ToolInputSchema;
281
263
  }>;
282
264
  /**
283
- * Result type for converted tools
284
- * When explicit schemas are provided, returns typed object
285
- * When "automatic", returns generic record
265
+ * Checks whether a tool is an MCP App by inspecting its _meta for a UI resource URI.
266
+ *
267
+ * @param toolMeta - The tool's _meta field from listTools result
268
+ * @returns true if the tool is an MCP App
286
269
  */
287
- type ConvertedToolSet<SCHEMAS extends ToolSchemaOverrides | "automatic"> = SCHEMAS extends ToolSchemaOverrides ? {
288
- [K in keyof SCHEMAS]: Tool$2;
289
- } : Record<string, Tool$2>;
270
+ declare function isMcpAppTool(toolMeta: Record<string, unknown> | undefined): boolean;
290
271
  /**
291
- * Options for tool conversion
272
+ * Checks whether a tool is a ChatGPT App by inspecting its _meta for an output template.
273
+ *
274
+ * @param toolMeta - The tool's _meta field from listTools result
275
+ * @returns true if the tool is a ChatGPT App
292
276
  */
293
- interface ConvertOptions<TOOL_SCHEMAS extends ToolSchemaOverrides | "automatic"> {
294
- /** Schema overrides or "automatic" for dynamic conversion */
295
- schemas?: TOOL_SCHEMAS;
296
- /** Function to execute tool calls */
297
- callTool: CallToolExecutor;
298
- }
277
+ declare function isChatGPTAppTool(toolMeta: Record<string, unknown> | undefined): boolean;
299
278
  /**
300
- * Converts MCP tools to Vercel AI SDK format.
279
+ * Removes only the _meta field from a tool result (shallow copy).
301
280
  *
302
- * @param listToolsResult - The result from listTools()
303
- * @param options - Conversion options including callTool executor
304
- * @returns A ToolSet compatible with Vercel AI SDK
305
- *
306
- * @example
307
- * ```typescript
308
- * const tools = await convertMCPToolsToVercelTools(listToolsResult, {
309
- * callTool: async ({ name, args, options }) => {
310
- * return await mcpClient.callTool({ name, arguments: args });
311
- * },
312
- * });
281
+ * @param result - The full tool call result
282
+ * @returns A shallow copy of the result without _meta
283
+ */
284
+ declare function scrubMetaFromToolResult(result: CallToolResult): CallToolResult;
285
+ /**
286
+ * Returns a shallow copy of a CallToolResult with _meta and structuredContent removed.
313
287
  *
314
- * // Use with Vercel AI SDK
315
- * const result = await generateText({
316
- * model: openai("gpt-4"),
317
- * tools,
318
- * messages: [{ role: "user", content: "..." }],
319
- * });
320
- * ```
288
+ * @param result - The full tool call result
289
+ * @returns A scrubbed shallow copy without _meta and structuredContent
321
290
  */
322
- declare function convertMCPToolsToVercelTools(listToolsResult: ListToolsResult$1, { schemas, callTool, }: ConvertOptions<ToolSchemaOverrides | "automatic">): Promise<ToolSet>;
291
+ declare function scrubMetaAndStructuredContentFromToolResult(result: CallToolResult): CallToolResult;
323
292
 
324
293
  /**
325
294
  * Manages multiple MCP server connections with support for tools, resources,
@@ -998,39 +967,6 @@ declare class MCPClientManager {
998
967
  private isStdioConfig;
999
968
  }
1000
969
 
1001
- /**
1002
- * Transport utilities for MCPClientManager
1003
- */
1004
-
1005
- /**
1006
- * Builds the requestInit object, merging accessToken into Authorization header if provided.
1007
- *
1008
- * @param accessToken - Optional access token for Bearer auth
1009
- * @param requestInit - Optional existing requestInit config
1010
- * @returns Merged requestInit with Authorization header if accessToken provided
1011
- */
1012
- declare function buildRequestInit(accessToken: string | undefined, requestInit: StreamableHTTPClientTransportOptions["requestInit"]): StreamableHTTPClientTransportOptions["requestInit"];
1013
-
1014
- /**
1015
- * Error handling utilities for MCPClientManager
1016
- */
1017
- /**
1018
- * Checks if an error indicates that a method is not available/implemented by the server.
1019
- * Used for graceful degradation when servers don't support certain MCP features.
1020
- *
1021
- * @param error - The error to check
1022
- * @param method - The MCP method name (e.g., "tools/list", "resources/list")
1023
- * @returns True if the error indicates the method is unavailable
1024
- */
1025
- declare function isMethodUnavailableError(error: unknown, method: string): boolean;
1026
- /**
1027
- * Formats an error for display in error messages.
1028
- *
1029
- * @param error - The error to format
1030
- * @returns A string representation of the error
1031
- */
1032
- declare function formatError(error: unknown): string;
1033
-
1034
970
  /**
1035
971
  * Custom error classes for MCP SDK
1036
972
  */
@@ -1068,37 +1004,14 @@ declare function isAuthError(error: unknown): {
1068
1004
  statusCode?: number;
1069
1005
  };
1070
1006
 
1071
- /**
1072
- * MCP Tasks support (experimental feature - spec 2025-11-25)
1073
- */
1074
-
1075
- /**
1076
- * Checks if server supports task-augmented tool calls.
1077
- * Checks both top-level tasks and experimental.tasks namespaces.
1078
- *
1079
- * @param capabilities - The server capabilities
1080
- * @returns True if server supports task-augmented tool calls
1081
- */
1082
- declare function supportsTasksForToolCalls(capabilities: ServerCapabilities | undefined): boolean;
1083
- /**
1084
- * Checks if server supports tasks/list operation.
1085
- *
1086
- * @param capabilities - The server capabilities
1087
- * @returns True if server supports listing tasks
1088
- */
1089
- declare function supportsTasksList(capabilities: ServerCapabilities | undefined): boolean;
1090
- /**
1091
- * Checks if server supports tasks/cancel operation.
1092
- *
1093
- * @param capabilities - The server capabilities
1094
- * @returns True if server supports canceling tasks
1095
- */
1096
- declare function supportsTasksCancel(capabilities: ServerCapabilities | undefined): boolean;
1097
-
1098
1007
  /**
1099
1008
  * Core types for SDK evals functionality
1100
1009
  */
1101
1010
 
1011
+ type CoreMessage = ModelMessage;
1012
+ type CoreUserMessage = UserModelMessage;
1013
+ type CoreAssistantMessage = AssistantModelMessage;
1014
+ type CoreToolMessage = ToolModelMessage;
1102
1015
  /**
1103
1016
  * Built-in LLM providers with native SDK support
1104
1017
  */
@@ -1171,7 +1084,7 @@ interface PromptResultData {
1171
1084
  /** The original prompt/query that was sent */
1172
1085
  prompt: string;
1173
1086
  /** The full conversation history (user, assistant, tool messages) */
1174
- messages: CoreMessage[];
1087
+ messages: ModelMessage[];
1175
1088
  text: string;
1176
1089
  toolCalls: ToolCall[];
1177
1090
  usage: TokenUsage;
@@ -1433,9 +1346,9 @@ declare class TestAgent {
1433
1346
  */
1434
1347
  private createInstrumentedTools;
1435
1348
  /**
1436
- * Build an array of CoreMessages from previous PromptResult(s) for multi-turn context.
1349
+ * Build an array of ModelMessages from previous PromptResult(s) for multi-turn context.
1437
1350
  * @param context - Single PromptResult or array of PromptResults to include as context
1438
- * @returns Array of CoreMessages representing the conversation history
1351
+ * @returns Array of ModelMessages representing the conversation history
1439
1352
  */
1440
1353
  private buildContextMessages;
1441
1354
  /**
@@ -1525,27 +1438,6 @@ declare class TestAgent {
1525
1438
  getPromptHistory(): PromptResult[];
1526
1439
  }
1527
1440
 
1528
- /**
1529
- * Tool extraction utilities for AI SDK generateText results
1530
- */
1531
-
1532
- /**
1533
- * Extract all tool calls from an AI SDK generateText result.
1534
- * Collects tool calls from all steps in the agentic loop.
1535
- *
1536
- * @param result - The result from AI SDK's generateText
1537
- * @returns Array of ToolCall objects with toolName and arguments
1538
- */
1539
- declare function extractToolCalls(result: GenerateTextResult<ToolSet, never>): ToolCall[];
1540
- /**
1541
- * Extract tool names from an AI SDK generateText result.
1542
- * Convenience function that returns just the tool names.
1543
- *
1544
- * @param result - The result from AI SDK's generateText
1545
- * @returns Array of tool names that were called
1546
- */
1547
- declare function extractToolNames(result: GenerateTextResult<ToolSet, never>): string[];
1548
-
1549
1441
  /**
1550
1442
  * Validators for matching tool calls in eval tests
1551
1443
  *
@@ -1680,18 +1572,6 @@ declare function matchToolArgument(toolName: string, argKey: string, expectedVal
1680
1572
  */
1681
1573
  declare function matchToolArgumentWith(toolName: string, argKey: string, predicate: (value: unknown) => boolean, toolCalls: ToolCall[]): boolean;
1682
1574
 
1683
- /**
1684
- * Percentile calculation utilities for latency statistics
1685
- */
1686
- /**
1687
- * Calculate a specific percentile from sorted values.
1688
- *
1689
- * @param sortedValues - Array of numbers sorted in ascending order
1690
- * @param percentile - The percentile to calculate (0-100)
1691
- * @returns The percentile value
1692
- * @throws Error if array is empty or percentile is out of range
1693
- */
1694
- declare function calculatePercentile(sortedValues: number[], percentile: number): number;
1695
1575
  /**
1696
1576
  * Statistics for latency values
1697
1577
  */
@@ -1709,14 +1589,6 @@ interface LatencyStats {
1709
1589
  /** Number of values */
1710
1590
  count: number;
1711
1591
  }
1712
- /**
1713
- * Calculate comprehensive latency statistics for a set of values.
1714
- *
1715
- * @param values - Array of latency values (milliseconds)
1716
- * @returns LatencyStats object with min, max, mean, p50, p95, and count
1717
- * @throws Error if array is empty
1718
- */
1719
- declare function calculateLatencyStats(values: number[]): LatencyStats;
1720
1592
 
1721
1593
  /**
1722
1594
  * Configuration for an EvalTest
@@ -2067,4 +1939,4 @@ declare const PROVIDER_PRESETS: {
2067
1939
  readonly litellm: (baseUrl: string | undefined, modelIds: string[]) => CustomProvider;
2068
1940
  };
2069
1941
 
2070
- export { type AiSdkTool, type BaseServerConfig, type BaseUrls, type CallToolExecutor, type ClientCapabilityOptions, type CompatibleProtocol, type ConvertedToolSet, type CreateModelOptions, type CustomProvider, type ElicitationCallback, type ElicitationCallbackRequest, type ElicitationHandler, type EvalRunResult, EvalSuite, type EvalSuiteConfig, type EvalSuiteResult, EvalTest, type EvalTestConfig, type EvalTestRunOptions, type ExecuteToolArguments, type HttpServerConfig, type IterationResult, type LLMConfig, type LLMProvider, type LatencyBreakdown, type LatencyStats, type ListToolsResult, MCPAuthError, MCPClientManager, type MCPClientManagerConfig, type MCPClientManagerOptions, type MCPConnectionStatus, MCPError, type MCPGetPromptResult, type MCPListTasksResult, type MCPPrompt, type MCPPromptListResult, type MCPReadResourceResult, type MCPResource, type MCPResourceListResult, type MCPResourceTemplate, type MCPResourceTemplateListResult, type MCPServerConfig, type MCPServerSummary, type MCPTask, type MCPTaskStatus, PROVIDER_PRESETS, type ParsedLLMString, type ProgressEvent, type ProgressHandler, type PromptOptions, PromptResult, type PromptResultData, type ProviderLanguageModel, type RpcLogEvent, type RpcLogger, type ServerSummary, type StdioServerConfig, type TaskOptions, TestAgent, type TestAgentConfig, type TestResult, type TokenUsage, type Tool, type ToolCall, type ToolExecuteOptions, type ToolSchemaOverrides, buildRequestInit, calculateLatencyStats, calculatePercentile, convertMCPToolsToVercelTools, createCustomProvider, createModelFromString, ensureJsonSchemaObject, extractToolCalls, extractToolNames, formatError, isAuthError, isMCPAuthError, isMethodUnavailableError, matchAnyToolCall, matchNoToolCalls, matchToolArgument, matchToolArgumentWith, matchToolCallCount, matchToolCallWithArgs, matchToolCallWithPartialArgs, matchToolCalls, matchToolCallsSubset, parseLLMString, parseModelIds, supportsTasksCancel, supportsTasksForToolCalls, supportsTasksList };
1942
+ export { type AiSdkTool, type BaseServerConfig, type BaseUrls, type ClientCapabilityOptions, type CompatibleProtocol, type CoreAssistantMessage, type CoreMessage, type CoreToolMessage, type CoreUserMessage, type CreateModelOptions, type CustomProvider, type ElicitationCallback, type ElicitationCallbackRequest, type ElicitationHandler, type EvalRunResult, EvalSuite, type EvalSuiteConfig, type EvalSuiteResult, EvalTest, type EvalTestConfig, type EvalTestRunOptions, type ExecuteToolArguments, type HttpServerConfig, type IterationResult, type LLMConfig, type LLMProvider, type LatencyBreakdown, type ListToolsResult, MCPAuthError, MCPClientManager, type MCPClientManagerConfig, type MCPClientManagerOptions, type MCPConnectionStatus, MCPError, type MCPGetPromptResult, type MCPListTasksResult, type MCPPrompt, type MCPPromptListResult, type MCPReadResourceResult, type MCPResource, type MCPResourceListResult, type MCPResourceTemplate, type MCPResourceTemplateListResult, type MCPServerConfig, type MCPServerSummary, type MCPTask, type MCPTaskStatus, PROVIDER_PRESETS, type ParsedLLMString, type ProgressEvent, type ProgressHandler, type PromptOptions, PromptResult, type PromptResultData, type ProviderLanguageModel, type RpcLogEvent, type RpcLogger, type ServerSummary, type StdioServerConfig, type TaskOptions, TestAgent, type TestAgentConfig, type TestResult, type TokenUsage, type Tool, type ToolCall, type ToolExecuteOptions, createCustomProvider, createModelFromString, isAuthError, isChatGPTAppTool, isMCPAuthError, isMcpAppTool, matchAnyToolCall, matchNoToolCalls, matchToolArgument, matchToolArgumentWith, matchToolCallCount, matchToolCallWithArgs, matchToolCallWithPartialArgs, matchToolCalls, matchToolCallsSubset, parseLLMString, parseModelIds, scrubMetaAndStructuredContentFromToolResult, scrubMetaFromToolResult };