# Validate

Checks the agent: required configuration (errors block publishing), recommendations, AI provider, reply allowance, knowledge imports, expired links, website embeds and tool failures.

|  |  |
| --- | --- |
| REST | `POST /api/v1/agents/{agent_id}/validate` |
| MCP tool | `validate_agent` |
| Classification | **Read** (changes nothing) |
| Scope | `agents:read` |
| Minimum role on the agent | editor |
| Confirmation | Not needed |
| Retry safety | Safe to retry with the same input |
| Success status | 200 |

## What it does

Checks the agent: required configuration (errors block publishing), recommendations, AI provider, reply allowance, knowledge imports, expired links, website embeds and tool failures. Each problem says how to fix it.

## Side effects

None. It only reads.

## Inputs

| Name | Type | Required | In | Description |
| --- | --- | --- | --- | --- |
| `agent_id` | string | yes | path | The agent id (agt_...), from list_agents. |

## Example

REST:

```bash
curl -X POST "https://covo.lanaai.io/api/v1/agents/agt_4edc89bb2964/validate" \
  -H "Authorization: Bearer $COVO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

MCP (POST /mcp):

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "validate_agent",
    "arguments": {
      "agent_id": "agt_4edc89bb2964"
    }
  }
}
```

## Response

Returns an object with `valid`, `state`, `errors`, `warnings` and `checks`. This is a real response, shortened to two items per list.

200 response:

```json
{
  "valid": true,
  "state": "ready",
  "errors": [],
  "warnings": [
    {
      "step": "knowledge",
      "field": null,
      "severity": "recommended",
      "message": "Add a few common questions. Short, specific answers work best."
    },
    {
      "step": "publish",
      "field": null,
      "severity": "recommended",
      "message": "Ask the preview a question before you publish."
    }
  ],
  "checks": [
    {
      "name": "ai_provider",
      "status": "pass",
      "message": "The AI provider is configured."
    },
    {
      "name": "reply_allowance",
      "status": "pass",
      "message": "3000 AI replies left this month."
    }
  ]
}
```

Over MCP the same object comes back as the tool result, in `structuredContent` and as JSON text.

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | No token, or it is unknown, revoked or expired. OAuth apps refresh or reconnect. |
| 403 | `account_suspended` | The account that owns the token is paused. |
| 403 | `insufficient_scope` | The token lacks `agents:read`. |
| 404 | `agent_not_found` | Unknown agent, or not reachable with this token. |
| 400 | `bad_request` | An input is invalid; `field` names it. |
| 429 | `rate_limited` | Wait `Retry-After` seconds. |
