---
title: "corestack_function_run"
url: https://docs.corefinity.com/mcp/tools/corestack_function_run
type: tool
last_updated: 2026-11-13
feature: functions
related:
  - https://docs.corefinity.com/api/reference/sites/start-site-function.md
  - https://docs.corefinity.com/guides/sites/create-and-manage/platform-tools.md
---
# corestack_function_run

**Run a site function.** Run one of the environment's functions (corestack_function_catalogue_list lists them): pass its inputs and confirm: true where it asks. Long functions answer a task. An admin reset, admin create or login link shows its secret once. Scope: exec. Long-running: answers with a task. The secret opens in the person's browser; set reveal_to_agent to true to receive it yourself (needs exec).

- Scope: `exec`
- Runs as a task: yes
- Returns a secret only when `reveal_to_agent` is set

## When to use it

Run one of the environment's functions (corestack_function_catalogue_list lists them): pass its inputs and confirm: true where it asks. Long functions answer a task. An admin reset, admin create or login link shows its secret once.

A queued function's own outcome is on its command (corestack_command_get). For example, `magento_2fa_enable` fails without changing anything when another change already holds the site (a copy, an update that stopped part-way, a migration: release that hold first), or when the site's web traffic could not be held for the recompile (try again in a minute).

## Inputs

- `site_id` (integer, ≥ 1, required)
- `function` (string, 1–64 characters, required)
- `inputs` (object): The function's own inputs, as the catalogue lists them.
- `confirm` (boolean, default `false`)
- `reveal_to_agent` (boolean, default `false`): Return the secret to you instead of opening it in the person's browser. Needs exec.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "confirm": {
      "default": false,
      "type": "boolean"
    },
    "function": {
      "maxLength": 64,
      "minLength": 1,
      "type": "string"
    },
    "inputs": {
      "description": "The function's own inputs, as the catalogue lists them.",
      "type": "object"
    },
    "reveal_to_agent": {
      "default": false,
      "description": "Return the secret to you instead of opening it in the person's browser. Needs exec.",
      "type": "boolean"
    },
    "site_id": {
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "site_id",
    "function"
  ],
  "type": "object"
}
```

## Refusals

- `maintenance`: the site is in maintenance mode; turn it off first, or wait for the maintenance to end.
- `platform_plugins_off`: the function needs Corefinity's platform plugins (`wp_login_link`, "Log in to wp-admin"), which are turned off for this WordPress site; `corestack_site_platform_plugins_get` shows the setting and what else stops.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_function_run",
  "arguments": {
    "site_id": 4211,
    "function": "flush_cache"
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_function_run with site_id 4211, function flush_cache. (Run a site function.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/sites/{site}/functions/{function}](https://docs.corefinity.com/api/reference/sites/start-site-function.md)
- Guide: [Platform tools](https://docs.corefinity.com/guides/sites/create-and-manage/platform-tools.md)
