@iqai/adk 0.0.7 → 0.0.9

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @iqai/adk
2
2
 
3
+ ## 0.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - b0b2f93: Adds description back to mcp config
8
+ - 6cf2ba0: Adds proper type to convertMcpMessagesToADK method
9
+
10
+ ## 0.0.8
11
+
12
+ ### Patch Changes
13
+
14
+ - 74ee653: Simplified sampling handler with adk message and response typings
15
+
3
16
  ## 0.0.7
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2699,7 +2699,6 @@ type McpConfig = {
2699
2699
  maxSize?: number;
2700
2700
  };
2701
2701
  debug?: boolean;
2702
- samplingHandler?: SamplingHandler;
2703
2702
  };
2704
2703
  type McpTransportType = {
2705
2704
  mode: "stdio";
@@ -2733,14 +2732,46 @@ declare class McpError extends Error {
2733
2732
  }
2734
2733
  type SamplingRequest = z.infer<typeof CreateMessageRequestSchema>;
2735
2734
  type SamplingResponse = z.infer<typeof CreateMessageResultSchema>;
2736
- type SamplingHandler = (request: SamplingRequest) => Promise<SamplingResponse>;
2735
+
2736
+ /**
2737
+ * ADK sampling request format - what we pass to the user's handler
2738
+ */
2739
+ interface ADKSamplingRequest {
2740
+ messages: Message[];
2741
+ systemPrompt?: string;
2742
+ modelPreferences?: {
2743
+ hints?: Array<{
2744
+ name?: string;
2745
+ }>;
2746
+ costPriority?: number;
2747
+ speedPriority?: number;
2748
+ intelligencePriority?: number;
2749
+ };
2750
+ includeContext?: "none" | "thisServer" | "allServers";
2751
+ temperature?: number;
2752
+ maxTokens: number;
2753
+ stopSequences?: string[];
2754
+ metadata?: Record<string, unknown>;
2755
+ }
2756
+ /**
2757
+ * ADK sampling response format - what we expect from the user's handler
2758
+ */
2759
+ interface ADKSamplingResponse {
2760
+ model: string;
2761
+ stopReason?: "endTurn" | "stopSequence" | "maxTokens" | string;
2762
+ content: string | null;
2763
+ }
2764
+ /**
2765
+ * ADK sampling handler function type - receives ADK formatted messages
2766
+ */
2767
+ type ADKSamplingHandler = (request: ADKSamplingRequest) => Promise<ADKSamplingResponse>;
2737
2768
 
2738
2769
  declare class McpClientService {
2739
2770
  private config;
2740
2771
  private client;
2741
2772
  private transport;
2742
2773
  private isClosing;
2743
- private samplingHandler;
2774
+ private mcpSamplingHandler;
2744
2775
  private logger;
2745
2776
  constructor(config: McpConfig);
2746
2777
  /**
@@ -2777,7 +2808,13 @@ declare class McpClientService {
2777
2808
  */
2778
2809
  isConnected(): boolean;
2779
2810
  private setupSamplingHandler;
2780
- setSamplingHandler(handler: SamplingHandler): void;
2811
+ /**
2812
+ * Set an ADK sampling handler
2813
+ */
2814
+ setSamplingHandler(handler: ADKSamplingHandler): void;
2815
+ /**
2816
+ * Remove the sampling handler
2817
+ */
2781
2818
  removeSamplingHandler(): void;
2782
2819
  }
2783
2820
 
@@ -2886,7 +2923,6 @@ declare const index$2_McpErrorType: typeof McpErrorType;
2886
2923
  type index$2_McpToolset = McpToolset;
2887
2924
  declare const index$2_McpToolset: typeof McpToolset;
2888
2925
  type index$2_McpTransportType = McpTransportType;
2889
- type index$2_SamplingHandler = SamplingHandler;
2890
2926
  type index$2_SamplingRequest = SamplingRequest;
2891
2927
  type index$2_SamplingResponse = SamplingResponse;
2892
2928
  type index$2_ToolConfig = ToolConfig;
@@ -2904,7 +2940,7 @@ declare const index$2_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
2904
2940
  declare const index$2_mcpSchemaToParameters: typeof mcpSchemaToParameters;
2905
2941
  declare const index$2_normalizeJsonSchema: typeof normalizeJsonSchema;
2906
2942
  declare namespace index$2 {
2907
- export { index$2_BaseTool as BaseTool, type index$2_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, index$2_ExitLoopTool as ExitLoopTool, index$2_FileOperationsTool as FileOperationsTool, index$2_FunctionTool as FunctionTool, index$2_GetUserChoiceTool as GetUserChoiceTool, index$2_GoogleSearch as GoogleSearch, index$2_HttpRequestTool as HttpRequestTool, type index$2_IToolContext as IToolContext, index$2_LoadMemoryTool as LoadMemoryTool, type index$2_McpConfig as McpConfig, index$2_McpError as McpError, index$2_McpErrorType as McpErrorType, index$2_McpToolset as McpToolset, type index$2_McpTransportType as McpTransportType, type index$2_SamplingHandler as SamplingHandler, type index$2_SamplingRequest as SamplingRequest, type index$2_SamplingResponse as SamplingResponse, type index$2_ToolConfig as ToolConfig, index$2_ToolContext as ToolContext, index$2_TransferToAgentTool as TransferToAgentTool, index$2_UserInteractionTool as UserInteractionTool, index$2_adkToMcpToolType as adkToMcpToolType, index$2_buildFunctionDeclaration as buildFunctionDeclaration, index$2_createFunctionTool as createFunctionTool, index$2_getMcpTools as getMcpTools, index$2_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$2_mcpSchemaToParameters as mcpSchemaToParameters, index$2_normalizeJsonSchema as normalizeJsonSchema };
2943
+ export { index$2_BaseTool as BaseTool, type index$2_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, index$2_ExitLoopTool as ExitLoopTool, index$2_FileOperationsTool as FileOperationsTool, index$2_FunctionTool as FunctionTool, index$2_GetUserChoiceTool as GetUserChoiceTool, index$2_GoogleSearch as GoogleSearch, index$2_HttpRequestTool as HttpRequestTool, type index$2_IToolContext as IToolContext, index$2_LoadMemoryTool as LoadMemoryTool, type index$2_McpConfig as McpConfig, index$2_McpError as McpError, index$2_McpErrorType as McpErrorType, index$2_McpToolset as McpToolset, type index$2_McpTransportType as McpTransportType, type index$2_SamplingRequest as SamplingRequest, type index$2_SamplingResponse as SamplingResponse, type index$2_ToolConfig as ToolConfig, index$2_ToolContext as ToolContext, index$2_TransferToAgentTool as TransferToAgentTool, index$2_UserInteractionTool as UserInteractionTool, index$2_adkToMcpToolType as adkToMcpToolType, index$2_buildFunctionDeclaration as buildFunctionDeclaration, index$2_createFunctionTool as createFunctionTool, index$2_getMcpTools as getMcpTools, index$2_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$2_mcpSchemaToParameters as mcpSchemaToParameters, index$2_normalizeJsonSchema as normalizeJsonSchema };
2908
2944
  }
2909
2945
 
2910
2946
  /**
@@ -3463,4 +3499,4 @@ declare class InMemoryRunner extends Runner {
3463
3499
 
3464
3500
  declare const VERSION = "0.1.0";
3465
3501
 
3466
- export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingHandler, type SamplingRequest, type SamplingResponse, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, validateSession };
3502
+ export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingRequest, type SamplingResponse, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, validateSession };
package/dist/index.d.ts CHANGED
@@ -2699,7 +2699,6 @@ type McpConfig = {
2699
2699
  maxSize?: number;
2700
2700
  };
2701
2701
  debug?: boolean;
2702
- samplingHandler?: SamplingHandler;
2703
2702
  };
2704
2703
  type McpTransportType = {
2705
2704
  mode: "stdio";
@@ -2733,14 +2732,46 @@ declare class McpError extends Error {
2733
2732
  }
2734
2733
  type SamplingRequest = z.infer<typeof CreateMessageRequestSchema>;
2735
2734
  type SamplingResponse = z.infer<typeof CreateMessageResultSchema>;
2736
- type SamplingHandler = (request: SamplingRequest) => Promise<SamplingResponse>;
2735
+
2736
+ /**
2737
+ * ADK sampling request format - what we pass to the user's handler
2738
+ */
2739
+ interface ADKSamplingRequest {
2740
+ messages: Message[];
2741
+ systemPrompt?: string;
2742
+ modelPreferences?: {
2743
+ hints?: Array<{
2744
+ name?: string;
2745
+ }>;
2746
+ costPriority?: number;
2747
+ speedPriority?: number;
2748
+ intelligencePriority?: number;
2749
+ };
2750
+ includeContext?: "none" | "thisServer" | "allServers";
2751
+ temperature?: number;
2752
+ maxTokens: number;
2753
+ stopSequences?: string[];
2754
+ metadata?: Record<string, unknown>;
2755
+ }
2756
+ /**
2757
+ * ADK sampling response format - what we expect from the user's handler
2758
+ */
2759
+ interface ADKSamplingResponse {
2760
+ model: string;
2761
+ stopReason?: "endTurn" | "stopSequence" | "maxTokens" | string;
2762
+ content: string | null;
2763
+ }
2764
+ /**
2765
+ * ADK sampling handler function type - receives ADK formatted messages
2766
+ */
2767
+ type ADKSamplingHandler = (request: ADKSamplingRequest) => Promise<ADKSamplingResponse>;
2737
2768
 
2738
2769
  declare class McpClientService {
2739
2770
  private config;
2740
2771
  private client;
2741
2772
  private transport;
2742
2773
  private isClosing;
2743
- private samplingHandler;
2774
+ private mcpSamplingHandler;
2744
2775
  private logger;
2745
2776
  constructor(config: McpConfig);
2746
2777
  /**
@@ -2777,7 +2808,13 @@ declare class McpClientService {
2777
2808
  */
2778
2809
  isConnected(): boolean;
2779
2810
  private setupSamplingHandler;
2780
- setSamplingHandler(handler: SamplingHandler): void;
2811
+ /**
2812
+ * Set an ADK sampling handler
2813
+ */
2814
+ setSamplingHandler(handler: ADKSamplingHandler): void;
2815
+ /**
2816
+ * Remove the sampling handler
2817
+ */
2781
2818
  removeSamplingHandler(): void;
2782
2819
  }
2783
2820
 
@@ -2886,7 +2923,6 @@ declare const index$2_McpErrorType: typeof McpErrorType;
2886
2923
  type index$2_McpToolset = McpToolset;
2887
2924
  declare const index$2_McpToolset: typeof McpToolset;
2888
2925
  type index$2_McpTransportType = McpTransportType;
2889
- type index$2_SamplingHandler = SamplingHandler;
2890
2926
  type index$2_SamplingRequest = SamplingRequest;
2891
2927
  type index$2_SamplingResponse = SamplingResponse;
2892
2928
  type index$2_ToolConfig = ToolConfig;
@@ -2904,7 +2940,7 @@ declare const index$2_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
2904
2940
  declare const index$2_mcpSchemaToParameters: typeof mcpSchemaToParameters;
2905
2941
  declare const index$2_normalizeJsonSchema: typeof normalizeJsonSchema;
2906
2942
  declare namespace index$2 {
2907
- export { index$2_BaseTool as BaseTool, type index$2_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, index$2_ExitLoopTool as ExitLoopTool, index$2_FileOperationsTool as FileOperationsTool, index$2_FunctionTool as FunctionTool, index$2_GetUserChoiceTool as GetUserChoiceTool, index$2_GoogleSearch as GoogleSearch, index$2_HttpRequestTool as HttpRequestTool, type index$2_IToolContext as IToolContext, index$2_LoadMemoryTool as LoadMemoryTool, type index$2_McpConfig as McpConfig, index$2_McpError as McpError, index$2_McpErrorType as McpErrorType, index$2_McpToolset as McpToolset, type index$2_McpTransportType as McpTransportType, type index$2_SamplingHandler as SamplingHandler, type index$2_SamplingRequest as SamplingRequest, type index$2_SamplingResponse as SamplingResponse, type index$2_ToolConfig as ToolConfig, index$2_ToolContext as ToolContext, index$2_TransferToAgentTool as TransferToAgentTool, index$2_UserInteractionTool as UserInteractionTool, index$2_adkToMcpToolType as adkToMcpToolType, index$2_buildFunctionDeclaration as buildFunctionDeclaration, index$2_createFunctionTool as createFunctionTool, index$2_getMcpTools as getMcpTools, index$2_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$2_mcpSchemaToParameters as mcpSchemaToParameters, index$2_normalizeJsonSchema as normalizeJsonSchema };
2943
+ export { index$2_BaseTool as BaseTool, type index$2_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, index$2_ExitLoopTool as ExitLoopTool, index$2_FileOperationsTool as FileOperationsTool, index$2_FunctionTool as FunctionTool, index$2_GetUserChoiceTool as GetUserChoiceTool, index$2_GoogleSearch as GoogleSearch, index$2_HttpRequestTool as HttpRequestTool, type index$2_IToolContext as IToolContext, index$2_LoadMemoryTool as LoadMemoryTool, type index$2_McpConfig as McpConfig, index$2_McpError as McpError, index$2_McpErrorType as McpErrorType, index$2_McpToolset as McpToolset, type index$2_McpTransportType as McpTransportType, type index$2_SamplingRequest as SamplingRequest, type index$2_SamplingResponse as SamplingResponse, type index$2_ToolConfig as ToolConfig, index$2_ToolContext as ToolContext, index$2_TransferToAgentTool as TransferToAgentTool, index$2_UserInteractionTool as UserInteractionTool, index$2_adkToMcpToolType as adkToMcpToolType, index$2_buildFunctionDeclaration as buildFunctionDeclaration, index$2_createFunctionTool as createFunctionTool, index$2_getMcpTools as getMcpTools, index$2_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$2_mcpSchemaToParameters as mcpSchemaToParameters, index$2_normalizeJsonSchema as normalizeJsonSchema };
2908
2944
  }
2909
2945
 
2910
2946
  /**
@@ -3463,4 +3499,4 @@ declare class InMemoryRunner extends Runner {
3463
3499
 
3464
3500
  declare const VERSION = "0.1.0";
3465
3501
 
3466
- export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingHandler, type SamplingRequest, type SamplingResponse, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, validateSession };
3502
+ export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingRequest, type SamplingResponse, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, validateSession };