adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
247 lines (246 loc) • 5.98 kB
TypeScript
/**
* Tools module - Provides utility functions and interfaces for agent tools
*/
export * from './BaseTool';
export * from './FunctionTool';
export * from './AgentTool';
export * from './CrewaiTool';
export * from './ToolContext';
export * from './toolActions';
export * from './GoogleSearchTool';
export { googleSearch } from './GoogleSearchTool';
export * from './LoadWebPageTool';
export * from './LongRunningTool';
export * from './TransferToAgentTool';
export * from './ExitLoopTool';
export * from './LoadMemoryTool';
export * from './PreloadMemoryTool';
export * from './BuiltInCodeExecutionTool';
export * from './GetUserChoiceTool';
export * from './CodeExecutionTool';
export * from './ExampleTool';
export * from './VertexAISearchTool';
export * from './ToolboxTool';
export * from './LangchainTool';
export * from './mcp-tool';
export * from './google-api-tool';
export { OpenAPIToolset, RestApiTool } from './openapi-tool';
export * from './apihub-tool';
export * from './retrieval/BaseRetrievalTool';
export * from './retrieval/WebSearchTool';
/**
* Tool interface - base interface for all tools
*/
export interface Tool {
name: string;
description: string;
execute: (args: any) => Promise<any>;
[key: string]: any;
}
/**
* Tool categories collection
*/
export declare const Tools: {
/**
* Web-related tools
*/
web: {
/**
* Web search tool
*/
search: {
name: string;
description: string;
execute: (query: string) => Promise<any>;
};
/**
* Load web page tool
*/
loadPage: {
name: string;
description: string;
execute: (url: string) => Promise<any>;
};
};
/**
* File system related tools
*/
file: {
/**
* Read file tool
*/
read: {
name: string;
description: string;
execute: (filePath: string) => Promise<any>;
};
/**
* Write file tool
*/
write: {
name: string;
description: string;
execute: (args: {
filePath: string;
content: string;
}) => Promise<any>;
};
};
/**
* Agent control tools
*/
agent: {
/**
* Exit loop tool
*/
exitLoop: {
name: string;
description: string;
execute: () => Promise<any>;
};
/**
* Transfer to agent tool
*/
transferToAgent: {
name: string;
description: string;
execute: (agentName: string) => Promise<any>;
};
/**
* Get user choice tool
*/
getUserChoice: {
name: string;
description: string;
execute: (options: string[]) => Promise<any>;
};
};
/**
* Memory-related tools
*/
memory: {
/**
* Load memory tool
*/
loadMemory: {
name: string;
description: string;
execute: (query: string) => Promise<any>;
};
/**
* Preload memory tool
*/
preloadMemory: {
name: string;
description: string;
execute: () => Promise<any>;
};
};
/**
* Code-related tools
*/
code: {
/**
* Code execution tool (built-in)
*/
codeExecution: {
name: string;
description: string;
execute: () => Promise<any>;
};
/**
* Local code execution tool
*/
executeCode: {
name: string;
description: string;
execute: (params: {
language: string;
code: string;
}) => Promise<any>;
};
};
/**
* Instruction enhancement tools
*/
instruction: {
/**
* Example tool for few-shot learning
*/
examples: {
name: string;
description: string;
execute: (examples: any[]) => Promise<any>;
};
};
/**
* Vertex AI tools
*/
vertex: {
/**
* Vertex AI Search with Data Store
*/
searchWithDataStore: {
name: string;
description: string;
execute: (dataStoreId: string) => Promise<any>;
};
/**
* Vertex AI Search with Engine
*/
searchWithEngine: {
name: string;
description: string;
execute: (searchEngineId: string) => Promise<any>;
};
};
/**
* MCP tools
*/
mcp: {
/**
* Create an MCP toolset with stdio connection
*/
createStdioToolset: {
name: string;
description: string;
execute: (params: {
command: string;
args: string[];
}) => Promise<any>;
};
/**
* Create an MCP toolset with SSE connection
*/
createSseToolset: {
name: string;
description: string;
execute: (params: {
url: string;
headers?: Record<string, any>;
}) => Promise<any>;
};
};
};
/**
* Tool registry for managing custom tools
*/
export declare class ToolRegistry {
private tools;
/**
* Register a new tool
* @param tool The tool to register
*/
register(tool: Tool): void;
/**
* Get a tool by name
* @param name The name of the tool to retrieve
* @returns The tool if found, undefined otherwise
*/
get(name: string): Tool | undefined;
/**
* Get all registered tools
* @returns Array of all registered tools
*/
getAll(): Tool[];
}