@iqai/adk 0.1.10 → 0.1.11
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 +6 -0
- package/dist/index.d.mts +52 -5
- package/dist/index.d.ts +52 -5
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -908,7 +908,26 @@ declare abstract class BaseTool {
|
|
|
908
908
|
/**
|
|
909
909
|
* Configuration for creating a tool
|
|
910
910
|
*/
|
|
911
|
-
interface CreateToolConfig<T extends Record<string, any>> {
|
|
911
|
+
interface CreateToolConfig<T extends Record<string, any> = Record<string, never>> {
|
|
912
|
+
/** The name of the tool */
|
|
913
|
+
name: string;
|
|
914
|
+
/** A description of what the tool does */
|
|
915
|
+
description: string;
|
|
916
|
+
/** Zod schema for validating tool arguments (optional) */
|
|
917
|
+
schema?: z.ZodSchema<T>;
|
|
918
|
+
/** The function to execute (can be sync or async) */
|
|
919
|
+
fn: (args: T, context?: ToolContext) => any;
|
|
920
|
+
/** Whether the tool is a long running operation */
|
|
921
|
+
isLongRunning?: boolean;
|
|
922
|
+
/** Whether the tool execution should be retried on failure */
|
|
923
|
+
shouldRetryOnFailure?: boolean;
|
|
924
|
+
/** Maximum retry attempts */
|
|
925
|
+
maxRetryAttempts?: number;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Configuration for creating a tool with schema
|
|
929
|
+
*/
|
|
930
|
+
interface CreateToolConfigWithSchema<T extends Record<string, any>> {
|
|
912
931
|
/** The name of the tool */
|
|
913
932
|
name: string;
|
|
914
933
|
/** A description of what the tool does */
|
|
@@ -924,6 +943,23 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
924
943
|
/** Maximum retry attempts */
|
|
925
944
|
maxRetryAttempts?: number;
|
|
926
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Configuration for creating a tool without schema (no parameters)
|
|
948
|
+
*/
|
|
949
|
+
interface CreateToolConfigWithoutSchema {
|
|
950
|
+
/** The name of the tool */
|
|
951
|
+
name: string;
|
|
952
|
+
/** A description of what the tool does */
|
|
953
|
+
description: string;
|
|
954
|
+
/** The function to execute (can be sync or async) */
|
|
955
|
+
fn: (args: Record<string, never>, context?: ToolContext) => any;
|
|
956
|
+
/** Whether the tool is a long running operation */
|
|
957
|
+
isLongRunning?: boolean;
|
|
958
|
+
/** Whether the tool execution should be retried on failure */
|
|
959
|
+
shouldRetryOnFailure?: boolean;
|
|
960
|
+
/** Maximum retry attempts */
|
|
961
|
+
maxRetryAttempts?: number;
|
|
962
|
+
}
|
|
927
963
|
/**
|
|
928
964
|
* Creates a tool from a configuration object.
|
|
929
965
|
*
|
|
@@ -942,6 +978,7 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
942
978
|
* import { createTool } from '@iqai/adk';
|
|
943
979
|
* import { z } from 'zod';
|
|
944
980
|
*
|
|
981
|
+
* // Tool with parameters
|
|
945
982
|
* const calculatorTool = createTool({
|
|
946
983
|
* name: 'calculator',
|
|
947
984
|
* description: 'Performs basic arithmetic operations',
|
|
@@ -960,9 +997,17 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
960
997
|
* }
|
|
961
998
|
* }
|
|
962
999
|
* });
|
|
1000
|
+
*
|
|
1001
|
+
* // Tool without parameters (schema is optional)
|
|
1002
|
+
* const timestampTool = createTool({
|
|
1003
|
+
* name: 'timestamp',
|
|
1004
|
+
* description: 'Gets the current timestamp',
|
|
1005
|
+
* fn: () => ({ timestamp: Date.now() })
|
|
1006
|
+
* });
|
|
963
1007
|
* ```
|
|
964
1008
|
*/
|
|
965
|
-
declare function createTool<T extends Record<string, any>>(config:
|
|
1009
|
+
declare function createTool<T extends Record<string, any>>(config: CreateToolConfigWithSchema<T>): BaseTool;
|
|
1010
|
+
declare function createTool(config: CreateToolConfigWithoutSchema): BaseTool;
|
|
966
1011
|
|
|
967
1012
|
/**
|
|
968
1013
|
* A tool that wraps a user-defined TypeScript function.
|
|
@@ -1812,7 +1857,9 @@ declare function getMcpTools(config: McpConfig, toolFilter?: string[] | ((tool:
|
|
|
1812
1857
|
type index$6_BaseTool = BaseTool;
|
|
1813
1858
|
declare const index$6_BaseTool: typeof BaseTool;
|
|
1814
1859
|
type index$6_BuildFunctionDeclarationOptions = BuildFunctionDeclarationOptions;
|
|
1815
|
-
type index$6_CreateToolConfig<T extends Record<string, any>> = CreateToolConfig<T>;
|
|
1860
|
+
type index$6_CreateToolConfig<T extends Record<string, any> = Record<string, never>> = CreateToolConfig<T>;
|
|
1861
|
+
type index$6_CreateToolConfigWithSchema<T extends Record<string, any>> = CreateToolConfigWithSchema<T>;
|
|
1862
|
+
type index$6_CreateToolConfigWithoutSchema = CreateToolConfigWithoutSchema;
|
|
1816
1863
|
type index$6_ExitLoopTool = ExitLoopTool;
|
|
1817
1864
|
declare const index$6_ExitLoopTool: typeof ExitLoopTool;
|
|
1818
1865
|
type index$6_FileOperationsTool = FileOperationsTool;
|
|
@@ -1874,7 +1921,7 @@ declare const index$6_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
|
|
|
1874
1921
|
declare const index$6_mcpSchemaToParameters: typeof mcpSchemaToParameters;
|
|
1875
1922
|
declare const index$6_normalizeJsonSchema: typeof normalizeJsonSchema;
|
|
1876
1923
|
declare namespace index$6 {
|
|
1877
|
-
export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntentSwaps as McpNearIntentSwaps, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
|
|
1924
|
+
export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, type index$6_CreateToolConfigWithSchema as CreateToolConfigWithSchema, type index$6_CreateToolConfigWithoutSchema as CreateToolConfigWithoutSchema, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntentSwaps as McpNearIntentSwaps, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
|
|
1878
1925
|
}
|
|
1879
1926
|
|
|
1880
1927
|
/**
|
|
@@ -5044,4 +5091,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
|
|
|
5044
5091
|
|
|
5045
5092
|
declare const VERSION = "0.1.0";
|
|
5046
5093
|
|
|
5047
|
-
export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, type FunctionDeclaration, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, type JSONSchema, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntentSwaps, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionConfig, index$2 as Sessions, type SingleAgentCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type ThinkingConfig, type ToolConfig, ToolContext, type ToolUnion, index$6 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
|
|
5094
|
+
export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, type CreateToolConfigWithSchema, type CreateToolConfigWithoutSchema, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, type FunctionDeclaration, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, type JSONSchema, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntentSwaps, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionConfig, index$2 as Sessions, type SingleAgentCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type ThinkingConfig, type ToolConfig, ToolContext, type ToolUnion, index$6 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
|
package/dist/index.d.ts
CHANGED
|
@@ -908,7 +908,26 @@ declare abstract class BaseTool {
|
|
|
908
908
|
/**
|
|
909
909
|
* Configuration for creating a tool
|
|
910
910
|
*/
|
|
911
|
-
interface CreateToolConfig<T extends Record<string, any>> {
|
|
911
|
+
interface CreateToolConfig<T extends Record<string, any> = Record<string, never>> {
|
|
912
|
+
/** The name of the tool */
|
|
913
|
+
name: string;
|
|
914
|
+
/** A description of what the tool does */
|
|
915
|
+
description: string;
|
|
916
|
+
/** Zod schema for validating tool arguments (optional) */
|
|
917
|
+
schema?: z.ZodSchema<T>;
|
|
918
|
+
/** The function to execute (can be sync or async) */
|
|
919
|
+
fn: (args: T, context?: ToolContext) => any;
|
|
920
|
+
/** Whether the tool is a long running operation */
|
|
921
|
+
isLongRunning?: boolean;
|
|
922
|
+
/** Whether the tool execution should be retried on failure */
|
|
923
|
+
shouldRetryOnFailure?: boolean;
|
|
924
|
+
/** Maximum retry attempts */
|
|
925
|
+
maxRetryAttempts?: number;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Configuration for creating a tool with schema
|
|
929
|
+
*/
|
|
930
|
+
interface CreateToolConfigWithSchema<T extends Record<string, any>> {
|
|
912
931
|
/** The name of the tool */
|
|
913
932
|
name: string;
|
|
914
933
|
/** A description of what the tool does */
|
|
@@ -924,6 +943,23 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
924
943
|
/** Maximum retry attempts */
|
|
925
944
|
maxRetryAttempts?: number;
|
|
926
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Configuration for creating a tool without schema (no parameters)
|
|
948
|
+
*/
|
|
949
|
+
interface CreateToolConfigWithoutSchema {
|
|
950
|
+
/** The name of the tool */
|
|
951
|
+
name: string;
|
|
952
|
+
/** A description of what the tool does */
|
|
953
|
+
description: string;
|
|
954
|
+
/** The function to execute (can be sync or async) */
|
|
955
|
+
fn: (args: Record<string, never>, context?: ToolContext) => any;
|
|
956
|
+
/** Whether the tool is a long running operation */
|
|
957
|
+
isLongRunning?: boolean;
|
|
958
|
+
/** Whether the tool execution should be retried on failure */
|
|
959
|
+
shouldRetryOnFailure?: boolean;
|
|
960
|
+
/** Maximum retry attempts */
|
|
961
|
+
maxRetryAttempts?: number;
|
|
962
|
+
}
|
|
927
963
|
/**
|
|
928
964
|
* Creates a tool from a configuration object.
|
|
929
965
|
*
|
|
@@ -942,6 +978,7 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
942
978
|
* import { createTool } from '@iqai/adk';
|
|
943
979
|
* import { z } from 'zod';
|
|
944
980
|
*
|
|
981
|
+
* // Tool with parameters
|
|
945
982
|
* const calculatorTool = createTool({
|
|
946
983
|
* name: 'calculator',
|
|
947
984
|
* description: 'Performs basic arithmetic operations',
|
|
@@ -960,9 +997,17 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
960
997
|
* }
|
|
961
998
|
* }
|
|
962
999
|
* });
|
|
1000
|
+
*
|
|
1001
|
+
* // Tool without parameters (schema is optional)
|
|
1002
|
+
* const timestampTool = createTool({
|
|
1003
|
+
* name: 'timestamp',
|
|
1004
|
+
* description: 'Gets the current timestamp',
|
|
1005
|
+
* fn: () => ({ timestamp: Date.now() })
|
|
1006
|
+
* });
|
|
963
1007
|
* ```
|
|
964
1008
|
*/
|
|
965
|
-
declare function createTool<T extends Record<string, any>>(config:
|
|
1009
|
+
declare function createTool<T extends Record<string, any>>(config: CreateToolConfigWithSchema<T>): BaseTool;
|
|
1010
|
+
declare function createTool(config: CreateToolConfigWithoutSchema): BaseTool;
|
|
966
1011
|
|
|
967
1012
|
/**
|
|
968
1013
|
* A tool that wraps a user-defined TypeScript function.
|
|
@@ -1812,7 +1857,9 @@ declare function getMcpTools(config: McpConfig, toolFilter?: string[] | ((tool:
|
|
|
1812
1857
|
type index$6_BaseTool = BaseTool;
|
|
1813
1858
|
declare const index$6_BaseTool: typeof BaseTool;
|
|
1814
1859
|
type index$6_BuildFunctionDeclarationOptions = BuildFunctionDeclarationOptions;
|
|
1815
|
-
type index$6_CreateToolConfig<T extends Record<string, any>> = CreateToolConfig<T>;
|
|
1860
|
+
type index$6_CreateToolConfig<T extends Record<string, any> = Record<string, never>> = CreateToolConfig<T>;
|
|
1861
|
+
type index$6_CreateToolConfigWithSchema<T extends Record<string, any>> = CreateToolConfigWithSchema<T>;
|
|
1862
|
+
type index$6_CreateToolConfigWithoutSchema = CreateToolConfigWithoutSchema;
|
|
1816
1863
|
type index$6_ExitLoopTool = ExitLoopTool;
|
|
1817
1864
|
declare const index$6_ExitLoopTool: typeof ExitLoopTool;
|
|
1818
1865
|
type index$6_FileOperationsTool = FileOperationsTool;
|
|
@@ -1874,7 +1921,7 @@ declare const index$6_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
|
|
|
1874
1921
|
declare const index$6_mcpSchemaToParameters: typeof mcpSchemaToParameters;
|
|
1875
1922
|
declare const index$6_normalizeJsonSchema: typeof normalizeJsonSchema;
|
|
1876
1923
|
declare namespace index$6 {
|
|
1877
|
-
export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntentSwaps as McpNearIntentSwaps, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
|
|
1924
|
+
export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, type index$6_CreateToolConfigWithSchema as CreateToolConfigWithSchema, type index$6_CreateToolConfigWithoutSchema as CreateToolConfigWithoutSchema, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntentSwaps as McpNearIntentSwaps, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
|
|
1878
1925
|
}
|
|
1879
1926
|
|
|
1880
1927
|
/**
|
|
@@ -5044,4 +5091,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
|
|
|
5044
5091
|
|
|
5045
5092
|
declare const VERSION = "0.1.0";
|
|
5046
5093
|
|
|
5047
|
-
export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, type FunctionDeclaration, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, type JSONSchema, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntentSwaps, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionConfig, index$2 as Sessions, type SingleAgentCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type ThinkingConfig, type ToolConfig, ToolContext, type ToolUnion, index$6 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
|
|
5094
|
+
export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, type CreateToolConfigWithSchema, type CreateToolConfigWithoutSchema, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, type FunctionDeclaration, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, type JSONSchema, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntentSwaps, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionConfig, index$2 as Sessions, type SingleAgentCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type ThinkingConfig, type ToolConfig, ToolContext, type ToolUnion, index$6 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
|
package/dist/index.js
CHANGED
|
@@ -3879,7 +3879,7 @@ var CreatedTool = class extends BaseTool {
|
|
|
3879
3879
|
maxRetryAttempts: _nullishCoalesce(config.maxRetryAttempts, () => ( 3))
|
|
3880
3880
|
});
|
|
3881
3881
|
this.func = config.fn;
|
|
3882
|
-
this.schema = config.schema;
|
|
3882
|
+
this.schema = _nullishCoalesce(config.schema, () => ( z.object({})));
|
|
3883
3883
|
this.functionDeclaration = this.buildDeclaration();
|
|
3884
3884
|
}
|
|
3885
3885
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -3879,7 +3879,7 @@ var CreatedTool = class extends BaseTool {
|
|
|
3879
3879
|
maxRetryAttempts: config.maxRetryAttempts ?? 3
|
|
3880
3880
|
});
|
|
3881
3881
|
this.func = config.fn;
|
|
3882
|
-
this.schema = config.schema;
|
|
3882
|
+
this.schema = config.schema ?? z.object({});
|
|
3883
3883
|
this.functionDeclaration = this.buildDeclaration();
|
|
3884
3884
|
}
|
|
3885
3885
|
/**
|