// Tools — registry of every callable tool, with status, kind, and a // permission policy. Two-pane: list of tools (left), detail (right). const TOOL_KIND_TONES = { read: { color: 'var(--green-500)', tint: 'var(--green-100)', icon: 'book-open' }, edit: { color: 'var(--blue-500)', tint: 'var(--blue-100)', icon: 'file-edit' }, execute: { color: 'var(--orange-500)', tint: 'var(--orange-100)', icon: 'terminal' }, fetch: { color: 'var(--purple-tool-500)', tint: '#EFE0F8', icon: 'globe' }, browser: { color: 'var(--indigo-500)', tint: '#E0E5F8', icon: 'compass' }, mcp: { color: 'var(--accent)', tint: 'var(--accent-tint)',icon: 'server' }, }; const TOOLS_DATA = [ // Built-in { id: 'read_file', kind: 'read', source: 'built-in', server: '—', enabled: true, calls7d: 1284, lastUsed: '2m ago', policy: 'auto', desc: 'Read a file from disk by path. Honors hidden-file setting.' }, { id: 'write_file', kind: 'edit', source: 'built-in', server: '—', enabled: true, calls7d: 412, lastUsed: '14m ago', policy: 'approve-write', desc: 'Write content to a file, creating parent directories as needed.' }, { id: 'apply_patch', kind: 'edit', source: 'built-in', server: '—', enabled: true, calls7d: 348, lastUsed: '14m ago', policy: 'approve-write', desc: 'Apply a unified-diff patch to existing files.' }, { id: 'list_files', kind: 'read', source: 'built-in', server: '—', enabled: true, calls7d: 928, lastUsed: '32m ago', policy: 'auto', desc: 'List entries in a directory, optionally recursive.' }, { id: 'execute', kind: 'execute', source: 'built-in', server: '—', enabled: true, calls7d: 661, lastUsed: '14m ago', policy: 'approve-exec', desc: 'Run a shell command. Subject to gateway approval policy.' }, { id: 'web_fetch', kind: 'fetch', source: 'built-in', server: '—', enabled: true, calls7d: 184, lastUsed: '1h ago', policy: 'auto', desc: 'Fetch a URL and return the extracted text.' }, { id: 'web_search', kind: 'fetch', source: 'built-in', server: '—', enabled: true, calls7d: 92, lastUsed: '3h ago', policy: 'auto', desc: 'Search the public web. Returns top 10 results.' }, { id: 'browser_navigate', kind: 'browser', source: 'built-in', server: '—', enabled: false, calls7d: 0, lastUsed: 'never', policy: 'approve-all', desc: 'Drive a Chromium instance for live page interaction.' }, // MCP { id: 'github__list_issues', kind: 'mcp', source: 'mcp', server: 'github', enabled: true, calls7d: 84, lastUsed: '42m ago', policy: 'auto', desc: 'List issues for a GitHub repository the user has access to.' }, { id: 'github__create_pr', kind: 'mcp', source: 'mcp', server: 'github', enabled: true, calls7d: 12, lastUsed: 'yesterday', policy: 'approve-write', desc: 'Open a pull request from a branch.' }, { id: 'linear__list_issues', kind: 'mcp', source: 'mcp', server: 'linear', enabled: true, calls7d: 38, lastUsed: '2h ago', policy: 'auto', desc: 'Query Linear issues with filters.' }, { id: 'slack__send_message', kind: 'mcp', source: 'mcp', server: 'slack', enabled: false, calls7d: 0, lastUsed: 'never', policy: 'approve-all', desc: 'Post a message to a Slack channel as the connected user.' }, { id: 'postgres__query', kind: 'mcp', source: 'mcp', server: 'postgres-prod', enabled: true, calls7d: 14, lastUsed: '4h ago', policy: 'approve-write', desc: 'Run read-only SQL against the configured database.' }, ]; function Tools() { const [active, setActive] = React.useState('execute'); const [filter, setFilter] = React.useState('all'); const [search, setSearch] = React.useState(''); React.useEffect(() => { requestAnimationFrame(() => window.lucide && window.lucide.createIcons()); }); const filtered = TOOLS_DATA.filter(t => { if (filter === 'enabled' && !t.enabled) return false; if (filter === 'mcp' && t.source !== 'mcp') return false; if (filter === 'builtin' && t.source !== 'built-in') return false; if (search && !t.id.toLowerCase().includes(search.toLowerCase())) return false; return true; }); const tool = TOOLS_DATA.find(t => t.id === active) || TOOLS_DATA[0]; return (
SyncRegister tool} />
{/* List */}
t.enabled).length }, { value: 'mcp', label: 'MCP', count: TOOLS_DATA.filter(t => t.source === 'mcp').length }, { value: 'builtin', label: 'Built-in', count: TOOLS_DATA.filter(t => t.source === 'built-in').length }, ]} />
Built-in {filtered.filter(t => t.source === 'built-in').map(t => setActive(t.id)} /> )} MCP servers {filtered.filter(t => t.source === 'mcp').map(t => setActive(t.id)} /> )}
{/* Detail */}
); } function ToolGroupHeader({ children }) { return (
{children}
); } function ToolRow({ t, active, onClick }) { const tone = TOOL_KIND_TONES[t.kind] || TOOL_KIND_TONES.read; const [hover, setHover] = React.useState(false); return (
setHover(true)} onMouseLeave={() => setHover(false)} style={{ padding: '8px 10px', borderRadius: 7, cursor: 'pointer', marginBottom: 1, background: active ? 'var(--accent-tint)' : (hover ? 'var(--bg-quaternary)' : 'transparent'), display: 'flex', alignItems: 'center', gap: 9, }}>
{t.id}
{t.server !== '—' && {t.server}} · {t.calls7d.toLocaleString()} calls
{t.enabled ? : }
); } function ToolDetail({ tool }) { const tone = TOOL_KIND_TONES[tool.kind] || TOOL_KIND_TONES.read; return ( <>
{tool.id}
{tool.enabled ? enabled : disabled}
{tool.desc}
} /> Manage} last />
{`{ "name": "${tool.id}", "input_schema": { "type": "object", "properties": { "command": { "type": "string", "description": "Shell command" }, "cwd": { "type": "string", "default": "$PWD" }, "timeout": { "type": "integer", "default": 60 } }, "required": ["command"] } }`}
); } const POLICY_DESC = { 'auto': 'Always invoke without asking.', 'approve-write': 'Pause for approval when the tool changes state.', 'approve-exec': 'Pause for approval before every call.', 'approve-all': 'Pause for approval before every call. Strictest mode.', 'deny': 'Reject the call. Tool appears in lists but cannot be invoked.', }; function RecentCallRow({ when, args, status, duration, last }) { return (
{when} {args} {status === 'ok' && ok} {status === 'denied' && denied} {duration}
); } window.Tools = Tools;