(value: unknown)
| 223 | }); |
| 224 | |
| 225 | function toolNames(value: unknown): string[] { |
| 226 | if (!Array.isArray(value)) return []; |
| 227 | return value |
| 228 | .map((item) => { |
| 229 | if (item === null || typeof item !== 'object') return null; |
| 230 | const record = item as Record<string, unknown>; |
| 231 | return typeof record['name'] === 'string' ? record['name'] : null; |
| 232 | }) |
| 233 | .filter((name): name is string => name !== null); |
| 234 | } |