MCPcopy Create free account
hub / github.com/CopilotKit/OpenTag / clamp

Function clamp

app/tools/render-table.tsx:53–69  ·  view source on GitHub ↗
(
  columns: Column[],
  rows: string[][],
)

Source from the content-addressed store, hash-verified

51 ),
52});
53
54type Column = z.infer<typeof schema>["columns"][number];
55
56// Cap the native Table block at 100 rows (header included) and 20 cols.
57const MAX_COLUMNS = 20;
58const MAX_DATA_ROWS = 99;
59
60/** Clamp to platform limits, recording what was dropped. */
61export function clamp(
62 columns: Column[],
63 rows: string[][],
64): { cols: Column[]; dataRows: string[][]; notes: string[] } {
65 const cols = columns.slice(0, MAX_COLUMNS);
66 const dataRows = rows.slice(0, MAX_DATA_ROWS);
67 const notes: string[] = [];
68 if (columns.length > MAX_COLUMNS) {
69 notes.push(
70 `only the first ${MAX_COLUMNS} of ${columns.length} columns shown`,
71 );
72 }

Callers 2

handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected