UNPKG

mcp-daily-tasks

Version:

MCP para manejar tareas y resúmenes con integración ClickUp.

30 lines (26 loc) 888 B
export async function generateGeminiResponse(prompt: string): Promise<string | null> { const apiKey = process.env.GOOGLE_GEMINI_API_KEY; if (!apiKey) return null; const url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=" + apiKey; try { const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ contents: [ { parts: [{ text: prompt }] } ] }) }); if (!response.ok) { throw new Error(`Google Gemini API error: ${response.statusText}`); } const data = await response.json(); return data?.candidates?.[0]?.content?.parts?.[0]?.text || null; } catch (error) { console.error("Error calling Gemini API:", error); return null; } }