---
id: gk-block-mcp-agent-remove-on-uninstall
title: "Filter - gk/block-mcp/agent/remove-on-uninstall"
sidebar_label: "gk/block-mcp/agent/remove-on-uninstall"
tags:
  - "2.0.0"
---

# Filter: gk/block-mcp/agent/remove-on-uninstall

Keep the AI agent account alive across an uninstall/reinstall cycle.

On uninstall the plugin cleans up after itself: it deletes the agent user, revokes its credentials, and removes the custom role. Return false to preserve that account instead — ideal when you provision credentials out-of-band, ship the agent as part of a fleet image, or simply don't want a temporary deactivation to force every connected client to reconnect.

## Parameters

| Name | Type | Description |
|------|------|-------------|
| $remove | `bool` | Whether to remove the agent on uninstall. Default true. |

## Example

// Survive reinstalls so connected clients keep working.

```php
add_filter( 'gk/block-mcp/agent/remove-on-uninstall', '__return_false' );
```

### Since

- [2.0.0](../../since/2-0-0/)

### Source

Defined in `wordpress-plugin/gk-block-api/includes/class-agent-provisioner.php` at line 328

