generate_text
Generate scripts, storyboards, song lyrics, or marketing copy using Gemini AI. Provide a prompt and optional settings for creativity and length.
Instructions
Generate text content using Gemini AI.
Create scripts, storyboards, song lyrics, marketing copy, and more. Powered by Google Gemini. Cost: ~2 credits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | What to generate (e.g., "Write a 30-second ad script for a coffee brand") | |
| sub_mode | No | Generation mode — "script" (video/ad scripts), "storyboard" (visual scene descriptions), or "lyrics" (song lyrics) | script |
| temperature | No | Creativity level (0.0 = focused, 1.0 = creative, default 0.7) | |
| max_tokens | No | Maximum output length (default 2048) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/yaparai/tools/ai.py:8-36 (handler)The main handler function for the 'generate_text' tool. It accepts parameters (prompt, sub_mode, temperature, max_tokens), creates a YaparAIClient, and delegates to client.gemini_generate().
async def generate_text( prompt: str, sub_mode: str = "script", temperature: float = 0.7, max_tokens: int = 2048, ) -> dict: """ Generate text content using Gemini AI. Create scripts, storyboards, song lyrics, marketing copy, and more. Powered by Google Gemini. Cost: ~2 credits. Args: prompt: What to generate (e.g., "Write a 30-second ad script for a coffee brand") sub_mode: Generation mode — "script" (video/ad scripts), "storyboard" (visual scene descriptions), or "lyrics" (song lyrics) temperature: Creativity level (0.0 = focused, 1.0 = creative, default 0.7) max_tokens: Maximum output length (default 2048) Returns: Dict with generated text content. """ client = YaparAIClient() return await client.gemini_generate({ "prompt": prompt, "sub_mode": sub_mode, "temperature": temperature, "max_tokens": max_tokens, }) - src/yaparai/server.py:55-58 (registration)Imports the generate_text function from the ai tools module.
from yaparai.tools.ai import ( generate_text, analyze_image, ) - src/yaparai/server.py:146-146 (registration)Registers generate_text as an MCP tool via mcp.tool(generate_text).
mcp.tool(generate_text) - src/yaparai/tools/ai.py:1-6 (schema)Type annotations in the function signature (prompt: str, sub_mode: str = 'script', temperature: float = 0.7, max_tokens: int = 2048) serve as the input schema for the tool.
"""AI tools — text generation, image analysis.""" from __future__ import annotations from yaparai.client import YaparAIClient