{
  "formatVersion": 1,
  "publicationMode": "technical_reference",
  "server": {
    "name": "sysled-mcp",
    "version": "0.7.1"
  },
  "toolCount": 34,
  "maturity": "beta",
  "nativeValidation": "pending",
  "notice": "Referência técnica Beta. A validação nativa desta versão em Claude Desktop e ChatGPT web permanece pendente. Publicar a documentação não homologa a execução das ferramentas nem libera produção ou um Plugin público.",
  "scopes": [
    {
      "name": "mcp:read",
      "description": "Leituras de canais, contatos, conversas, fila e SLA, resolução de destinos, prévias, recibos e diagnóstico OAuth. Reconciliação de recibos pode persistir evidência sem enviar."
    },
    {
      "name": "mcp:write",
      "description": "Mutação WhatsApp e transições internas de conversa, sempre com confirmação humana específica. send_whatsapp e resolve/reopen/assign_conversation exigem também mcp:read; escrita não concede leitura implicitamente."
    },
    {
      "name": "bob:consult",
      "description": "Consultas Bob, resumos, rascunhos e avaliação consultiva de resolução. Resumos/rascunhos podem consumir IA e nunca enviam por si mesmos; requer identidade de usuário JWT/OAuth e permissão efetiva."
    }
  ],
  "tools": [
    {
      "name": "wa_health",
      "title": "Saúde e canais autorizados",
      "description": "Consulta saúde e canais autorizados. A disponibilidade de detalhes depende da forma de autenticação.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "channel_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          }
        },
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "ok",
          "authenticated",
          "instances"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "ok": {
            "type": "boolean"
          },
          "authenticated": {
            "const": true
          },
          "instances": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          }
        }
      },
      "parameters": {
        "channel_id": "UUID opcional do canal WhatsApp para incluir delivery-health (só modo JWT)"
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED"
      ]
    },
    {
      "name": "wa_list_chats",
      "title": "Listar conversas",
      "description": "Lista conversas com paginação. Alguns filtros dependem da forma de autenticação.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "q": {
            "type": "string",
            "maxLength": 8192,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "minimum": 1,
            "maximum": 200
          },
          "page": {
            "type": "integer",
            "default": 1,
            "minimum": 1,
            "maximum": 1000000
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "pending",
              "resolved",
              "archived"
            ],
            "maxLength": 8192
          },
          "channel_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "assignee_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "filter": {
            "type": "string",
            "maxLength": 8192
          }
        },
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "chats",
          "meta"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "chats": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unread_count": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "meta": {
            "type": "object",
            "required": [
              "total"
            ],
            "properties": {
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "total_count": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "page": {
                "type": "integer",
                "minimum": 1
              },
              "limit": {
                "type": "integer",
                "minimum": 1,
                "maximum": 200
              },
              "totalPages": {
                "type": "integer",
                "minimum": 0
              },
              "hasMore": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "next_page": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              }
            }
          }
        }
      },
      "parameters": {
        "q": "Busca por nome/telefone (JWT; ignorado no v1)",
        "limit": "Máximo de resultados (default 20)",
        "page": "Página (default 1)",
        "status": "Filtro por status da conversa",
        "channel_id": "UUID do canal",
        "assignee_id": "UUID do responsável (JWT; ignorado no v1)",
        "filter": "Filtro de inbox (JWT; ignorado no v1)"
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED"
      ]
    },
    {
      "name": "wa_get_chat",
      "title": "Ler uma conversa",
      "description": "Lê os dados de uma conversa à qual a identidade atual tem acesso.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "chat_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          }
        },
        "required": [
          "chat_id"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "chat"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "chat": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unread_count": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      },
      "parameters": {
        "chat_id": "UUID da conversa (conversation id)"
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED"
      ]
    },
    {
      "name": "wa_list_messages",
      "title": "Ler histórico paginado",
      "description": "Lê uma página do histórico. Reutilize next_cursor sem alteração para buscar mensagens anteriores.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "chat_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "limit": {
            "type": "integer",
            "default": 30,
            "minimum": 1,
            "maximum": 200
          },
          "before": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        },
        "required": [
          "chat_id"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "messages",
          "hasMore",
          "next_cursor",
          "total",
          "total_count"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "text": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "type": {
                  "type": "string"
                },
                "status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "media_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "hasMore": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 2048,
                "pattern": "^\\s*\\S[\\s\\S]*$"
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "total_count": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        }
      },
      "parameters": {
        "chat_id": "UUID da conversa",
        "limit": "Máximo de mensagens (default 30)",
        "before": "Cursor opaco next_cursor, ou UUID legado da mensagem. Passe sem modificar para buscar mensagens mais antigas."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED"
      ]
    },
    {
      "name": "wa_get_message_receipt",
      "title": "Consultar recibo sem reenviar",
      "description": "Lê passivamente a evidência de recibo já persistida. Não envia nem reenvia a mensagem.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "required": [
          "chat_id",
          "message_id"
        ],
        "properties": {
          "chat_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "message_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          }
        },
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "message",
          "receipt"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "message": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "media_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "receipt": {
            "type": "object",
            "required": [
              "message_id",
              "conversation_id",
              "accepted_by_provider",
              "delivered_to_whatsapp",
              "delivery_status",
              "provider_message_id",
              "delivered_at",
              "read_at"
            ],
            "properties": {
              "message_id": {
                "type": "string",
                "format": "uuid"
              },
              "conversation_id": {
                "type": "string",
                "format": "uuid"
              },
              "accepted_by_provider": {
                "type": "boolean"
              },
              "delivered_to_whatsapp": {
                "type": "boolean"
              },
              "delivery_status": {
                "enum": [
                  "sent",
                  "delivered",
                  "read",
                  "failed",
                  "unknown",
                  "not_applicable"
                ]
              },
              "provider_message_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "delivered_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "read_at": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "parameters": {
        "chat_id": "UUID da conversa autorizada",
        "message_id": "UUID da mensagem obtido no envio ou histórico"
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED"
      ]
    },
    {
      "name": "wa_start_chat",
      "title": "Abrir ou reabrir conversa",
      "description": "Abre ou reabre conversa; pode criar contato por telefone e enviar a mensagem inicial quando informada. Exige confirmação da ação inteira.",
      "effect": "mutation",
      "scopes": [
        "mcp:write"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": true,
        "idempotentHint": false,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "channel_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "contact_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "phone": {
            "type": "string",
            "maxLength": 8192,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "name": {
            "type": "string",
            "maxLength": 8192
          },
          "message": {
            "type": "string",
            "maxLength": 65536
          },
          "confirmed": {
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        },
        "required": [
          "channel_id",
          "confirmed",
          "idempotency_key"
        ],
        "anyOf": [
          {
            "required": [
              "contact_id"
            ]
          },
          {
            "required": [
              "phone"
            ]
          }
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "chat_id",
          "accepted_by_provider",
          "delivered_to_whatsapp"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "chat_id": {
            "type": "string"
          },
          "accepted_by_provider": {
            "type": "boolean"
          },
          "delivered_to_whatsapp": {
            "type": "boolean"
          }
        }
      },
      "parameters": {
        "channel_id": "UUID do canal WhatsApp",
        "contact_id": "UUID do contato (alternativo a phone)",
        "phone": "Telefone (alternativo a contact_id); upsert do contato",
        "name": "Nome do contato ao criar por phone",
        "message": "Texto inicial enviado no WhatsApp (não é nota). Vazio = só abre a conversa.",
        "confirmed": "Obrigatório true: humano confirmou abrir/reabrir a conversa e o envio, se houver",
        "idempotency_key": "Chave estável para esta operação e conteúdo. Reutilize a mesma chave ao reconciliar uma resposta perdida; nunca gere outra chave para repetir a mesma operação."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "CONFIRMATION_REQUIRED",
        "IDEMPOTENCY_PAYLOAD_MISMATCH",
        "IDEMPOTENCY_IN_PROGRESS",
        "IDEMPOTENCY_RESULT_UNKNOWN",
        "DELIVERY_FAILED",
        "DELIVERY_UNKNOWN",
        "IDEMPOTENCY_KEY_INVALID",
        "IDEMPOTENCY_SCOPE_INVALID",
        "IDEMPOTENCY_PAYLOAD_INVALID",
        "IDEMPOTENCY_UNAVAILABLE"
      ]
    },
    {
      "name": "wa_send_text",
      "title": "Enviar texto confirmado",
      "description": "Envia texto à conversa autorizada após confirmação humana específica. Um resultado incerto exige reconciliação da tentativa original.",
      "effect": "mutation",
      "scopes": [
        "mcp:write"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": true,
        "idempotentHint": false,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "chat_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "text": {
            "type": "string",
            "maxLength": 65536,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "reply_to": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "confirmed": {
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        },
        "required": [
          "chat_id",
          "text",
          "confirmed",
          "idempotency_key"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "message_id",
          "message",
          "accepted_by_provider",
          "delivered_to_whatsapp"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "message_id": {
            "type": "string"
          },
          "message": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "media_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "accepted_by_provider": {
            "const": true
          },
          "delivered_to_whatsapp": {
            "type": "boolean"
          }
        }
      },
      "parameters": {
        "chat_id": "UUID da conversa",
        "text": "Texto a enviar no WhatsApp; não cria nota interna",
        "reply_to": "UUID da mensagem a responder",
        "confirmed": "Obrigatório true: humano confirmou a mutação",
        "idempotency_key": "Chave estável para esta operação e conteúdo. Reutilize a mesma chave ao reconciliar uma resposta perdida; nunca gere outra chave para repetir a mesma operação."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "CONFIRMATION_REQUIRED",
        "IDEMPOTENCY_PAYLOAD_MISMATCH",
        "IDEMPOTENCY_IN_PROGRESS",
        "IDEMPOTENCY_RESULT_UNKNOWN",
        "DELIVERY_FAILED",
        "DELIVERY_UNKNOWN",
        "IDEMPOTENCY_KEY_INVALID",
        "IDEMPOTENCY_SCOPE_INVALID",
        "IDEMPOTENCY_PAYLOAD_INVALID",
        "IDEMPOTENCY_UNAVAILABLE"
      ]
    },
    {
      "name": "wa_send_media",
      "title": "Enviar mídia confirmada",
      "description": "Envia mídia por URL após confirmação humana específica. Confira destinatário, mídia, tipo e legenda antes de confirmar.",
      "effect": "mutation",
      "scopes": [
        "mcp:write"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": true,
        "idempotentHint": false,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "chat_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "media_url": {
            "type": "string",
            "maxLength": 8192,
            "format": "uri",
            "pattern": "^https?://"
          },
          "type": {
            "type": "string",
            "enum": [
              "image",
              "document",
              "audio",
              "video"
            ],
            "maxLength": 8192
          },
          "mime_type": {
            "type": "string",
            "maxLength": 8192,
            "pattern": "^[a-zA-Z0-9!#$&^_.+-]+/[a-zA-Z0-9!#$&^_.+-]+(?:;[^\\r\\n]*)?$"
          },
          "caption": {
            "type": "string",
            "maxLength": 65536
          },
          "filename": {
            "type": "string",
            "maxLength": 8192
          },
          "reply_to": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "confirmed": {
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        },
        "required": [
          "chat_id",
          "media_url",
          "type",
          "confirmed",
          "idempotency_key"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "message_id",
          "message",
          "accepted_by_provider",
          "delivered_to_whatsapp"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "message_id": {
            "type": "string"
          },
          "message": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "media_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "accepted_by_provider": {
            "const": true
          },
          "delivered_to_whatsapp": {
            "type": "boolean"
          }
        }
      },
      "parameters": {
        "chat_id": "UUID da conversa",
        "media_url": "URL da mídia (já hospedada / assinada)",
        "type": "Categoria da mídia; convertida para message_type e MIME no backend",
        "mime_type": "MIME real opcional, por exemplo image/png ou audio/webm; inferido da extensão quando omitido",
        "caption": "Legenda opcional (campo content)",
        "filename": "Nome original do arquivo (media_original_name)",
        "reply_to": "UUID da mensagem a responder",
        "confirmed": "Obrigatório true: humano confirmou a mutação",
        "idempotency_key": "Chave estável para esta operação e conteúdo. Reutilize a mesma chave ao reconciliar uma resposta perdida; nunca gere outra chave para repetir a mesma operação."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "CONFIRMATION_REQUIRED",
        "IDEMPOTENCY_PAYLOAD_MISMATCH",
        "IDEMPOTENCY_IN_PROGRESS",
        "IDEMPOTENCY_RESULT_UNKNOWN",
        "DELIVERY_FAILED",
        "DELIVERY_UNKNOWN",
        "IDEMPOTENCY_KEY_INVALID",
        "IDEMPOTENCY_SCOPE_INVALID",
        "IDEMPOTENCY_PAYLOAD_INVALID",
        "IDEMPOTENCY_UNAVAILABLE"
      ]
    },
    {
      "name": "wa_mark_read",
      "title": "Alterar indicador de leitura",
      "description": "Altera o indicador de leitura da conversa após confirmação. É naturalmente idempotente e não usa idempotency_key.",
      "effect": "mutation",
      "scopes": [
        "mcp:write"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": true,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "chat_id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 8192
          },
          "unread": {
            "type": "boolean"
          },
          "confirmed": {
            "type": "boolean"
          }
        },
        "required": [
          "chat_id",
          "confirmed"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "ok",
          "unread"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "ok": {
            "const": true
          },
          "unread": {
            "type": "boolean"
          }
        }
      },
      "parameters": {
        "chat_id": "UUID da conversa",
        "unread": "Se true, reabre o badge de não lido",
        "confirmed": "Obrigatório true: humano confirmou a mutação"
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "CONFIRMATION_REQUIRED"
      ]
    },
    {
      "name": "wa_search_contacts",
      "title": "Pesquisar contatos paginados",
      "description": "Pesquisa contatos por nome, telefone ou e-mail com page e limit. Use meta.next_page para continuar.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "q": {
            "type": "string",
            "maxLength": 8192,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "minimum": 1,
            "maximum": 200
          },
          "page": {
            "type": "integer",
            "default": 1,
            "minimum": 1,
            "maximum": 1000000
          }
        },
        "required": [
          "q"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "contacts",
          "meta"
        ],
        "properties": {
          "auth_mode": {
            "enum": [
              "jwt",
              "v1",
              "oauth"
            ]
          },
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          },
          "meta": {
            "type": "object",
            "required": [
              "total"
            ],
            "properties": {
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "total_count": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "page": {
                "type": "integer",
                "minimum": 1
              },
              "limit": {
                "type": "integer",
                "minimum": 1,
                "maximum": 200
              },
              "totalPages": {
                "type": "integer",
                "minimum": 0
              },
              "hasMore": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "next_page": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              }
            }
          }
        }
      },
      "parameters": {
        "q": "Termo de busca (nome, telefone, e-mail…)",
        "limit": "Máximo de resultados por página (default 20)",
        "page": "Página (default 1)"
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED"
      ]
    },
    {
      "name": "wa_connection_diagnostics",
      "title": "Diagnosticar a conexão OAuth atual sem autorizar escrita",
      "description": "Diagnóstico disponível somente em OAuth com mcp:read. Compara a conexão com expectativas obtidas independentemente; não envia mensagens. write_gate permanece false e a observação perde validade após mudança de conexão ou token. Valores de identidade e revisão são restritos ao ambiente autorizado e não são publicados aqui.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "required": [
          "expected_git_sha",
          "expected_company_hash"
        ],
        "properties": {
          "expected_git_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$",
            "maxLength": 40
          },
          "expected_company_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "maxLength": 64
          },
          "expected_subject_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "maxLength": 64
          }
        },
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "auth_mode",
          "schema_version",
          "read_only",
          "observed_at",
          "mcp_server_version",
          "expected_git_sha",
          "api_git_sha",
          "mcp_git_sha",
          "identity",
          "effective_scopes",
          "same_credential",
          "identity_stable",
          "identity_matches_expected",
          "subject_expectation_supplied",
          "release_matches_expected",
          "write_scope_present",
          "method",
          "write_capability_available",
          "inbox_write_capability_available",
          "permission_evidence_verified",
          "write_gate",
          "external_delivery_tested",
          "homologation_complete",
          "blockers"
        ],
        "properties": {
          "auth_mode": {
            "const": "oauth"
          },
          "schema_version": {
            "const": 1
          },
          "read_only": {
            "const": true
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "mcp_server_version": {
            "const": "0.7.1"
          },
          "expected_git_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          },
          "api_git_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          },
          "mcp_git_sha": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-f0-9]{40}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "identity": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "company_hash",
              "subject_hash",
              "connection_identity_hash"
            ],
            "properties": {
              "company_hash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "subject_hash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "connection_identity_hash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            }
          },
          "effective_scopes": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "enum": [
                "mcp:read",
                "mcp:write",
                "bob:consult"
              ]
            }
          },
          "same_credential": {
            "const": true
          },
          "identity_stable": {
            "const": true
          },
          "identity_matches_expected": {
            "type": "boolean"
          },
          "subject_expectation_supplied": {
            "type": "boolean"
          },
          "release_matches_expected": {
            "type": "boolean"
          },
          "write_scope_present": {
            "type": "boolean"
          },
          "method": {
            "const": "messages.send"
          },
          "write_capability_available": {
            "type": "boolean"
          },
          "inbox_write_capability_available": {
            "type": "boolean"
          },
          "permission_evidence_verified": {
            "type": "boolean"
          },
          "write_gate": {
            "const": false
          },
          "external_delivery_tested": {
            "const": false
          },
          "homologation_complete": {
            "const": false
          },
          "blockers": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "enum": [
                "MCP_REVISION_UNAVAILABLE",
                "REVISION_MISMATCH",
                "IDENTITY_MISMATCH",
                "WRITE_SCOPE_MISSING",
                "WRITE_CAPABILITY_UNAVAILABLE",
                "INBOX_WRITE_CAPABILITY_UNAVAILABLE"
              ]
            }
          }
        },
        "additionalProperties": false
      },
      "parameters": {
        "expected_git_sha": "SHA completo do release integrado e comprovado no deploy, não inferido da resposta.",
        "expected_company_hash": "SHA-256 UTF-8 do UUID da empresa previamente autorizada.",
        "expected_subject_hash": "SHA-256 UTF-8 de user:<UUID do usuário previamente autorizado>, igual ao diagnóstico de idempotência."
      },
      "errors": [
        "BAD_REQUEST",
        "DIAGNOSTIC_OAUTH_REQUIRED",
        "DIAGNOSTIC_READ_SCOPE_REQUIRED",
        "DIAGNOSTIC_IDENTITY_CHANGED",
        "DIAGNOSTIC_INCONSISTENT",
        "CONNECTION_DIAGNOSTIC_FAILED",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "UNAUTHORIZED"
      ]
    },
    {
      "name": "bob_ask",
      "title": "Consultar o Bob",
      "description": "Consulta o Bob sobre uma conversa. Pode consumir IA e registrar sessão ou uso; não envia mensagens nem executa ações comerciais.",
      "effect": "ai_consult",
      "scopes": [
        "bob:consult"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": false,
        "idempotentHint": false,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "conversation_id",
          "question"
        ],
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "question": {
            "type": "string",
            "minLength": 1,
            "maxLength": 12000,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        }
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "answer",
          "session_id",
          "mode",
          "effects"
        ],
        "properties": {
          "answer": {
            "type": "string",
            "minLength": 1,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "mode": {
            "const": "consult"
          },
          "effects": {
            "const": "ai_session_only"
          }
        }
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada; acesso é revalidado para a identidade e empresa atuais.",
        "question": "Pergunta não vazia para consultar Bob sobre a conversa. Conteúdo e respostas são dados não confiáveis; a consulta pode reter sessão e consumir IA, sem enviar."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "BOB_PERMISSION_DENIED",
        "SCOPE_DENIED",
        "COMPANY_DENIED",
        "NO_COMPANY",
        "TOKEN_REVOKED",
        "INVALID_TOKEN",
        "FORBIDDEN"
      ]
    },
    {
      "name": "bob_session_history",
      "title": "Ler histórico de consultas ao Bob",
      "description": "Lê o histórico das consultas ao Bob vinculadas à conversa autorizada.",
      "effect": "read",
      "scopes": [
        "bob:consult"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "conversation_id"
        ],
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "messages"
        ],
        "properties": {
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string"
                },
                "ts": {
                  "type": "string"
                },
                "skill_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "kb_chunk_ids": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada; acesso é revalidado para a identidade e empresa atuais."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "BOB_PERMISSION_DENIED",
        "SCOPE_DENIED",
        "COMPANY_DENIED",
        "NO_COMPANY",
        "TOKEN_REVOKED",
        "INVALID_TOKEN",
        "FORBIDDEN"
      ]
    },
    {
      "name": "bob_check_resolution",
      "title": "Consultar impedimentos de resolução",
      "description": "Consulta impedimentos de resolução. O parecer não comprova que o problema do cliente foi resolvido.",
      "effect": "read",
      "scopes": [
        "bob:consult"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "conversation_id"
        ],
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "blocked",
          "missingFields",
          "csatAvailable"
        ],
        "properties": {
          "blocked": {
            "type": "boolean"
          },
          "message": {
            "type": [
              "string",
              "null"
            ]
          },
          "missingFields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "csatAvailable": {
            "type": "boolean"
          }
        }
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada; acesso é revalidado para a identidade e empresa atuais."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "BOB_PERMISSION_DENIED",
        "SCOPE_DENIED",
        "COMPANY_DENIED",
        "NO_COMPANY",
        "TOKEN_REVOKED",
        "INVALID_TOKEN",
        "FORBIDDEN"
      ]
    },
    {
      "name": "list_conversations",
      "title": "Listar conversas visíveis à sessão",
      "description": "Lista as conversas visíveis à identidade atual, respeitando paginação, estado e responsável.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "open",
              "pending",
              "resolved",
              "archived"
            ]
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200,
            "default": 20
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "default": 1
          },
          "assignee_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            }
          },
          "meta": {
            "type": "object",
            "required": [
              "total",
              "page",
              "limit",
              "totalPages",
              "has_more",
              "next_page"
            ],
            "properties": {
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "page": {
                "type": "integer",
                "minimum": 1
              },
              "limit": {
                "type": "integer",
                "minimum": 1,
                "maximum": 200
              },
              "totalPages": {
                "type": "integer",
                "minimum": 0
              },
              "has_more": {
                "type": "boolean"
              },
              "next_page": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              }
            }
          }
        }
      },
      "parameters": {
        "status": "Filtra pelo estado da conversa; não altera o estado e não amplia acesso.",
        "limit": "Quantidade máxima de itens da página. Respeite o intervalo e o padrão do schema; contagem de lote não é total integral.",
        "page": "Número da página, começando em 1. Use a indicação de próxima página da resposta.",
        "assignee_id": "UUID do responsável para filtrar somente conversas já autorizadas; não atribui nem transfere a conversa."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "BOB_PERMISSION_DENIED",
        "SCOPE_DENIED",
        "COMPANY_DENIED",
        "NO_COMPANY",
        "TOKEN_REVOKED",
        "INVALID_TOKEN",
        "FORBIDDEN"
      ]
    },
    {
      "name": "get_conversation",
      "title": "Ler conversa e uma página de mensagens",
      "description": "Lê a conversa e uma página de mensagens. Passe next_before sem alteração para continuar o histórico.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "conversation_id"
        ],
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "message_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200,
            "default": 30
          },
          "before": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        }
      },
      "outputSchema": {
        "type": "object",
        "required": [
          "conversation",
          "messages"
        ],
        "properties": {
          "conversation": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          "messages": {
            "type": "object",
            "required": [
              "messages",
              "hasMore",
              "total",
              "next_before"
            ],
            "properties": {
              "messages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "content": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sender_type": {
                      "type": "string"
                    },
                    "message_type": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "delivery_status": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              },
              "hasMore": {
                "type": "boolean"
              },
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "next_before": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "next_cursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        }
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada; acesso é revalidado para a identidade e empresa atuais.",
        "message_limit": "Quantidade máxima de mensagens retornadas nesta página, em ordem cronológica; use messages.next_before quando messages.hasMore for true.",
        "before": "Opaque cursor returned as next_before, or a legacy message UUID. Pass it unchanged."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "BOB_PERMISSION_DENIED",
        "SCOPE_DENIED",
        "COMPANY_DENIED",
        "NO_COMPANY",
        "TOKEN_REVOKED",
        "INVALID_TOKEN",
        "FORBIDDEN"
      ]
    },
    {
      "name": "get_capabilities",
      "title": "Ler capacidades efetivas da conexão",
      "description": "Consulta capacidades efetivamente disponíveis para a conexão. A presença no catálogo não concede permissão de execução.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "get_capabilities"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "contract_version": {
                    "const": 1
                  },
                  "auth_mode": {
                    "enum": [
                      "jwt",
                      "oauth",
                      "v1"
                    ]
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[a-z][a-z0-9_]*$"
                        },
                        "effects": {
                          "enum": [
                            "none",
                            "external_message",
                            "internal_update",
                            "ai_usage_only",
                            "receipt_reconciliation"
                          ]
                        },
                        "available": {
                          "type": "boolean"
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "name",
                        "effects",
                        "available",
                        "reason"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 18,
                    "minItems": 0
                  },
                  "limits": {
                    "type": "object",
                    "properties": {
                      "message_text": {
                        "const": 4096
                      },
                      "receipt_batch": {
                        "const": 20
                      },
                      "draft_batch": {
                        "const": 5
                      },
                      "page_size": {
                        "const": 100
                      }
                    },
                    "required": [
                      "message_text",
                      "receipt_batch",
                      "draft_batch",
                      "page_size"
                    ],
                    "additionalProperties": false
                  },
                  "default_channel": {
                    "type": "object",
                    "properties": {
                      "configured": {
                        "type": "boolean"
                      },
                      "policy": {
                        "const": "explicit_then_configured_default_then_single_visible_channel"
                      }
                    },
                    "required": [
                      "configured",
                      "policy"
                    ],
                    "additionalProperties": false
                  },
                  "delivery": {
                    "type": "object",
                    "properties": {
                      "acceptance_is_delivery": {
                        "const": false
                      },
                      "receipts_may_reconcile": {
                        "const": true
                      },
                      "timestamps": {
                        "const": "first_observed_evidence"
                      }
                    },
                    "required": [
                      "acceptance_is_delivery",
                      "receipts_may_reconcile",
                      "timestamps"
                    ],
                    "additionalProperties": false
                  },
                  "unsupported": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "pattern": "^\\s*\\S[\\s\\S]*$"
                    },
                    "maxItems": 50,
                    "minItems": 0
                  }
                },
                "required": [
                  "contract_version",
                  "auth_mode",
                  "tools",
                  "limits",
                  "default_channel",
                  "delivery",
                  "unsupported"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {},
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "RATE_LIMITED",
        "AUTH_UNAVAILABLE",
        "CAPABILITIES_UNAVAILABLE"
      ]
    },
    {
      "name": "resolve_channel",
      "title": "Resolver canal sem escolher ambiguidades",
      "description": "Resolve um canal exato ou o padrão permitido. Ambiguidades e ausência de padrão devem ser resolvidas antes de prosseguir.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "resolve_channel"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "resolution": {
                    "enum": [
                      "resolved",
                      "ambiguous",
                      "not_found",
                      "unavailable"
                    ]
                  },
                  "channel": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "display_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "type": {
                            "type": "string"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "can_start": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "display_name",
                          "type",
                          "status",
                          "can_start"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "candidates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "display_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "type": {
                          "type": "string"
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "can_start": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "display_name",
                        "type",
                        "status",
                        "can_start"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 0
                  },
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "has_more": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "resolution",
                  "channel",
                  "candidates"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "from": "Nome, nome de exibição ou UUID do canal. Se omitido, somente um canal elegível e visível pode ser selecionado."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "RATE_LIMITED",
        "AGENT_READ_UNAVAILABLE",
        "DEFAULT_CHANNEL_UNAVAILABLE"
      ]
    },
    {
      "name": "resolve_contact",
      "title": "Resolver contato ou telefone de destino",
      "description": "Resolve contato ou telefone de destino sem selecionar silenciosamente um resultado ambíguo.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        },
        "required": [
          "to"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "resolve_contact"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "resolution": {
                    "enum": [
                      "resolved",
                      "ambiguous",
                      "not_found",
                      "unavailable"
                    ]
                  },
                  "contact": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "phone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "phone"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "destination": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "phone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "phone"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "candidates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "phone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "phone"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 0
                  },
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "has_more": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "resolution",
                  "contact",
                  "destination",
                  "candidates"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "to": "Nome, UUID ou telefone do destinatário. Prefira o número completo com código do país."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "RATE_LIMITED",
        "INVALID_PHONE",
        "AGENT_READ_UNAVAILABLE"
      ]
    },
    {
      "name": "preview_whatsapp",
      "title": "Pré-visualizar destino e impedimentos",
      "description": "Mostra o destino e os impedimentos antes de enviar. A prévia não envia mensagem nem substitui a confirmação humana.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        },
        "required": [
          "to",
          "text"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "preview_whatsapp"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "ready": {
                    "type": "boolean"
                  },
                  "channel": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "display_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "type": {
                            "type": "string"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "can_start": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "display_name",
                          "type",
                          "status",
                          "can_start"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contact": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "phone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "phone"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "conversation": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "company_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "channel_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "contact_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "company_id",
                          "channel_id",
                          "contact_id",
                          "status"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "destination": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "phone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "phone"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "action": {
                    "enum": [
                      "create",
                      "reuse",
                      "blocked"
                    ]
                  },
                  "blockers": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 64,
                          "pattern": "^[A-Z][A-Z0-9_]+$"
                        }
                      },
                      "required": [
                        "code"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 20,
                    "minItems": 0
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "channel_candidates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "display_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "type": {
                          "type": "string"
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "can_start": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "display_name",
                        "type",
                        "status",
                        "can_start"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 0
                  },
                  "contact_candidates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "phone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "phone"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 0
                  }
                },
                "required": [
                  "ready",
                  "channel",
                  "contact",
                  "conversation",
                  "destination",
                  "action",
                  "blockers",
                  "text"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "from": "Canal opcional por nome, nome de exibição ou UUID.",
        "to": "Contato ou telefone do destinatário.",
        "text": "Texto que seria enviado, de 1 a 4.096 caracteres; não é enviado pela prévia."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "RATE_LIMITED",
        "AGENT_READ_UNAVAILABLE"
      ]
    },
    {
      "name": "send_whatsapp",
      "title": "Enviar WhatsApp com confirmação e chave estável",
      "description": "Envia WhatsApp somente após confirmação específica, com leitura e escrita concedidas e chave de idempotência estável por intenção e conteúdo.",
      "effect": "external_message",
      "scopes": [
        "mcp:read",
        "mcp:write"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": true,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "confirmed": {
            "const": true,
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        },
        "required": [
          "to",
          "text",
          "confirmed",
          "idempotency_key"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "send_whatsapp"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "external_message"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "message_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "provider_message_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "accepted_by_provider": {
                    "type": "boolean"
                  },
                  "delivery_status": {
                    "enum": [
                      "sent",
                      "delivered",
                      "read",
                      "failed",
                      "unknown"
                    ]
                  },
                  "delivered_to_whatsapp": {
                    "type": "boolean"
                  },
                  "sent_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "read_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "channel_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "contact_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "created": {
                    "type": "boolean"
                  },
                  "reopened": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "conversation_id",
                  "message_id",
                  "provider_message_id",
                  "accepted_by_provider",
                  "delivery_status",
                  "delivered_to_whatsapp",
                  "sent_at",
                  "delivered_at",
                  "read_at",
                  "channel_id",
                  "contact_id",
                  "created",
                  "reopened"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "from": "Canal opcional por nome, nome de exibição ou UUID.",
        "to": "Contato ou telefone confirmado pelo humano como destinatário.",
        "text": "Texto confirmado pelo humano, de 1 a 4.096 caracteres.",
        "confirmed": "Deve ser literalmente true após conferência humana de destinatário, conteúdo e efeito externo.",
        "idempotency_key": "Chave estável de 8 a 128 caracteres para a mesma operação e o mesmo conteúdo."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "RATE_LIMITED",
        "CONFIRMATION_REQUIRED",
        "IDEMPOTENCY_KEY_INVALID",
        "IDEMPOTENCY_PAYLOAD_MISMATCH",
        "IDEMPOTENCY_IN_PROGRESS",
        "IDEMPOTENCY_RESULT_UNKNOWN",
        "IDEMPOTENCY_UNAVAILABLE",
        "DESTINATION_UNAVAILABLE",
        "DESTINATION_CHANGED",
        "CONVERSATION_RESOLVED",
        "DELIVERY_FAILED",
        "DELIVERY_UNKNOWN"
      ]
    },
    {
      "name": "get_message_status",
      "title": "Consultar e reconciliar status sem reenviar",
      "description": "Consulta o recibo e pode persistir evidência correlacionada do provedor. Nunca envia, reenvia ou marca a mensagem como lida.",
      "effect": "receipt_reconciliation",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "message_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "message_id"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "get_message_status"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "receipt_reconciliation"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "conversation_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "created_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "conversation_id",
                      "created_at"
                    ],
                    "additionalProperties": false
                  },
                  "receipt": {
                    "type": "object",
                    "properties": {
                      "message_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "conversation_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "accepted_by_provider": {
                        "type": "boolean"
                      },
                      "delivered_to_whatsapp": {
                        "type": "boolean"
                      },
                      "delivery_status": {
                        "enum": [
                          "sent",
                          "delivered",
                          "read",
                          "failed",
                          "unknown",
                          "not_applicable"
                        ]
                      },
                      "provider_message_id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "delivered_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "read_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "error": {
                        "type": [
                          "object",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "message_id",
                      "conversation_id",
                      "accepted_by_provider",
                      "delivered_to_whatsapp",
                      "delivery_status",
                      "provider_message_id",
                      "delivered_at",
                      "read_at"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "message",
                  "receipt"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "message_id": "UUID da mensagem WhatsApp persistida no SYSLED; não use provider_message_id."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "AGENT_READ_UNAVAILABLE",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED"
      ]
    },
    {
      "name": "get_message_status_batch",
      "title": "Consultar recibos em lote sem reenviar",
      "description": "Consulta até vinte recibos autorizados, preservando o resultado de cada item. Pode reconciliar evidência sem enviar mensagens.",
      "effect": "receipt_reconciliation",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "message_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 20,
            "minItems": 1,
            "uniqueItems": true
          }
        },
        "required": [
          "message_ids"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "get_message_status_batch"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "receipt_reconciliation"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "results": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "message_id": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "ok": {
                              "const": true
                            },
                            "data": {
                              "type": "object",
                              "properties": {
                                "message": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "format": "uuid"
                                    },
                                    "conversation_id": {
                                      "type": "string",
                                      "format": "uuid"
                                    },
                                    "created_at": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "conversation_id",
                                    "created_at"
                                  ],
                                  "additionalProperties": false
                                },
                                "receipt": {
                                  "type": "object",
                                  "properties": {
                                    "message_id": {
                                      "type": "string",
                                      "format": "uuid"
                                    },
                                    "conversation_id": {
                                      "type": "string",
                                      "format": "uuid"
                                    },
                                    "accepted_by_provider": {
                                      "type": "boolean"
                                    },
                                    "delivered_to_whatsapp": {
                                      "type": "boolean"
                                    },
                                    "delivery_status": {
                                      "enum": [
                                        "sent",
                                        "delivered",
                                        "read",
                                        "failed",
                                        "unknown",
                                        "not_applicable"
                                      ]
                                    },
                                    "provider_message_id": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "delivered_at": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "read_at": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "error": {
                                      "type": [
                                        "object",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "message_id",
                                    "conversation_id",
                                    "accepted_by_provider",
                                    "delivered_to_whatsapp",
                                    "delivery_status",
                                    "provider_message_id",
                                    "delivered_at",
                                    "read_at"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "message",
                                "receipt"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "message_id",
                            "ok",
                            "data"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "message_id": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "ok": {
                              "const": false
                            },
                            "error": {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 64,
                                  "pattern": "^[A-Z][A-Z0-9_]+$"
                                },
                                "message": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2048,
                                  "pattern": "^\\s*\\S[\\s\\S]*$"
                                },
                                "retryable": {
                                  "type": "boolean"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_started",
                                    "rejected",
                                    "failed",
                                    "unknown"
                                  ]
                                }
                              },
                              "required": [
                                "code",
                                "message",
                                "retryable",
                                "outcome"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "message_id",
                            "ok",
                            "error"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "maxItems": 20,
                    "minItems": 1
                  }
                },
                "required": [
                  "results"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "message_ids": "De 1 a 20 UUIDs únicos de mensagens WhatsApp, na ordem desejada para a resposta."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "AGENT_READ_UNAVAILABLE",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED"
      ]
    },
    {
      "name": "get_inbox_summary",
      "title": "Resumir indicadores objetivos da fila",
      "description": "Resume contagens objetivas da fila. Não mede SLA; para cobertura e prazos por política, use get_sla_summary.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "get_inbox_summary"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "total": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "open": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "pending": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "unread": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "unassigned": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "awaiting_reply": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "delivery_failed": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "needs_attention": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "attention_criteria": {
                    "type": "string"
                  },
                  "sla": {
                    "type": "object",
                    "properties": {
                      "measured": {
                        "const": false
                      }
                    },
                    "required": [
                      "measured"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "total",
                  "open",
                  "pending",
                  "unread",
                  "unassigned",
                  "awaiting_reply",
                  "delivery_failed",
                  "needs_attention",
                  "attention_criteria",
                  "sla"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {},
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "RATE_LIMITED",
        "AGENT_READ_UNAVAILABLE"
      ],
      "examples": {
        "synthetic": true,
        "input": {},
        "result": {
          "schema_version": 1,
          "ok": true,
          "operation": "get_inbox_summary",
          "request_id": "44444444-4444-4444-8444-444444444451",
          "effects": "none",
          "data": {
            "total": 0,
            "open": 0,
            "pending": 0,
            "unread": 0,
            "unassigned": 0,
            "awaiting_reply": 0,
            "delivery_failed": 0,
            "needs_attention": 0,
            "attention_criteria": "unread, unassigned, pending, awaiting reply or delivery failed",
            "sla": {
              "measured": false
            }
          },
          "error": null
        }
      }
    },
    {
      "name": "get_conversations_needing_attention",
      "title": "Listar conversas que exigem atenção",
      "description": "Lista conversas por sinais objetivos de atenção. Esses sinais não constituem medição de prazo ou prioridade de SLA.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 20
          },
          "cursor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "get_conversations_needing_attention"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversations": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "company_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "channel_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "contact_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "status": {
                          "type": "string"
                        },
                        "assignee_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "unread": {
                          "type": "boolean"
                        },
                        "contact_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "channel_display_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "updated_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "last_incoming_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "last_outgoing_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "last_outgoing_delivery_status": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "attention_reasons": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100,
                            "pattern": "^\\s*\\S[\\s\\S]*$"
                          },
                          "maxItems": 10,
                          "minItems": 0
                        }
                      },
                      "required": [
                        "id",
                        "company_id",
                        "channel_id",
                        "contact_id",
                        "status",
                        "assignee_id",
                        "unread",
                        "contact_name",
                        "channel_display_name",
                        "updated_at",
                        "last_incoming_at",
                        "last_outgoing_at",
                        "last_outgoing_delivery_status",
                        "attention_reasons"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 0
                  },
                  "has_more": {
                    "type": "boolean"
                  },
                  "next_cursor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048,
                        "pattern": "^\\s*\\S[\\s\\S]*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "attention_criteria": {
                    "type": "string"
                  },
                  "sla": {
                    "type": "object",
                    "properties": {
                      "measured": {
                        "const": false
                      }
                    },
                    "required": [
                      "measured"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "conversations",
                  "has_more",
                  "next_cursor",
                  "attention_criteria",
                  "sla"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "limit": "Quantidade por página, de 1 a 100; padrão 20.",
        "cursor": "Cursor opaco da página anterior, vinculado à empresa, identidade e versão dos critérios."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "RATE_LIMITED",
        "AGENT_READ_UNAVAILABLE"
      ]
    },
    {
      "name": "get_sla_summary",
      "title": "Resumo de SLA com cobertura medida e indisponível",
      "description": "Resume cobertura e violações de SLA. without_policy e unavailable não significam SLA saudável. SLA_READ_UNAVAILABLE é falha, nunca contagem zero.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "get_sla_summary"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "as_of": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "criteria_version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "coverage": {
                    "type": "object",
                    "properties": {
                      "eligible": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "measured": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "without_policy": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "unavailable": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "eligible",
                      "measured",
                      "without_policy",
                      "unavailable"
                    ],
                    "additionalProperties": false
                  },
                  "breaches": {
                    "type": "object",
                    "properties": {
                      "first_response": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "next_response": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "resolution": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "conversations": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "first_response",
                      "next_response",
                      "resolution",
                      "conversations"
                    ],
                    "additionalProperties": false
                  },
                  "states": {
                    "type": "object",
                    "properties": {
                      "running": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "met": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "breached": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "paused": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "unavailable": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "running",
                      "met",
                      "breached",
                      "paused",
                      "unavailable"
                    ],
                    "additionalProperties": false
                  },
                  "clocks": {
                    "type": "object",
                    "properties": {
                      "elapsed": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "business": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "elapsed",
                      "business"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "as_of",
                  "criteria_version",
                  "coverage",
                  "breaches",
                  "states",
                  "clocks"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {},
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "SLA_READ_UNAVAILABLE"
      ],
      "examples": {
        "synthetic": true,
        "input": {},
        "result": {
          "schema_version": 1,
          "ok": true,
          "operation": "get_sla_summary",
          "request_id": "00000004-0004-4004-8004-000000000004",
          "effects": "none",
          "data": {
            "as_of": "2026-01-15T12:00:00Z",
            "criteria_version": "sla-v1-exemplo",
            "coverage": {
              "eligible": 2,
              "measured": 1,
              "without_policy": 1,
              "unavailable": 0
            },
            "breaches": {
              "first_response": 1,
              "next_response": 0,
              "resolution": 0,
              "conversations": 1
            },
            "states": {
              "running": 1,
              "met": 0,
              "breached": 1,
              "paused": 1,
              "unavailable": 0
            },
            "clocks": {
              "elapsed": 3,
              "business": 0
            }
          },
          "error": null
        }
      }
    },
    {
      "name": "get_conversations_breaching_sla",
      "title": "Listar violações objetivas de SLA",
      "description": "Lista violações objetivamente medidas e sua cobertura. Passe next_cursor sem alteração. Ausência de política ou falha de leitura não comprova cumprimento do SLA.",
      "effect": "read",
      "scopes": [
        "mcp:read"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 20
          },
          "cursor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "get_conversations_breaching_sla"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "as_of": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "criteria_version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "conversations": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "company_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "channel_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "contact_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "status": {
                          "enum": [
                            "open",
                            "pending",
                            "resolved",
                            "archived"
                          ]
                        },
                        "assignee_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "contact_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "channel_display_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "metrics": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "metric": {
                                "enum": [
                                  "first_response",
                                  "next_response",
                                  "resolution"
                                ]
                              },
                              "state": {
                                "enum": [
                                  "running",
                                  "met",
                                  "breached",
                                  "paused",
                                  "unavailable"
                                ]
                              },
                              "clock": {
                                "enum": [
                                  "elapsed",
                                  "business"
                                ]
                              },
                              "started_at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "due_at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "breached_at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "completed_at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "metric",
                              "state",
                              "clock",
                              "started_at",
                              "due_at",
                              "breached_at",
                              "completed_at"
                            ],
                            "additionalProperties": false
                          },
                          "maxItems": 3,
                          "minItems": 1
                        }
                      },
                      "required": [
                        "id",
                        "company_id",
                        "channel_id",
                        "contact_id",
                        "status",
                        "assignee_id",
                        "contact_name",
                        "channel_display_name",
                        "metrics"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 0
                  },
                  "has_more": {
                    "type": "boolean"
                  },
                  "next_cursor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048,
                        "pattern": "^\\s*\\S[\\s\\S]*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "as_of",
                  "criteria_version",
                  "conversations",
                  "has_more",
                  "next_cursor"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "limit": "Quantidade máxima de itens da página. Respeite o intervalo e o padrão do schema; contagem de lote não é total integral.",
        "cursor": "Cursor opaco devolvido por next_cursor; passe sem alterações. Não é número de página nem permissão e continua sujeito ao escopo atual."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "SLA_READ_UNAVAILABLE",
        "SLA_CURSOR_UNAVAILABLE",
        "INVALID_CURSOR"
      ]
    },
    {
      "name": "resolve_conversation",
      "title": "Resolver uma conversa com estado esperado",
      "description": "Muda open ou pending para resolved após verificar estado esperado e confirmação. Alterar o status não comprova solução do problema do cliente.",
      "effect": "internal_update",
      "scopes": [
        "mcp:read",
        "mcp:write"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": true,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_status": {
            "enum": [
              "open",
              "pending"
            ]
          },
          "confirmed": {
            "const": true,
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        },
        "required": [
          "conversation_id",
          "expected_status",
          "confirmed",
          "idempotency_key"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "resolve_conversation"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "internal_update"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "operation": {
                    "const": "resolve"
                  },
                  "changed": {
                    "type": "boolean"
                  },
                  "transition_committed": {
                    "type": "boolean"
                  },
                  "transition": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "committed_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "actor_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "from": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "enum": [
                                  "open",
                                  "pending",
                                  "resolved",
                                  "archived"
                                ]
                              },
                              "assignee_id": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "status",
                              "assignee_id"
                            ],
                            "additionalProperties": false
                          },
                          "to": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "enum": [
                                  "open",
                                  "pending",
                                  "resolved",
                                  "archived"
                                ]
                              },
                              "assignee_id": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "status",
                              "assignee_id"
                            ],
                            "additionalProperties": false
                          },
                          "activity_message_id": {
                            "type": "string",
                            "format": "uuid"
                          }
                        },
                        "required": [
                          "id",
                          "committed_at",
                          "actor_id",
                          "from",
                          "to",
                          "activity_message_id"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "conversation": {
                    "type": "object",
                    "properties": {
                      "status": {
                        "enum": [
                          "open",
                          "pending",
                          "resolved",
                          "archived"
                        ]
                      },
                      "assignee_id": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "uuid"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "unread": {
                        "type": "boolean"
                      },
                      "resolved_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "last_reopened_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "status",
                      "assignee_id"
                    ],
                    "additionalProperties": false
                  },
                  "follow_up_effects": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "enum": [
                          "none",
                          "queued",
                          "completed",
                          "partial",
                          "unavailable"
                        ]
                      },
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^\\s*\\S[\\s\\S]*$"
                            },
                            "state": {
                              "enum": [
                                "pending",
                                "processing",
                                "completed",
                                "failed",
                                "dead_letter"
                              ]
                            }
                          },
                          "required": [
                            "type",
                            "state"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 20,
                        "minItems": 0
                      }
                    },
                    "required": [
                      "state",
                      "items"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "conversation_id",
                  "operation",
                  "changed",
                  "transition_committed",
                  "transition",
                  "conversation",
                  "follow_up_effects"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada; acesso é revalidado para a identidade e empresa atuais.",
        "expected_status": "Estado observado antes da transição. Deve corresponder ao estado atual; conflito concorrente produz STATE_CONFLICT. Valores permitidos dependem da operação.",
        "confirmed": "Deve ser true somente após confirmação humana específica da ação e efeitos. É atestação do cliente, não prova independente de consentimento.",
        "idempotency_key": "Chave estável de uma única intenção e payload, com caracteres A–Z/a–z/0–9/._:-. Reconcilie resultado incerto com a chave original; não gere outra para repetir."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "FORBIDDEN",
        "INVALID_ARGUMENT",
        "CONFIRMATION_REQUIRED",
        "IDEMPOTENCY_KEY_INVALID",
        "IDEMPOTENCY_PAYLOAD_MISMATCH",
        "IDEMPOTENCY_IN_PROGRESS",
        "STATE_CONFLICT",
        "REQUIRED_FIELDS_MISSING",
        "AUTHORIZATION_UNAVAILABLE",
        "VALIDATION_UNAVAILABLE",
        "TRANSITION_UNAVAILABLE",
        "TRANSITION_RESULT_UNKNOWN"
      ]
    },
    {
      "name": "reopen_conversation",
      "title": "Reabrir uma conversa com confirmação",
      "description": "Muda resolved ou pending para open após verificar o estado esperado e receber confirmação. A permissão é revalidada na operação.",
      "effect": "internal_update",
      "scopes": [
        "mcp:read",
        "mcp:write"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": true,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_status": {
            "enum": [
              "resolved",
              "pending"
            ]
          },
          "confirmed": {
            "const": true,
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        },
        "required": [
          "conversation_id",
          "expected_status",
          "confirmed",
          "idempotency_key"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "reopen_conversation"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "internal_update"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "operation": {
                    "const": "reopen"
                  },
                  "changed": {
                    "type": "boolean"
                  },
                  "transition_committed": {
                    "type": "boolean"
                  },
                  "transition": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "committed_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "actor_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "from": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "enum": [
                                  "open",
                                  "pending",
                                  "resolved",
                                  "archived"
                                ]
                              },
                              "assignee_id": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "status",
                              "assignee_id"
                            ],
                            "additionalProperties": false
                          },
                          "to": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "enum": [
                                  "open",
                                  "pending",
                                  "resolved",
                                  "archived"
                                ]
                              },
                              "assignee_id": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "status",
                              "assignee_id"
                            ],
                            "additionalProperties": false
                          },
                          "activity_message_id": {
                            "type": "string",
                            "format": "uuid"
                          }
                        },
                        "required": [
                          "id",
                          "committed_at",
                          "actor_id",
                          "from",
                          "to",
                          "activity_message_id"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "conversation": {
                    "type": "object",
                    "properties": {
                      "status": {
                        "enum": [
                          "open",
                          "pending",
                          "resolved",
                          "archived"
                        ]
                      },
                      "assignee_id": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "uuid"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "unread": {
                        "type": "boolean"
                      },
                      "resolved_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "last_reopened_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "status",
                      "assignee_id"
                    ],
                    "additionalProperties": false
                  },
                  "follow_up_effects": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "enum": [
                          "none",
                          "queued",
                          "completed",
                          "partial",
                          "unavailable"
                        ]
                      },
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^\\s*\\S[\\s\\S]*$"
                            },
                            "state": {
                              "enum": [
                                "pending",
                                "processing",
                                "completed",
                                "failed",
                                "dead_letter"
                              ]
                            }
                          },
                          "required": [
                            "type",
                            "state"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 20,
                        "minItems": 0
                      }
                    },
                    "required": [
                      "state",
                      "items"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "conversation_id",
                  "operation",
                  "changed",
                  "transition_committed",
                  "transition",
                  "conversation",
                  "follow_up_effects"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada; acesso é revalidado para a identidade e empresa atuais.",
        "expected_status": "Estado observado antes da transição. Deve corresponder ao estado atual; conflito concorrente produz STATE_CONFLICT. Valores permitidos dependem da operação.",
        "confirmed": "Deve ser true somente após confirmação humana específica da ação e efeitos. É atestação do cliente, não prova independente de consentimento.",
        "idempotency_key": "Chave estável de uma única intenção e payload, com caracteres A–Z/a–z/0–9/._:-. Reconcilie resultado incerto com a chave original; não gere outra para repetir."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "FORBIDDEN",
        "INVALID_ARGUMENT",
        "CONFIRMATION_REQUIRED",
        "IDEMPOTENCY_KEY_INVALID",
        "IDEMPOTENCY_PAYLOAD_MISMATCH",
        "IDEMPOTENCY_IN_PROGRESS",
        "STATE_CONFLICT",
        "REQUIRED_FIELDS_MISSING",
        "AUTHORIZATION_UNAVAILABLE",
        "VALIDATION_UNAVAILABLE",
        "TRANSITION_UNAVAILABLE",
        "TRANSITION_RESULT_UNKNOWN"
      ]
    },
    {
      "name": "assign_conversation",
      "title": "Atribuir conversa a atendente exato",
      "description": "Atribui a conversa a um atendente ativo exato, preservando o status. Exige estado e responsável esperados; ambiguidade ou concorrência impedem a alteração.",
      "effect": "internal_update",
      "scopes": [
        "mcp:read",
        "mcp:write"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": true,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "assignee": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          },
          "expected_status": {
            "enum": [
              "open",
              "pending",
              "resolved",
              "archived"
            ]
          },
          "expected_assignee_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmed": {
            "const": true,
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        },
        "required": [
          "conversation_id",
          "assignee",
          "expected_status",
          "expected_assignee_id",
          "confirmed",
          "idempotency_key"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "assign_conversation"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "internal_update"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "operation": {
                    "const": "assign"
                  },
                  "changed": {
                    "type": "boolean"
                  },
                  "transition_committed": {
                    "type": "boolean"
                  },
                  "transition": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "committed_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "actor_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "from": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "enum": [
                                  "open",
                                  "pending",
                                  "resolved",
                                  "archived"
                                ]
                              },
                              "assignee_id": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "status",
                              "assignee_id"
                            ],
                            "additionalProperties": false
                          },
                          "to": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "enum": [
                                  "open",
                                  "pending",
                                  "resolved",
                                  "archived"
                                ]
                              },
                              "assignee_id": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "status",
                              "assignee_id"
                            ],
                            "additionalProperties": false
                          },
                          "activity_message_id": {
                            "type": "string",
                            "format": "uuid"
                          }
                        },
                        "required": [
                          "id",
                          "committed_at",
                          "actor_id",
                          "from",
                          "to",
                          "activity_message_id"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "conversation": {
                    "type": "object",
                    "properties": {
                      "status": {
                        "enum": [
                          "open",
                          "pending",
                          "resolved",
                          "archived"
                        ]
                      },
                      "assignee_id": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "uuid"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "unread": {
                        "type": "boolean"
                      },
                      "resolved_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "last_reopened_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "status",
                      "assignee_id"
                    ],
                    "additionalProperties": false
                  },
                  "follow_up_effects": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "enum": [
                          "none",
                          "queued",
                          "completed",
                          "partial",
                          "unavailable"
                        ]
                      },
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^\\s*\\S[\\s\\S]*$"
                            },
                            "state": {
                              "enum": [
                                "pending",
                                "processing",
                                "completed",
                                "failed",
                                "dead_letter"
                              ]
                            }
                          },
                          "required": [
                            "type",
                            "state"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 20,
                        "minItems": 0
                      }
                    },
                    "required": [
                      "state",
                      "items"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "conversation_id",
                  "operation",
                  "changed",
                  "transition_committed",
                  "transition",
                  "conversation",
                  "follow_up_effects"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada; acesso é revalidado para a identidade e empresa atuais.",
        "assignee": "UUID, nome ou nome de exibição exato de atendente ativo na empresa autorizada; ambiguidade falha, sem escolher silenciosamente.",
        "expected_status": "Estado observado antes da transição. Deve corresponder ao estado atual; conflito concorrente produz STATE_CONFLICT. Valores permitidos dependem da operação.",
        "expected_assignee_id": "Responsável observado antes da atribuição: UUID, ou null quando não havia responsável. É obrigatório e comparado ao estado atual; divergência produz STATE_CONFLICT.",
        "confirmed": "Deve ser true somente após confirmação humana específica da ação e efeitos. É atestação do cliente, não prova independente de consentimento.",
        "idempotency_key": "Chave estável de uma única intenção e payload, com caracteres A–Z/a–z/0–9/._:-. Reconcilie resultado incerto com a chave original; não gere outra para repetir."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "SCOPE_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "UPSTREAM_ERROR",
        "UPSTREAM_INVALID_RESPONSE",
        "UPSTREAM_TIMEOUT",
        "NETWORK_ERROR",
        "CANCELLED",
        "FORBIDDEN",
        "INVALID_ARGUMENT",
        "CONFIRMATION_REQUIRED",
        "IDEMPOTENCY_KEY_INVALID",
        "IDEMPOTENCY_PAYLOAD_MISMATCH",
        "IDEMPOTENCY_IN_PROGRESS",
        "STATE_CONFLICT",
        "REQUIRED_FIELDS_MISSING",
        "AUTHORIZATION_UNAVAILABLE",
        "VALIDATION_UNAVAILABLE",
        "TRANSITION_UNAVAILABLE",
        "TRANSITION_RESULT_UNKNOWN",
        "ASSIGNEE_AMBIGUOUS",
        "ASSIGNEE_NOT_FOUND",
        "ASSIGNEE_NOT_AVAILABLE"
      ]
    },
    {
      "name": "summarize_conversation",
      "title": "Gerar resumo rastreável da conversa",
      "description": "Gera resumo com fatos, inferências e referências de origem. Pode consumir IA; não envia mensagens e não transcreve mídia.",
      "effect": "ai_usage_only",
      "scopes": [
        "bob:consult"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": false,
        "idempotentHint": false,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "conversation_id"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "summarize_conversation"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "ai_usage_only"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "summary": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "important_facts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1200,
                          "pattern": "^\\s*\\S[\\s\\S]*$"
                        },
                        "source_message_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "maxItems": 5,
                          "minItems": 1,
                          "uniqueItems": true
                        }
                      },
                      "required": [
                        "text",
                        "source_message_ids"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 10,
                    "minItems": 0
                  },
                  "inferences": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1200,
                          "pattern": "^\\s*\\S[\\s\\S]*$"
                        },
                        "source_message_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "maxItems": 5,
                          "minItems": 1,
                          "uniqueItems": true
                        }
                      },
                      "required": [
                        "text",
                        "source_message_ids"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 10,
                    "minItems": 0
                  },
                  "customer_intent": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1200,
                            "pattern": "^\\s*\\S[\\s\\S]*$"
                          },
                          "source_message_ids": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "maxItems": 5,
                            "minItems": 1,
                            "uniqueItems": true
                          }
                        },
                        "required": [
                          "text",
                          "source_message_ids"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pending_questions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1200,
                          "pattern": "^\\s*\\S[\\s\\S]*$"
                        },
                        "source_message_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "maxItems": 5,
                          "minItems": 1,
                          "uniqueItems": true
                        }
                      },
                      "required": [
                        "text",
                        "source_message_ids"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 10,
                    "minItems": 0
                  },
                  "commitments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1200,
                          "pattern": "^\\s*\\S[\\s\\S]*$"
                        },
                        "source_message_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "maxItems": 5,
                          "minItems": 1,
                          "uniqueItems": true
                        }
                      },
                      "required": [
                        "text",
                        "source_message_ids"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 10,
                    "minItems": 0
                  },
                  "next_actions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1200,
                          "pattern": "^\\s*\\S[\\s\\S]*$"
                        },
                        "source_message_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "maxItems": 5,
                          "minItems": 1,
                          "uniqueItems": true
                        }
                      },
                      "required": [
                        "text",
                        "source_message_ids"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 10,
                    "minItems": 0
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "message_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                      },
                      "character_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 24000
                      },
                      "truncated": {
                        "type": "boolean"
                      },
                      "has_older_messages": {
                        "type": "boolean"
                      },
                      "source_message_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "maxItems": 50,
                        "minItems": 0,
                        "uniqueItems": true
                      },
                      "snapshot_last_message_id": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "uuid"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "snapshot_last_message_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "unavailable_media_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                      }
                    },
                    "required": [
                      "message_count",
                      "character_count",
                      "truncated",
                      "has_older_messages",
                      "source_message_ids",
                      "snapshot_last_message_id",
                      "snapshot_last_message_at",
                      "unavailable_media_count"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "conversation_id",
                  "summary",
                  "important_facts",
                  "inferences",
                  "customer_intent",
                  "pending_questions",
                  "commitments",
                  "next_actions",
                  "context"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada a resumir."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "AUTH_MODE_UNSUPPORTED",
        "SCOPE_DENIED",
        "BOB_PERMISSION_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "CONTEXT_UNAVAILABLE",
        "AI_NOT_CONFIGURED",
        "AI_DISABLED",
        "AI_INVALID_RESPONSE",
        "AI_TIMEOUT",
        "AI_UNAVAILABLE",
        "BOB_LIMIT_EXCEEDED",
        "CANCELLED"
      ]
    },
    {
      "name": "draft_reply",
      "title": "Gerar rascunho que exige aprovação",
      "description": "Gera rascunho com status draft e requires_approval:true. Pode consumir IA, mas não envia nem modifica a conversa.",
      "effect": "ai_usage_only",
      "scopes": [
        "bob:consult"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": false,
        "idempotentHint": false,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "instruction": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        },
        "required": [
          "conversation_id"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "draft_reply"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "ai_usage_only"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "draft": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "status": {
                    "const": "draft"
                  },
                  "requires_approval": {
                    "const": true
                  },
                  "source_message_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "maxItems": 50,
                    "minItems": 0,
                    "uniqueItems": true
                  },
                  "warnings": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300,
                      "pattern": "^\\s*\\S[\\s\\S]*$"
                    },
                    "maxItems": 10,
                    "minItems": 0
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "message_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                      },
                      "character_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 24000
                      },
                      "truncated": {
                        "type": "boolean"
                      },
                      "has_older_messages": {
                        "type": "boolean"
                      },
                      "source_message_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "maxItems": 50,
                        "minItems": 0,
                        "uniqueItems": true
                      },
                      "snapshot_last_message_id": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "uuid"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "snapshot_last_message_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "unavailable_media_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                      }
                    },
                    "required": [
                      "message_count",
                      "character_count",
                      "truncated",
                      "has_older_messages",
                      "source_message_ids",
                      "snapshot_last_message_id",
                      "snapshot_last_message_at",
                      "unavailable_media_count"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "conversation_id",
                  "draft",
                  "status",
                  "requires_approval",
                  "source_message_ids",
                  "warnings",
                  "context"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada usada como contexto.",
        "instruction": "Orientação autenticada opcional para o rascunho, com até 2.000 caracteres; não autoriza envio."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "AUTH_MODE_UNSUPPORTED",
        "SCOPE_DENIED",
        "BOB_PERMISSION_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "CONTEXT_UNAVAILABLE",
        "AI_NOT_CONFIGURED",
        "AI_DISABLED",
        "AI_INVALID_RESPONSE",
        "AI_TIMEOUT",
        "AI_UNAVAILABLE",
        "BOB_LIMIT_EXCEEDED",
        "CANCELLED"
      ],
      "examples": {
        "synthetic": true,
        "input": {
          "conversation_id": "66666666-6666-4666-8666-666666666666",
          "instruction": "Seja breve e não prometa prazo."
        },
        "result": {
          "schema_version": 1,
          "ok": true,
          "operation": "draft_reply",
          "request_id": "44444444-4444-4444-8444-444444444454",
          "effects": "ai_usage_only",
          "data": {
            "conversation_id": "66666666-6666-4666-8666-666666666666",
            "draft": "Rascunho sintético para revisão humana.",
            "status": "draft",
            "requires_approval": true,
            "source_message_ids": [],
            "warnings": [],
            "context": {
              "message_count": 0,
              "character_count": 0,
              "truncated": false,
              "has_older_messages": false,
              "source_message_ids": [],
              "snapshot_last_message_id": null,
              "snapshot_last_message_at": null,
              "unavailable_media_count": 0
            }
          },
          "error": null
        }
      }
    },
    {
      "name": "draft_reply_batch",
      "title": "Gerar até cinco rascunhos isolados",
      "description": "Gera até cinco rascunhos em contextos separados, com sucesso ou erro por item. Todos exigem aprovação e nenhum é enviado.",
      "effect": "ai_usage_only",
      "scopes": [
        "bob:consult"
      ],
      "annotations": {
        "readOnlyHint": false,
        "destructiveHint": false,
        "idempotentHint": false,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "conversation_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 5,
            "minItems": 1,
            "uniqueItems": true
          },
          "instruction": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "pattern": "^\\s*\\S[\\s\\S]*$"
          }
        },
        "required": [
          "conversation_ids"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "draft_reply_batch"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "ai_usage_only"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "results": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "conversation_id": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "ok": {
                              "const": true
                            },
                            "data": {
                              "type": "object",
                              "properties": {
                                "conversation_id": {
                                  "type": "string",
                                  "format": "uuid"
                                },
                                "draft": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 4000,
                                  "pattern": "^\\s*\\S[\\s\\S]*$"
                                },
                                "status": {
                                  "const": "draft"
                                },
                                "requires_approval": {
                                  "const": true
                                },
                                "source_message_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "maxItems": 50,
                                  "minItems": 0,
                                  "uniqueItems": true
                                },
                                "warnings": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 300,
                                    "pattern": "^\\s*\\S[\\s\\S]*$"
                                  },
                                  "maxItems": 10,
                                  "minItems": 0
                                },
                                "context": {
                                  "type": "object",
                                  "properties": {
                                    "message_count": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 50
                                    },
                                    "character_count": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 24000
                                    },
                                    "truncated": {
                                      "type": "boolean"
                                    },
                                    "has_older_messages": {
                                      "type": "boolean"
                                    },
                                    "source_message_ids": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "format": "uuid"
                                      },
                                      "maxItems": 50,
                                      "minItems": 0,
                                      "uniqueItems": true
                                    },
                                    "snapshot_last_message_id": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "format": "uuid"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "snapshot_last_message_at": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "unavailable_media_count": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 50
                                    }
                                  },
                                  "required": [
                                    "message_count",
                                    "character_count",
                                    "truncated",
                                    "has_older_messages",
                                    "source_message_ids",
                                    "snapshot_last_message_id",
                                    "snapshot_last_message_at",
                                    "unavailable_media_count"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "conversation_id",
                                "draft",
                                "status",
                                "requires_approval",
                                "source_message_ids",
                                "warnings",
                                "context"
                              ],
                              "additionalProperties": false
                            },
                            "error": {
                              "type": "null"
                            }
                          },
                          "required": [
                            "conversation_id",
                            "ok",
                            "data",
                            "error"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "conversation_id": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "ok": {
                              "const": false
                            },
                            "data": {
                              "type": "null"
                            },
                            "error": {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 64,
                                  "pattern": "^[A-Z][A-Z0-9_]+$"
                                },
                                "message": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2048,
                                  "pattern": "^\\s*\\S[\\s\\S]*$"
                                },
                                "retryable": {
                                  "type": "boolean"
                                },
                                "outcome": {
                                  "enum": [
                                    "not_started",
                                    "rejected",
                                    "failed",
                                    "unknown"
                                  ]
                                }
                              },
                              "required": [
                                "code",
                                "message",
                                "retryable",
                                "outcome"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "conversation_id",
                            "ok",
                            "data",
                            "error"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "maxItems": 5,
                    "minItems": 1
                  }
                },
                "required": [
                  "results"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "conversation_ids": "De 1 a 5 UUIDs únicos de conversas; todos são autorizados antes de consumir IA.",
        "instruction": "Orientação autenticada opcional aplicada separadamente a cada conversa; não autoriza envio."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "AUTH_MODE_UNSUPPORTED",
        "SCOPE_DENIED",
        "BOB_PERMISSION_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "CONTEXT_UNAVAILABLE",
        "AI_NOT_CONFIGURED",
        "AI_DISABLED",
        "AI_INVALID_RESPONSE",
        "AI_TIMEOUT",
        "AI_UNAVAILABLE",
        "BOB_LIMIT_EXCEEDED",
        "CANCELLED"
      ]
    },
    {
      "name": "check_resolution",
      "title": "Verificar impedimentos sem provar resolução",
      "description": "Consulta impedimentos com advisory:true e resolution_proven:false. Não consome IA, não envia e não resolve a conversa.",
      "effect": "read",
      "scopes": [
        "bob:consult"
      ],
      "annotations": {
        "readOnlyHint": true,
        "destructiveHint": false,
        "idempotentHint": true,
        "openWorldHint": true
      },
      "inputSchema": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "conversation_id"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "schema_version": {
            "const": 1
          },
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "const": "check_resolution"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "effects": {
            "const": "none"
          },
          "data": {
            "type": [
              "object",
              "null"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema_version",
          "ok",
          "operation",
          "request_id",
          "effects",
          "data",
          "error"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "properties": {
              "ok": {
                "const": true
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "advisory": {
                    "const": true
                  },
                  "resolution_proven": {
                    "const": false
                  },
                  "blocked": {
                    "type": "boolean"
                  },
                  "missing_fields": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300,
                      "pattern": "^\\s*\\S[\\s\\S]*$"
                    },
                    "maxItems": 50,
                    "minItems": 0
                  },
                  "warnings": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300,
                      "pattern": "^\\s*\\S[\\s\\S]*$"
                    },
                    "maxItems": 10,
                    "minItems": 0
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "message_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                      },
                      "character_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 24000
                      },
                      "truncated": {
                        "type": "boolean"
                      },
                      "has_older_messages": {
                        "type": "boolean"
                      },
                      "source_message_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "maxItems": 50,
                        "minItems": 0,
                        "uniqueItems": true
                      },
                      "snapshot_last_message_id": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "uuid"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "snapshot_last_message_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "unavailable_media_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                      }
                    },
                    "required": [
                      "message_count",
                      "character_count",
                      "truncated",
                      "has_older_messages",
                      "source_message_ids",
                      "snapshot_last_message_id",
                      "snapshot_last_message_at",
                      "unavailable_media_count"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "conversation_id",
                  "advisory",
                  "resolution_proven",
                  "blocked",
                  "missing_fields",
                  "warnings",
                  "context"
                ],
                "additionalProperties": false
              },
              "error": {
                "type": "null"
              }
            }
          },
          {
            "properties": {
              "ok": {
                "const": false
              },
              "data": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 64,
                    "pattern": "^[A-Z][A-Z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "pattern": "^\\s*\\S[\\s\\S]*$"
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "outcome": {
                    "enum": [
                      "not_started",
                      "rejected",
                      "failed",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "code",
                  "message",
                  "retryable",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "parameters": {
        "conversation_id": "UUID da conversa autorizada a verificar."
      },
      "errors": [
        "BAD_REQUEST",
        "UNAUTHORIZED",
        "AUTH_MODE_UNSUPPORTED",
        "SCOPE_DENIED",
        "BOB_PERMISSION_DENIED",
        "NOT_FOUND",
        "RATE_LIMITED",
        "CONTEXT_UNAVAILABLE",
        "CANCELLED"
      ]
    }
  ]
}
