MCPcopy Create free account
hub / github.com/Shinplex/rever / initializeRetoolEnvironment

Function initializeRetoolEnvironment

retool.ts:210–248  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

208// Model discovery – run once at startup
209// ----------------------------------------------------------------------------
210async function initializeRetoolEnvironment() {
211 for (const acc of RETOOL_ACCOUNTS) {
212 try {
213 acc.agents = await retoolQueryAgents(acc);
214 logDebug(`${acc.domain_name} → ${acc.agents.length} agents`);
215 } catch (err) {
216 console.error(`agent query for ${acc.domain_name} failed`, err);
217 acc.agents = [];
218 }
219 }
220 // aggregate into unique model series
221 const map = new Map<string, ModelRecord>();
222 for (const acc of RETOOL_ACCOUNTS) {
223 for (const ag of acc.agents) {
224 const fullName: string = ag.data?.model ?? "unknown";
225 const series = fullName.split("-").slice(0, 3).join("-");
226 let rec = map.get(series);
227 if (!rec) {
228 rec = {
229 id: series,
230 name: ag.name,
231 model_name: fullName,
232 owned_by: fullName.toLowerCase().includes("claude")
233 ? "anthropic"
234 : "openai",
235 agents: [],
236 };
237 map.set(series, rec);
238 }
239 rec.agents.push(ag.id);
240 }
241 }
242 AVAILABLE_MODELS = [...map.values()];
243 console.log(
244 `Loaded ${AVAILABLE_MODELS.length} unique model families from ${
245 RETOOL_ACCOUNTS.length
246 } Retool account(s)`,
247 );
248}
249
250// ----------------------------------------------------------------------------
251// HTTP Server

Callers 1

retool.tsFile · 0.70

Calls 2

retoolQueryAgentsFunction · 0.70
logDebugFunction · 0.70

Tested by

no test coverage detected