File size: 651 Bytes
e67ab0e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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: .`;
}
|