8a54daf3c9
- stream_get now reads error responses before calling _raise_for_status (httpx raises on .json()/.text access inside an unread stream context) - Raise read timeout to 120s (was 30s) so generation streams don't timeout - Document "generation" as a valid category for fable_get_app_logs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
618 B
Python
21 lines
618 B
Python
"""Admin tools: application log access (requires admin API key)."""
|
|
from __future__ import annotations
|
|
|
|
from fable_mcp.client import FableClient
|
|
|
|
|
|
async def get_app_logs(
|
|
client: FableClient,
|
|
category: str = "error",
|
|
limit: int = 20,
|
|
search: str | None = None,
|
|
) -> dict:
|
|
"""Fetch application logs from Fable. Requires an admin-scoped API key.
|
|
|
|
category: "error" | "audit" | "usage" | "generation" (default: "error")
|
|
"""
|
|
params: dict = {"category": category, "limit": limit}
|
|
if search:
|
|
params["search"] = search
|
|
return await client.get("/api/admin/logs", params=params)
|