Ctrl K
ComunidadGuías…

internal/catalog/render.go

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
package catalog

import (
	"strconv"
	"strings"
)

const generatedHeader = "<!-- Generated by internal/catalog. Do not edit by hand.\n     Regenerate with BLUECLAW_WRITE_CATALOGS=1 go test ./internal/catalog/ -->\n"

func RenderTools(entries []ToolEntry) string {
	totalDescriptionBytes := 0
	lines := []string{
		generatedHeader,
		"# Tool catalog",
		"",
		"Every tool this repository registers for a model to call, and what its",
		"description costs. Capability tools are named at runtime from the device's own",
		"catalog, so they appear here as one row with no description.",
		"",
		"| Tool | Description bytes | Registered in |",
		"|---|---:|---|",
	}
	for _, entry := range entries {
		totalDescriptionBytes += entry.DescriptionBytes
		lines = append(lines, "| `"+entry.Name+"` | "+strconv.Itoa(entry.DescriptionBytes)+" | `"+entry.Source+"` |")
	}
	lines = append(lines, "", strconv.Itoa(len(entries))+" tools, "+strconv.Itoa(totalDescriptionBytes)+" bytes of description in total.", "")
	return strings.Join(lines, "\n")
}