Modified tools directory to be more generic, updated serializer and executor accordingly

This commit is contained in:
Waleed Latif
2025-01-17 19:08:40 -08:00
parent 85a2528e4d
commit 07cb295200
30 changed files with 1234 additions and 1194 deletions
+20 -3
View File
@@ -1,7 +1,24 @@
export interface Tool {
export interface Tool<P = any, R = any> {
id: string;
name: string;
execute(params: Record<string, any>): Promise<Record<string, any>>;
validateParams(params: Record<string, any>): boolean | string;
description: string;
version: string;
params: {
[key: string]: {
type: string;
required?: boolean;
description?: string;
default?: any;
};
};
request: {
url: string | ((params: P) => string);
method: string;
headers: (params: P) => Record<string, string>;
body?: (params: P) => Record<string, any>;
};
transformResponse: (response: any) => R;
transformError: (error: any) => string;
}
export interface ToolRegistry {