# willo_deploy_function

> Create or replace one of the business's backend Edge Functions (Deno), exactly as Willo's chat does: code is the full source…

Generated from Willo's code at each release.

Source: https://www.willo.ai/docs/reference/mcp-tools/willo_deploy_function

**Deploy an Edge Function.** Create or replace one of the business's backend Edge Functions (Deno), exactly as Willo's chat does: `code` is the full source, or `source_path` deploys `supabase/functions/<name>/index.ts` from the repo at the draft branch. Runs without a card like in chat, EXCEPT a function with admin powers and no caller check: that is refused until you pass `public_admin_reason`, and then it needs a person's approval (`pending_approval` + link; call again after). Deploys to the draft backend while drafting, and saves the source to the repo (the `draft` branch while drafting, else `main`; `git` in the result says which) — no site rebuild. Replacing an EXISTING function with `code` needs `source_sha256`: the value willo_get_function returned, so you never overwrite source you have not read (a stale one is refused; for a targeted change prefer willo_edit_function). `summary` is required: one plain sentence for the owner on what the function does for them.

## Access

- **Token**: read + act, and editor access or higher on the business.
- **Approval**: Only when Willo's chat would stop for the same action. The description says when; otherwise the call runs at once.
- **Metered**: counts toward a per-business, per-minute limit for this kind of call. See [Limits](https://www.willo.ai/docs/reference/limits).

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Function slug: ^[A-Za-z][A-Za-z0-9_-]*$ — becomes /functions/v1/<name>. |
| `code` | string | no | Full Deno source. Omit when passing source_path. |
| `source_sha256` | string | no | Required when `code` replaces an existing function: source_sha256 from willo_get_function for the version you read. Omit for a new function. |
| `source_path` | string | no | Exactly `supabase/functions/<name>/index.ts` — deploy the repo's file (draft branch) instead of sending code. |
| `verify_jwt` | boolean | no | Default true. false for public webhooks that verify a signature themselves. A `source_path` redeploy of an existing function keeps its current setting unless you pass this. |
| `import_map` | string | no | Optional Deno import map (JSON string). |
| `summary` | string | yes | One plain sentence for the owner: what this does for them. |
| `public_admin_reason` | string | no | Only after a refusal naming it: one sentence on why this endpoint must be public AND run with admin powers. Puts the deploy on a card. |
| `ephemeral` | boolean | no | true for test/seed scaffolding removed after ephemeral_hours and never published. |
| `ephemeral_hours` | integer 1–168 | no | Lifetime of an ephemeral function (default 24). |

## Related

- [All MCP tools](https://www.willo.ai/docs/reference/mcp-tools)
- [Error codes](https://www.willo.ai/docs/reference/errors)
- [Draft and live](https://www.willo.ai/docs/ai-agents/draft-and-live)
