optimize_prompt
Refines prompts for 58+ AI platforms by analyzing intent and platform capabilities, automatically selecting the optimal category and output mode.
Instructions
Optimize a prompt for a specific AI platform. Context-aware: auto-gathers workspace signals (CLAUDE.md / AGENTS.md / .cursorrules / package.json), resolves intent + category + recommended mode in a single analysis step, shapes the system prompt to the target model's capabilities, and grounds the rewrite in a priority-ordered Grounding Context. Supports 58+ platforms across 7 categories, plus custom registered platforms. Category, platform, and mode are all optional — the engine chooses sane defaults from the analysis.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | The prompt to optimize | |
| category | No | Prompt category. Auto-detected via the analyzer when omitted. When provided, the analyzer can still override if it's confident the hint is wrong. | |
| platform | No | Target platform ID (e.g. midjourney, dall-e, sora, suno, claude, cursor, or a custom platform ID). Uses category default when omitted. | |
| mode | No | Output mode. When omitted, the engine uses the analyzer's intent-derived recommendation (e.g. production-code → technical, quick-draft → concise). When passed, user choice wins. | |
| enrich_context | No | Use web search for context enrichment (Tavily/Brave/Serper/SerpAPI/Exa/SearXNG). Results merge into the single Grounding Context block. | |
| session_id | No | Session ID to stitch related optimizations so the engine can reuse accepted prior outputs as few-shot examples. Auto-generated when omitted. | |
| file_path | No | Active file path — infers language and grounds the rewrite | |
| file_language | No | Explicit language override for the active file | |
| file_excerpt | No | Short excerpt (≤2 KB) of the active file to ground the rewrite | |
| cwd | No | Working directory to scan for CLAUDE.md / AGENTS.md / .cursorrules / package.json. Defaults to server cwd. | |
| user_locale | No | User locale hint (e.g. en-US, ar-EG) | |
| user_pinned_instructions | No | Pinned, always-applied user instructions (highest-priority grounding) | |
| include_bundle | No | Include the full resolved ContextBundle in the response (same shape as inspect_context returns) | |
| skip_intent_resolution | No | Skip the analyzer LLM call (faster; loses intent/category/mode recommendations) |