Skip to content

HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.

fix(ui): the database tool did not appear on the page that lists an agent's tools

richard-epsillabfd8e4202826
diff --git a/ui/src/app/(app)/harnesses/[id]/page.tsx b/ui/src/app/(app)/harnesses/[id]/page.tsx
index c31fa9b9..427b62ac 100644
--- a/ui/src/app/(app)/harnesses/[id]/page.tsx
+++ b/ui/src/app/(app)/harnesses/[id]/page.tsx
@@ -8,7 +8,7 @@ import { SkelPage } from '@/components/Skel';
import { useParams, useRouter } from 'next/navigation';
import {
OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, useBases, getCustom, saveCustom, deleteCustom, createCustom, getSkillFiles, storeMcpSecret,
- modelAvailable,
+ modelAvailable, disconnectDatasource,
type CustomHarness, type OobHarness } from '@/lib/harness';
import { HarnessLogo } from '@/components/HarnessLogo';
import { CopyId } from '@/components/CopyId';
@@ -60,6 +60,22 @@ export default function HarnessSettingsPage() {
const models = oobModels(base);
const upd = (p: Partial<CustomHarness>) => setDraft((d) => (d ? { ...d, ...p } : d));
+ // Detaching the database is immediate, not part of the form's Save: it is a separate route
+ // (the credential behind it never passes through this page), and leaving it staged would mean
+ // a page showing "no database" while every turn still had one.
+ async function disconnectDb() {
+ if (!draft || busy) return;
+ setBusy(true); setErr(null);
+ try {
+ await disconnectDatasource(draft.id);
+ const fresh = { ...draft, dataSource: null };
+ setDraft(fresh);
+ setSaved((s) => (s ? { ...s, dataSource: null } : s));
+ }
+ catch (e) { setErr(e instanceof Error ? e.message : String(e)); }
+ finally { setBusy(false); }
+ }
+
async function save() {
if (!draft || busy) return;
setBusy(true); setErr(null);
@@ -190,9 +206,28 @@ export default function HarnessSettingsPage() {
<section className="form-section">
<div><h3>Tools</h3><p>Control inherited tools and add MCP servers for external capabilities.</p></div>
<div className="field-stack">
- <div className="section-actions"><strong>{baseTools.length + (draft?.mcpServers?.length || 0)} configured tools</strong>
+ <div className="section-actions"><strong>{baseTools.length + (draft?.mcpServers?.length || 0) + (draft?.dataSource ? 1 : 0)} configured tools</strong>
{!readOnly && <button className="button small" type="button" onClick={() => setMcpModal({ idx: null })}><iconify-icon icon="tabler:plus"></iconify-icon>Add MCP</button>}</div>
<div className="capability-list">
+ {/* The database, when one is connected. The gateway adds this tool per turn rather
+ than storing it on the config, so that connecting and disconnecting take effect
+ on the next turn and a stored entry can never point at a database that is gone.
+ The cost of that is what you are reading this comment because of: it did not
+ appear on the page that lists what this agent can do, so reviewing the agent
+ did not reveal that it can read a production database. It appears now, it says
+ which database, and disconnecting is here rather than somewhere else. */}
+ {draft?.dataSource && (
+ <div className="capability-row">
+ <span className="capability-icon"><iconify-icon icon="tabler:database"></iconify-icon></span>
+ <div className="capability-copy"><strong>Database</strong>
+ <span>Reads {draft.dataSource.database} · {draft.dataSource.host} · read-only, one SELECT at a time
+ {draft.dataSource.sampleRows ? ' · sees example rows' : ' · column names only, no values'}</span></div>
+ <div className="capability-actions">
+ <button className="button quiet small" type="button" disabled={readOnly || busy}
+ onClick={() => void disconnectDb()}>Disconnect</button>
+ </div>
+ </div>
+ )}
{baseTools.map((t) => (
<div key={t.name} className="capability-row">
<span className="capability-icon"><iconify-icon icon="tabler:plug"></iconify-icon></span>
diff --git a/ui/src/lib/harness.ts b/ui/src/lib/harness.ts
index d8ccc12e..8a62d6c0 100644
--- a/ui/src/lib/harness.ts
+++ b/ui/src/lib/harness.ts
@@ -42,6 +42,12 @@ export interface CustomHarness {
maxStep?: number | null; // default agent step budget per turn (blank = 40)
timeoutSeconds?: number | null; // default per-turn wall-clock cap (blank = server default)
additionalHeaders?: string[]; // declared header NAMES callers pass per request (app-level auth)
+ // The database this Harness reads, if one is connected. Read-only here: it is attached and
+ // detached through /harnesses/{id}/datasource, never by saving this form, because the value
+ // behind it is a credential this UI is never given. Present so the tools list can SHOW the
+ // database tool — the gateway adds that tool per turn rather than storing it, and a capability
+ // nobody can see on the page that lists capabilities is a capability nobody can audit.
+ dataSource?: { engine: string; host: string; database: string; sampleRows: boolean; updatedAt: number } | null;
createdAt: number;
}
@@ -278,6 +284,17 @@ export async function getCustom(id: string): Promise<CustomHarness | null> {
catch { return null; }
}
+/** Detach the database a Harness reads, and overwrite the stored credential.
+ *
+ * Its own route rather than a field on the harness save: the connection is written once, at
+ * launch, and this UI is never given the value — so there is nothing here to edit, only
+ * something to remove. Removing it is also the only off switch the database tool has, and that
+ * is deliberate: the tool exists for exactly as long as a database is connected, so a second
+ * enable/disable flag beside it would be a second thing that can disagree with the first. */
+export async function disconnectDatasource(id: string): Promise<void> {
+ await gw('DELETE', `/v1/harnesses/${encodeURIComponent(id)}/datasource`);
+}
+
export async function createCustom(input: Partial<CustomHarness> & { name: string; base: string }): Promise<CustomHarness> {
return gw<CustomHarness>('POST', '/v1/harnesses', harnessBody(input));
}