103 schemas: list[dict[str, Any]], *, max_purpose: int = 160, confirm_marker: bool =
True
105 """Return a Markdown routing table for *schemas*, one row per tool.
107 Sorted by name; ``*`` marks a required param; ``[confirm]`` marks a
108 confirmation-gated tool. The block ends with
109 :data:`COMPACT_TOOL_MAP_SENTINEL`. Empty *schemas* → ``""``.
113 rows: list[tuple[str, str, str, str]] = []
115 fn = sch.get(
"function", sch)
116 name = str(fn.get(
"name",
"?"))
117 marker =
" [confirm]" if confirm_marker
and _is_gated(name, fn)
else ""
120 rows.append((name, marker, purpose, params))
121 rows.sort(key=
lambda r: r[0])
122 lines = [
"| Tool | Purpose | Parameters |",
"|------|---------|------------|"]
123 lines += [f
"| `{name}`{marker} | {purpose} | {params} |" for name, marker, purpose, params
in rows]
126 f
"_{len(rows)} tools. Generated from the live registry — do not hand-edit._",
128 COMPACT_TOOL_MAP_SENTINEL,
130 return "\n".join(lines)