MCPcopy Create free account
hub / github.com/allocnode/oh-my-sage / getVariables

Function getVariables

src/core/tools/variable.ts:9–16  ·  view source on GitHub ↗
(gateway: GatewayClient, scope: string = 'global')

Source from the content-addressed store, hash-verified

7import type { ToolResponse } from '../types';
8import { graphReferencesVariable } from './capabilityValidation';
9import { scanGraphs } from './gatewayCache';
10
11export 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}` };

Callers 2

createCoreToolsFunction · 0.90
registerVariableToolsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected