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