(gateway: GatewayClient, scope: string = 'global')
| 7 | import type { ToolResponse } from '../types'; |
| 8 | import { graphReferencesVariable } from './capabilityValidation'; |
| 9 | import { scanGraphs } from './gatewayCache'; |
| 10 | |
| 11 | export async function getVariables(gateway: GatewayClient, scope: string = 'global'): Promise<ToolResponse<Variable[]>> { |
| 12 | try { |
| 13 | const variables = await gateway.callApi<Variable[] | Record<string, Variable>>('getVarList', { scope }, 10000); |
| 14 | const data = Array.isArray(variables) |
| 15 | ? variables |
| 16 | : Object.entries(variables || {}).map(([id, variable]) => ({ ...variable, id, scope })); |
| 17 | return { success: true, data }; |
| 18 | } catch (error) { |
| 19 | return { success: false, error: `获取变量列表失败: ${error}` }; |
no outgoing calls
no test coverage detected