Skip to main content

Droost: Evaluate PHP

droost_eval Eval (gated)

Module: Droost core

Arbitrary PHP against the booted site — the last resort when no tool fits, and the only tool behind the separate allow_eval flag. If you reach for it often, that is a missing-tool signal worth reporting.

Example call
{
    "tool": "droost_eval",
    "arguments": {
        "code": "return \\Drupal::VERSION;"
    }
}
Example response — captured live on this site
{
    "success": false,
    "message": "This tool is disabled. Enable it with: drush config:set droost.settings allow_eval true (or via Admin → Configuration → Development → Droost), then reload the MCP server in your editor — the running server caches this flag at startup and will keep refusing until it is restarted. (To disable later, use --input-format=yaml false so the value is stored as a real boolean.)",
    "data": null
}

Executes PHP in the bootstrapped Drupal context (like "drush php:eval") and returns its output and return value. Disabled by default; requires droost.settings.allow_eval. High risk — trusted local development only.

Input schema (JSON Schema)
{
    "type": "object",
    "properties": {
        "code": {
            "type": "string",
            "description": "PHP to evaluate, e.g. \"return \\Drupal::service('state')->get('system.cron_last');\"."
        }
    },
    "required": [
        "code"
    ]
}