Skip to main content

Generate code (AI)

droost_ai_generate Write (ungated)

Module: Droost AI

Bridges to the site's configured drupal/ai chat provider (this recipe wires a local Ollama when present) for one-shot text generation with site context. Use it for content drafts inside a build; it degrades honestly when no provider is configured.

Example call
{
    "tool": "droost_ai_generate",
    "arguments": {
        "prompt": "One sentence on why deterministic tools beat prompting for site building."
    }
}
Example response — captured live on this site
{
    "success": false,
    "message": "No default chat provider is configured for the AI module. Configure one at /admin/config/ai/settings.",
    "data": null
}

Generate Drupal code from a natural-language prompt using the configured AI provider, guided by Droost conventions.

Input schema (JSON Schema)
{
    "type": "object",
    "properties": {
        "prompt": {
            "type": "string",
            "description": "What to generate (e.g. \"an event subscriber for kernel.request that redirects /old to /new\")."
        },
        "context": {
            "type": "string",
            "description": "Optional extra context (existing code, constraints)."
        }
    },
    "required": [
        "prompt"
    ]
}