Projeto do Agent Contas ORACLE
This commit is contained in:
46
scripts/check_integrations.py
Normal file
46
scripts/check_integrations.py
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import socket
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
load_dotenv(ROOT / ".env", override=False)
|
||||
|
||||
NAMES = [
|
||||
"TIM_COMPLETE_INVOICES_URL", "TIM_URL_CONSULTA_VAS", "TIM_VAS_HISTORY_URL",
|
||||
"TIM_URL_BLOQUEIO_VAS", "TIM_CANCELAMENTO_URL", "TIM_CONTRATO_URL",
|
||||
"TIM_CUSTOMER_CONTESTATION_URL", "TIM_PROTOCOL_URL",
|
||||
"TIM_SERVICE_REQUEST_STATUS_URL", "TIM_TRACKING_ACTIVITIES_URL",
|
||||
"TIM_SMS_URL", "TIM_URL_INVOICE_RECOVER", "TIM_PROFILE_FULL_URL",
|
||||
"TIM_DIVERGENCIA_URL", "LANGFUSE_HOST", "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT",
|
||||
]
|
||||
|
||||
|
||||
def probe(url: str) -> str:
|
||||
if not url:
|
||||
return "NOT_CONFIGURED"
|
||||
parsed = urlparse(url if "://" in url else "http://" + url)
|
||||
host = parsed.hostname
|
||||
port = parsed.port or (443 if parsed.scheme == "https" else 80)
|
||||
if not host:
|
||||
return "INVALID_URL"
|
||||
try:
|
||||
socket.getaddrinfo(host, port)
|
||||
except OSError as exc:
|
||||
return f"DNS_FAIL: {exc}"
|
||||
try:
|
||||
with socket.create_connection((host, port), timeout=3):
|
||||
return "TCP_OK"
|
||||
except OSError as exc:
|
||||
return f"TCP_FAIL: {exc}"
|
||||
|
||||
|
||||
print(f"TIM_GATEWAY_MODE={os.getenv('TIM_GATEWAY_MODE')} TIM_USE_MOCK_GATEWAY={os.getenv('TIM_USE_MOCK_GATEWAY')}")
|
||||
for name in NAMES:
|
||||
value = os.getenv(name, "")
|
||||
print(f"{name:38} {probe(value)} {value}")
|
||||
22
scripts/smoke_mcp.py
Normal file
22
scripts/smoke_mcp.py
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
import asyncio
|
||||
from contas_mcp.servers.contas_mcp_server.main import ToolCall, call_tool, health
|
||||
|
||||
CASES = [
|
||||
("consultar_faturas", {"msisdn": "11999999999"}),
|
||||
("invoice_explanation", {"msisdn": "11999999999"}),
|
||||
("consultar_vas", {"msisdn": "11999999999"}),
|
||||
("consultar_historico_vas", {"msisdn": "11999999999"}),
|
||||
("cancelar_vas_avulso", {"msisdn": "11999999999", "subject": "TIM Fashion Mensal"}),
|
||||
("contestar_cobranca", {"msisdn": "11999999999", "subject": "Tamboro Mensal", "valor": 14.99, "motivo": "não reconheço"}),
|
||||
]
|
||||
|
||||
async def main():
|
||||
print(await health())
|
||||
for name, arguments in CASES:
|
||||
result = await call_tool(ToolCall(tool_name=name, arguments=arguments))
|
||||
print(name, "OK" if result.get("ok") else "FAIL")
|
||||
if not result.get("ok"):
|
||||
raise SystemExit(result)
|
||||
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user