# delete_secret

URL: https://codepanel.ai/docs/mcp-server/delete_secret

The CodePanel MCP tool that removes an account-wide or repository-scoped Zero-Trust environment secret by name.

`delete_secret` removes a Zero-Trust environment secret by name (account-wide, or scoped to a specific `repo`). Needs the `tasks:write` scope.

## When to call it

- **When removing an obsolete or unused environment variable** from an account or repository.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Uppercase POSIX secret name, e.g. STRIPE_TEST_KEY |
| `repo` | string | no | Repository owner/name for a repo-scoped secret; omit for account-wide |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

## What it returns

`{ secret }`, the deleted secret's metadata (`id`, `name`, `scope`, `repo`, `updatedAt`).

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | `POST /autopilot/secrets/delete` with `tasks:write` scope |
| CLI | `codepanel env secret-delete NAME [--repo owner/name]` |
| Dashboard | Repository → Settings → Environment & Zero-Trust Secrets |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Use it to remove an unused Zero-Trust environment secret by name (account-wide, or scoped to repo). Needs the tasks:write scope. Returns { secret } metadata as it was.

## Related

- [`list_secrets`](/docs/mcp-server/list_secrets): list active Zero-Trust secret names.
- [`get_environment`](/docs/mcp-server/get_environment): inspect a repository's environment.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
