MCPcopy Create free account
hub / github.com/Noumena-Network/code / getValue

Function getValue

src/tools/ConfigTool/ConfigTool.ts:438–455  ·  view source on GitHub ↗
(source: 'global' | 'settings', path: string[])

Source from the content-addressed store, hash-verified

436} satisfies ToolDef<InputSchema, Output>)
437
438function getValue(source: 'global' | 'settings', path: string[]): unknown {
439 if (source === 'global') {
440 const config = getGlobalConfig()
441 const key = path[0]
442 if (!key) return undefined
443 return config[key as keyof GlobalConfig]
444 }
445 const settings = getInitialSettings()
446 let current: unknown = settings
447 for (const key of path) {
448 if (current && typeof current === 'object' && key in current) {
449 current = (current as Record<string, unknown>)[key]
450 } else {
451 return undefined
452 }
453 }
454 return current
455}
456
457function buildNestedObject(
458 path: string[],

Callers 1

callFunction · 0.85

Calls 2

getGlobalConfigFunction · 0.50
getInitialSettingsFunction · 0.50

Tested by

no test coverage detected