ai 4.1.61 → 4.1.62
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/CHANGELOG.md +7 -0
- package/dist/index.d.mts +149 -17
- package/dist/index.d.ts +149 -17
- package/dist/index.js +66 -239
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -246
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
@@ -8,8 +8,6 @@ import { ServerResponse } from 'node:http';
|
|
8
8
|
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
9
9
|
import { z } from 'zod';
|
10
10
|
import { ServerResponse as ServerResponse$1 } from 'http';
|
11
|
-
import { IOType } from 'node:child_process';
|
12
|
-
import { Stream } from 'node:stream';
|
13
11
|
|
14
12
|
/**
|
15
13
|
Language model that is used by the AI SDK Core functions.
|
@@ -1710,6 +1708,153 @@ onlyBar('bar');
|
|
1710
1708
|
*/
|
1711
1709
|
type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
|
1712
1710
|
|
1711
|
+
declare const JSONRPCMessageSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
1712
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
1713
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
1714
|
+
}, {
|
1715
|
+
method: z.ZodString;
|
1716
|
+
params: z.ZodOptional<z.ZodObject<{
|
1717
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1718
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
1719
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1720
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
1721
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1722
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
1723
|
+
}>, "strict", z.ZodTypeAny, {
|
1724
|
+
id: string | number;
|
1725
|
+
method: string;
|
1726
|
+
jsonrpc: "2.0";
|
1727
|
+
params?: z.objectOutputType<{
|
1728
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1729
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1730
|
+
}, {
|
1731
|
+
id: string | number;
|
1732
|
+
method: string;
|
1733
|
+
jsonrpc: "2.0";
|
1734
|
+
params?: z.objectInputType<{
|
1735
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1736
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1737
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
1738
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
1739
|
+
}, {
|
1740
|
+
method: z.ZodString;
|
1741
|
+
params: z.ZodOptional<z.ZodObject<{
|
1742
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1743
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
1744
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1745
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
1746
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1747
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
1748
|
+
}>, "strict", z.ZodTypeAny, {
|
1749
|
+
method: string;
|
1750
|
+
jsonrpc: "2.0";
|
1751
|
+
params?: z.objectOutputType<{
|
1752
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1753
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1754
|
+
}, {
|
1755
|
+
method: string;
|
1756
|
+
jsonrpc: "2.0";
|
1757
|
+
params?: z.objectInputType<{
|
1758
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1759
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1760
|
+
}>, z.ZodObject<{
|
1761
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
1762
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
1763
|
+
result: z.ZodObject<{
|
1764
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1765
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
1766
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1767
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
1768
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1769
|
+
}, z.ZodTypeAny, "passthrough">>;
|
1770
|
+
}, "strict", z.ZodTypeAny, {
|
1771
|
+
result: {
|
1772
|
+
_meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
1773
|
+
} & {
|
1774
|
+
[k: string]: unknown;
|
1775
|
+
};
|
1776
|
+
id: string | number;
|
1777
|
+
jsonrpc: "2.0";
|
1778
|
+
}, {
|
1779
|
+
result: {
|
1780
|
+
_meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
1781
|
+
} & {
|
1782
|
+
[k: string]: unknown;
|
1783
|
+
};
|
1784
|
+
id: string | number;
|
1785
|
+
jsonrpc: "2.0";
|
1786
|
+
}>, z.ZodObject<{
|
1787
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
1788
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
1789
|
+
error: z.ZodObject<{
|
1790
|
+
code: z.ZodNumber;
|
1791
|
+
message: z.ZodString;
|
1792
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
1793
|
+
}, "strip", z.ZodTypeAny, {
|
1794
|
+
code: number;
|
1795
|
+
message: string;
|
1796
|
+
data?: unknown;
|
1797
|
+
}, {
|
1798
|
+
code: number;
|
1799
|
+
message: string;
|
1800
|
+
data?: unknown;
|
1801
|
+
}>;
|
1802
|
+
}, "strict", z.ZodTypeAny, {
|
1803
|
+
error: {
|
1804
|
+
code: number;
|
1805
|
+
message: string;
|
1806
|
+
data?: unknown;
|
1807
|
+
};
|
1808
|
+
id: string | number;
|
1809
|
+
jsonrpc: "2.0";
|
1810
|
+
}, {
|
1811
|
+
error: {
|
1812
|
+
code: number;
|
1813
|
+
message: string;
|
1814
|
+
data?: unknown;
|
1815
|
+
};
|
1816
|
+
id: string | number;
|
1817
|
+
jsonrpc: "2.0";
|
1818
|
+
}>]>;
|
1819
|
+
type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
|
1820
|
+
|
1821
|
+
/**
|
1822
|
+
* Transport interface for MCP (Model Context Protocol) communication.
|
1823
|
+
* Maps to the `Transport` interface in the MCP spec.
|
1824
|
+
*/
|
1825
|
+
interface MCPTransport {
|
1826
|
+
/**
|
1827
|
+
* Initialize and start the transport
|
1828
|
+
*/
|
1829
|
+
start(): Promise<void>;
|
1830
|
+
/**
|
1831
|
+
* Send a JSON-RPC message through the transport
|
1832
|
+
* @param message The JSON-RPC message to send
|
1833
|
+
*/
|
1834
|
+
send(message: JSONRPCMessage): Promise<void>;
|
1835
|
+
/**
|
1836
|
+
* Clean up and close the transport
|
1837
|
+
*/
|
1838
|
+
close(): Promise<void>;
|
1839
|
+
/**
|
1840
|
+
* Event handler for transport closure
|
1841
|
+
*/
|
1842
|
+
onclose?: () => void;
|
1843
|
+
/**
|
1844
|
+
* Event handler for transport errors
|
1845
|
+
*/
|
1846
|
+
onerror?: (error: Error) => void;
|
1847
|
+
/**
|
1848
|
+
* Event handler for received messages
|
1849
|
+
*/
|
1850
|
+
onmessage?: (message: JSONRPCMessage) => void;
|
1851
|
+
}
|
1852
|
+
interface SSEConfig {
|
1853
|
+
type: 'sse';
|
1854
|
+
url: string;
|
1855
|
+
}
|
1856
|
+
type MCPTransportConfig = SSEConfig;
|
1857
|
+
|
1713
1858
|
type ToolSchemas = Record<string, {
|
1714
1859
|
parameters: ToolParameters;
|
1715
1860
|
}> | 'automatic' | undefined;
|
@@ -1724,19 +1869,6 @@ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS e
|
|
1724
1869
|
execute: (args: unknown, options: ToolExecutionOptions) => PromiseLike<CallToolResult>;
|
1725
1870
|
};
|
1726
1871
|
};
|
1727
|
-
interface McpStdioServerConfig {
|
1728
|
-
command: string;
|
1729
|
-
args?: string[];
|
1730
|
-
env?: Record<string, string>;
|
1731
|
-
stderr?: IOType | Stream | number;
|
1732
|
-
cwd?: string;
|
1733
|
-
type: 'stdio';
|
1734
|
-
}
|
1735
|
-
interface McpSSEServerConfig {
|
1736
|
-
type: 'sse';
|
1737
|
-
url: string;
|
1738
|
-
}
|
1739
|
-
type TransportConfig = McpStdioServerConfig | McpSSEServerConfig;
|
1740
1872
|
declare const CallToolResultSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
1741
1873
|
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1742
1874
|
}, {
|
@@ -2453,7 +2585,7 @@ type CallToolResult = z.infer<typeof CallToolResultSchema>;
|
|
2453
2585
|
|
2454
2586
|
interface MCPClientConfig {
|
2455
2587
|
/** Transport configuration for connecting to the MCP server */
|
2456
|
-
transport:
|
2588
|
+
transport: MCPTransportConfig | MCPTransport;
|
2457
2589
|
/** Optional callback for uncaught errors */
|
2458
2590
|
onUncaughtError?: (error: unknown) => void;
|
2459
2591
|
/** Optional client name, defaults to 'ai-sdk-mcp-client' */
|
@@ -4083,4 +4215,4 @@ declare namespace llamaindexAdapter {
|
|
4083
4215
|
};
|
4084
4216
|
}
|
4085
4217
|
|
4086
|
-
export { AssistantContent, AssistantResponse, CallWarning, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolCallUnion, CoreToolChoice, CoreToolMessage, CoreToolResultUnion, CoreUserMessage, DataContent, DataStreamOptions, DataStreamWriter, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedImage as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModelV1Middleware, llamaindexAdapter as LlamaIndexAdapter, LogProbs, MCPClientError, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Provider, ProviderMetadata, RepairTextFunction, RetryError, StepResult, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolResultPart, ToolResultUnion, ToolSet, UserContent, appendClientMessage, appendResponseMessages, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, experimental_wrapLanguageModel, extractReasoningMiddleware, generateObject, generateText, pipeDataStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, wrapLanguageModel };
|
4218
|
+
export { AssistantContent, AssistantResponse, CallWarning, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolCallUnion, CoreToolChoice, CoreToolMessage, CoreToolResultUnion, CoreUserMessage, DataContent, DataStreamOptions, DataStreamWriter, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedImage as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModelV1Middleware, llamaindexAdapter as LlamaIndexAdapter, LogProbs, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Provider, ProviderMetadata, RepairTextFunction, RetryError, StepResult, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolResultPart, ToolResultUnion, ToolSet, UserContent, appendClientMessage, appendResponseMessages, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, experimental_wrapLanguageModel, extractReasoningMiddleware, generateObject, generateText, pipeDataStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, wrapLanguageModel };
|
package/dist/index.d.ts
CHANGED
@@ -8,8 +8,6 @@ import { ServerResponse } from 'node:http';
|
|
8
8
|
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
9
9
|
import { z } from 'zod';
|
10
10
|
import { ServerResponse as ServerResponse$1 } from 'http';
|
11
|
-
import { IOType } from 'node:child_process';
|
12
|
-
import { Stream } from 'node:stream';
|
13
11
|
|
14
12
|
/**
|
15
13
|
Language model that is used by the AI SDK Core functions.
|
@@ -1710,6 +1708,153 @@ onlyBar('bar');
|
|
1710
1708
|
*/
|
1711
1709
|
type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
|
1712
1710
|
|
1711
|
+
declare const JSONRPCMessageSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
1712
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
1713
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
1714
|
+
}, {
|
1715
|
+
method: z.ZodString;
|
1716
|
+
params: z.ZodOptional<z.ZodObject<{
|
1717
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1718
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
1719
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1720
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
1721
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1722
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
1723
|
+
}>, "strict", z.ZodTypeAny, {
|
1724
|
+
id: string | number;
|
1725
|
+
method: string;
|
1726
|
+
jsonrpc: "2.0";
|
1727
|
+
params?: z.objectOutputType<{
|
1728
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1729
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1730
|
+
}, {
|
1731
|
+
id: string | number;
|
1732
|
+
method: string;
|
1733
|
+
jsonrpc: "2.0";
|
1734
|
+
params?: z.objectInputType<{
|
1735
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1736
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1737
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
1738
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
1739
|
+
}, {
|
1740
|
+
method: z.ZodString;
|
1741
|
+
params: z.ZodOptional<z.ZodObject<{
|
1742
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1743
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
1744
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1745
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
1746
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1747
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
1748
|
+
}>, "strict", z.ZodTypeAny, {
|
1749
|
+
method: string;
|
1750
|
+
jsonrpc: "2.0";
|
1751
|
+
params?: z.objectOutputType<{
|
1752
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1753
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1754
|
+
}, {
|
1755
|
+
method: string;
|
1756
|
+
jsonrpc: "2.0";
|
1757
|
+
params?: z.objectInputType<{
|
1758
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1759
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1760
|
+
}>, z.ZodObject<{
|
1761
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
1762
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
1763
|
+
result: z.ZodObject<{
|
1764
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1765
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
1766
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1767
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
1768
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1769
|
+
}, z.ZodTypeAny, "passthrough">>;
|
1770
|
+
}, "strict", z.ZodTypeAny, {
|
1771
|
+
result: {
|
1772
|
+
_meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
1773
|
+
} & {
|
1774
|
+
[k: string]: unknown;
|
1775
|
+
};
|
1776
|
+
id: string | number;
|
1777
|
+
jsonrpc: "2.0";
|
1778
|
+
}, {
|
1779
|
+
result: {
|
1780
|
+
_meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
1781
|
+
} & {
|
1782
|
+
[k: string]: unknown;
|
1783
|
+
};
|
1784
|
+
id: string | number;
|
1785
|
+
jsonrpc: "2.0";
|
1786
|
+
}>, z.ZodObject<{
|
1787
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
1788
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
1789
|
+
error: z.ZodObject<{
|
1790
|
+
code: z.ZodNumber;
|
1791
|
+
message: z.ZodString;
|
1792
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
1793
|
+
}, "strip", z.ZodTypeAny, {
|
1794
|
+
code: number;
|
1795
|
+
message: string;
|
1796
|
+
data?: unknown;
|
1797
|
+
}, {
|
1798
|
+
code: number;
|
1799
|
+
message: string;
|
1800
|
+
data?: unknown;
|
1801
|
+
}>;
|
1802
|
+
}, "strict", z.ZodTypeAny, {
|
1803
|
+
error: {
|
1804
|
+
code: number;
|
1805
|
+
message: string;
|
1806
|
+
data?: unknown;
|
1807
|
+
};
|
1808
|
+
id: string | number;
|
1809
|
+
jsonrpc: "2.0";
|
1810
|
+
}, {
|
1811
|
+
error: {
|
1812
|
+
code: number;
|
1813
|
+
message: string;
|
1814
|
+
data?: unknown;
|
1815
|
+
};
|
1816
|
+
id: string | number;
|
1817
|
+
jsonrpc: "2.0";
|
1818
|
+
}>]>;
|
1819
|
+
type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
|
1820
|
+
|
1821
|
+
/**
|
1822
|
+
* Transport interface for MCP (Model Context Protocol) communication.
|
1823
|
+
* Maps to the `Transport` interface in the MCP spec.
|
1824
|
+
*/
|
1825
|
+
interface MCPTransport {
|
1826
|
+
/**
|
1827
|
+
* Initialize and start the transport
|
1828
|
+
*/
|
1829
|
+
start(): Promise<void>;
|
1830
|
+
/**
|
1831
|
+
* Send a JSON-RPC message through the transport
|
1832
|
+
* @param message The JSON-RPC message to send
|
1833
|
+
*/
|
1834
|
+
send(message: JSONRPCMessage): Promise<void>;
|
1835
|
+
/**
|
1836
|
+
* Clean up and close the transport
|
1837
|
+
*/
|
1838
|
+
close(): Promise<void>;
|
1839
|
+
/**
|
1840
|
+
* Event handler for transport closure
|
1841
|
+
*/
|
1842
|
+
onclose?: () => void;
|
1843
|
+
/**
|
1844
|
+
* Event handler for transport errors
|
1845
|
+
*/
|
1846
|
+
onerror?: (error: Error) => void;
|
1847
|
+
/**
|
1848
|
+
* Event handler for received messages
|
1849
|
+
*/
|
1850
|
+
onmessage?: (message: JSONRPCMessage) => void;
|
1851
|
+
}
|
1852
|
+
interface SSEConfig {
|
1853
|
+
type: 'sse';
|
1854
|
+
url: string;
|
1855
|
+
}
|
1856
|
+
type MCPTransportConfig = SSEConfig;
|
1857
|
+
|
1713
1858
|
type ToolSchemas = Record<string, {
|
1714
1859
|
parameters: ToolParameters;
|
1715
1860
|
}> | 'automatic' | undefined;
|
@@ -1724,19 +1869,6 @@ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS e
|
|
1724
1869
|
execute: (args: unknown, options: ToolExecutionOptions) => PromiseLike<CallToolResult>;
|
1725
1870
|
};
|
1726
1871
|
};
|
1727
|
-
interface McpStdioServerConfig {
|
1728
|
-
command: string;
|
1729
|
-
args?: string[];
|
1730
|
-
env?: Record<string, string>;
|
1731
|
-
stderr?: IOType | Stream | number;
|
1732
|
-
cwd?: string;
|
1733
|
-
type: 'stdio';
|
1734
|
-
}
|
1735
|
-
interface McpSSEServerConfig {
|
1736
|
-
type: 'sse';
|
1737
|
-
url: string;
|
1738
|
-
}
|
1739
|
-
type TransportConfig = McpStdioServerConfig | McpSSEServerConfig;
|
1740
1872
|
declare const CallToolResultSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
1741
1873
|
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
1742
1874
|
}, {
|
@@ -2453,7 +2585,7 @@ type CallToolResult = z.infer<typeof CallToolResultSchema>;
|
|
2453
2585
|
|
2454
2586
|
interface MCPClientConfig {
|
2455
2587
|
/** Transport configuration for connecting to the MCP server */
|
2456
|
-
transport:
|
2588
|
+
transport: MCPTransportConfig | MCPTransport;
|
2457
2589
|
/** Optional callback for uncaught errors */
|
2458
2590
|
onUncaughtError?: (error: unknown) => void;
|
2459
2591
|
/** Optional client name, defaults to 'ai-sdk-mcp-client' */
|
@@ -4083,4 +4215,4 @@ declare namespace llamaindexAdapter {
|
|
4083
4215
|
};
|
4084
4216
|
}
|
4085
4217
|
|
4086
|
-
export { AssistantContent, AssistantResponse, CallWarning, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolCallUnion, CoreToolChoice, CoreToolMessage, CoreToolResultUnion, CoreUserMessage, DataContent, DataStreamOptions, DataStreamWriter, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedImage as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModelV1Middleware, llamaindexAdapter as LlamaIndexAdapter, LogProbs, MCPClientError, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Provider, ProviderMetadata, RepairTextFunction, RetryError, StepResult, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolResultPart, ToolResultUnion, ToolSet, UserContent, appendClientMessage, appendResponseMessages, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, experimental_wrapLanguageModel, extractReasoningMiddleware, generateObject, generateText, pipeDataStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, wrapLanguageModel };
|
4218
|
+
export { AssistantContent, AssistantResponse, CallWarning, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolCallUnion, CoreToolChoice, CoreToolMessage, CoreToolResultUnion, CoreUserMessage, DataContent, DataStreamOptions, DataStreamWriter, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedImage as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModelV1Middleware, llamaindexAdapter as LlamaIndexAdapter, LogProbs, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Provider, ProviderMetadata, RepairTextFunction, RetryError, StepResult, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolResultPart, ToolResultUnion, ToolSet, UserContent, appendClientMessage, appendResponseMessages, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, experimental_wrapLanguageModel, extractReasoningMiddleware, generateObject, generateText, pipeDataStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, wrapLanguageModel };
|