MCPcopy
hub / github.com/musistudio/claude-code-router / parseModelDescriptions

Function parseModelDescriptions

src/main/config.ts:1006–1020  ·  view source on GitHub ↗
(value: unknown, models: string[])

Source from the content-addressed store, hash-verified

1004}
1005
1006function parseModelDescriptions(value: unknown, models: string[]): Record<string, string> | undefined {
1007 if (!isObject(value)) {
1008 return undefined;
1009 }
1010
1011 const modelIds = new Set(models);
1012 const entries = Object.entries(value)
1013 .map(([rawModel, rawDescription]) => [rawModel.trim(), readString(rawDescription)] as const)
1014 .filter((entry): entry is [string, string] => {
1015 const [model, description] = entry;
1016 return Boolean(model && description && modelIds.has(model));
1017 });
1018
1019 return entries.length > 0 ? Object.fromEntries(entries) : undefined;
1020}
1021
1022function parseModelDisplayNames(value: unknown, models: string[]): Record<string, string> | undefined {
1023 if (!isObject(value)) {

Callers 1

parseProvidersFunction · 0.85

Calls 2

isObjectFunction · 0.70
readStringFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…