(metadata: Record<string, unknown>)
| 331 | }); |
| 332 | |
| 333 | const appToolMeta = (metadata: Record<string, unknown>): McpAppToolMeta | undefined => { |
| 334 | const ui = metadata.ui; |
| 335 | if (!isRecord(ui)) return undefined; |
| 336 | const resourceUri = typeof ui.resourceUri === "string" ? ui.resourceUri : undefined; |
| 337 | const visibility = Array.isArray(ui.visibility) |
| 338 | ? ui.visibility.filter( |
| 339 | (value): value is "model" | "app" => value === "model" || value === "app", |
| 340 | ) |
| 341 | : undefined; |
| 342 | return { |
| 343 | ...(resourceUri === undefined ? {} : { resourceUri }), |
| 344 | ...(visibility === undefined ? {} : { visibility }), |
| 345 | }; |
| 346 | }; |
| 347 | |
| 348 | const normalizedAppMetadata = (metadata: Record<string, unknown>) => { |
| 349 | const ui = appToolMeta(metadata); |
no test coverage detected