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

Function setVariable

src/core/tools/variable.ts:18–25  ·  view source on GitHub ↗
(gateway: GatewayClient, id: string, value: string | number, scope: string = 'global')

Source from the content-addressed store, hash-verified

16 : Object.entries(variables || {}).map(([id, variable]) => ({ ...variable, id, scope }));
17 return { success: true, data };
18 } catch (error) {
19 return { success: false, error: `获取变量列表失败: ${error}` };
20 }
21}
22
23export async function setVariable(gateway: GatewayClient, id: string, value: string | number, scope: string = 'global'): Promise<ToolResponse> {
24 try {
25 await gateway.callApi('setVarValue', { scope, id, value }, 10000);
26 return { success: true, message: `变量 ${id} 已更新为 ${value}` };
27 } catch (error) {
28 return { success: false, error: `设置变量值失败: ${error}` };

Callers 2

createCoreToolsFunction · 0.90
registerVariableToolsFunction · 0.85

Calls 1

callApiMethod · 0.45

Tested by

no test coverage detected