Skip to content

Node / TypeScript

npm i @warlockcode/wartools-ai
import { WarTools, JsonFileKvStore } from '@warlockcode/wartools-ai';

const kit = WarTools.create({
  preset: 'none',
  enable: ['time.now', 'kv.*', 'fs.read_file'],
  security: {
    fsRoot: './workspace',
    httpAllowDomains: ['api.github.com'],
    maxOutputChars: 16000,
    timeoutMs: 10000,
  },
  store: new JsonFileKvStore('./.wartools-store.json'),
});

const res = await kit.execute('time.now', { timezone: 'America/Bogota' });
if (res.ok) console.log(res.data);
else console.error(res.error?.code);
  • kit.execute(name, input) returns a WarToolEnvelope; it does not throw for tool errors.
  • Runtime options go under runtime: approval (approval gate; kit.approve(id) / kit.deny(id)) and budget (budget guard; kit.budgetUsage()), retry and idempotency (retry and idempotency).
  • The MCP server CLI is the wartools-ai binary of this package: npx -y @warlockcode/wartools-ai --preset agent-core.