Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a deterministic verification core: clinical-trial claims checked against ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI recomputed in code, oracle-tested), code-enforced exact-span grounding, and multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing at scale (unpdf + Docling), agentic workflows, Claude Science connector, compliance/audit, billing, public API, and more. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
"use client";
|
|
|
|
import { useCallback, useEffect, useState } from "react";
|
|
import { getJson } from "@/components/admin-audit/apiClient";
|
|
import type { Tool } from "./types";
|
|
|
|
interface ToolsState {
|
|
tools: Tool[];
|
|
loading: boolean;
|
|
error: string | null;
|
|
reload: () => void;
|
|
}
|
|
|
|
// Loads the org's callable tool catalog from the existing GET /api/tools.
|
|
// Shared by the tools home and the overview sub-page.
|
|
export function useTools(): ToolsState {
|
|
const [tools, setTools] = useState<Tool[]>([]);
|
|
const [loading, setLoading] = useState(true);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
const load = useCallback(async () => {
|
|
setLoading(true);
|
|
setError(null);
|
|
const res = await getJson<Tool[]>("/api/tools");
|
|
if (!res.success || !res.data) {
|
|
setError(res.error ?? "Failed to load tools.");
|
|
setLoading(false);
|
|
return;
|
|
}
|
|
setTools(res.data);
|
|
setLoading(false);
|
|
}, []);
|
|
|
|
useEffect(() => {
|
|
load();
|
|
}, [load]);
|
|
|
|
return { tools, loading, error, reload: load };
|
|
}
|