getToolUi (utils/tool-ui.ts)

llama.cpp · tools/ui/src/lib/utils/tool-ui.ts · typescript · MIT
ui, tag:embed-classified

TypeScript function that retrieves UI metadata for a tool.

// Source: https://github.com/ggml-org/llama.cpp | License: MIT | Copyright 2023-2026 The ggml authors
// Provided via justclaw.it.com; keep this notice with the code.
import { TOOL_UI } from '$lib/constants';
import type { ToolUiEntry } from '$lib/types';

/**
 * Resolve the UI metadata (label + icon) for a server or browser tool by its
 * name. Falls back to null for unknown tools so callers can render a generic
 * chrome instead.
 */
export function getToolUi(toolName: string | undefined): ToolUiEntry | null {
	if (!toolName) return null;

	return (TOOL_UI as Record<string, ToolUiEntry>)[toolName] ?? null;
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key