-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
31 lines (27 loc) · 1.14 KB
/
Copy pathindex.ts
File metadata and controls
31 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import type { ClientTool } from "@langchain/core/tools";
import { createFetchSkillTool } from "./fetchSkill.js";
import { createFetchToolSchemaTool } from "./fetchToolSchema.js";
import type { ApiBasedTool } from "./apiBasedTools.js";
import { createApiTool } from "./apiTool.js";
import { createGetUserLocationTool } from "./getUserLocation.js";
import { createNavigateUserTool } from "./navigateUser.js";
export const ALWAYS_AVAILABLE_API_TOOL_NAMES = ["get_resource"] as const;
export async function createAgentTools(
customComponentsDir: string,
apiBasedTools: Record<string, ApiBasedTool>,
pluginCustomFolderPaths: string[] = [],
): Promise<ClientTool[]> {
return [
...ALWAYS_AVAILABLE_API_TOOL_NAMES.map((toolName) => {
const apiBasedTool = apiBasedTools[toolName];
if (!apiBasedTool) {
throw new Error(`Required base API tool "${toolName}" is missing.`);
}
return createApiTool(toolName, apiBasedTool);
}),
createGetUserLocationTool(),
createNavigateUserTool(),
await createFetchSkillTool(customComponentsDir, pluginCustomFolderPaths),
await createFetchToolSchemaTool(apiBasedTools),
];
}