package catalog import ( "strconv" "strings" ) const generatedHeader = "\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") }