| import type { OpenAiTool } from "$lib/server/mcp/tools"; | |
| export function buildToolPreprompt(tools: OpenAiTool[]): string { | |
| if (!Array.isArray(tools) || tools.length === 0) return ""; | |
| const names = tools | |
| .map((t) => (t?.function?.name ? String(t.function.name) : "")) | |
| .filter((s) => s.length > 0); | |
| if (names.length === 0) return ""; | |
| const currentDate = new Date().toLocaleDateString("en-US", { | |
| year: "numeric", | |
| month: "long", | |
| day: "numeric", | |
| }); | |
| return `You can use the following tools if helpful: ${names.join(", ")}. Today's date: ${currentDate}. If a tool generates an image, you can inline it directly: .`; | |
| } | |