Skip to content
reaatechREAATECH

@reaatech/structured-function-calling-ai-cli

pending npm

Scaffold, validate, and dry-run AI tool definitions via a CLI or a set of exported utility functions. It requires `@reaatech/structured-function-calling-ai-core` and `@reaatech/structured-function-calling-ai-engine` to execute and validate tool definitions.

@reaatech/structured-function-calling-ai-cli

Scaffold, validate, and dry-run tool definitions from the command line.

Installation

terminal
pnpm add @reaatech/structured-function-calling-ai-cli

The CLI exposes the tcc binary.

API

init

typescript
function init(name: string, cwd: string): Promise<void>;

Scaffolds a new {name}.tool.ts file in cwd. Writes a ToolDefinition template with a Zod schema placeholder. Throws if name is empty. Skips without error if the file already exists.

validate

typescript
function validate(filePath: string): Promise<ValidationResult>;
 
type ValidationResult = { valid: boolean; errors?: string[] };

Reads filePath, checks that the content contains the string ToolDefinition, and returns a ValidationResult. Throws if the file does not exist. Returns { valid: true } on pass or { valid: false, errors: [...] } on failure.

dryRun

typescript
function dryRun(
  toolName: string,
  input: Record<string, unknown>,
  registry: ToolRegistry,
): Promise<void>;

Executes toolName from registry with input using a fresh ToolExecutor (no middleware). Prints the ExecutionResult as JSON to stdout. Exits with code 1 if the tool is not found in registry.

main

typescript
function main(argv: string[]): Promise<void>;

Parses argv via node:util.parseArgs and dispatches to init, validate, or dryRun. The module re-exports all command functions for testability; the actual CLI entry point is bin/tcc.mjs.

CLI usage

terminal
tcc init <name>         Scaffold a new tool definition file
tcc validate <file>     Validate a tool definition file
tcc dry-run <tool>      Dry-run a tool (requires --input)
 
Options:
  -h, --help            Show help
  -v, --version         Show version
  -i, --input <json>    Input JSON for dry-run

Usage example

terminal
# Scaffold a new tool
tcc init get_weather
 
# Validate it
tcc validate ./get_weather.tool.ts
 
# Dry-run it (tool must be registered in the registry first)
tcc dry-run get_weather --input '{"city":"NYC"}'

For programmatic use:

typescript
import { init, validate } from '@reaatech/structured-function-calling-ai-cli';
 
await init('my_tool', process.cwd());
const result = await validate('./my_tool.tool.ts');
// → { valid: true } or { valid: false, errors: ['...'] }

Dependencies

  • @reaatech/structured-function-calling-ai-core (workspace:*)
  • @reaatech/structured-function-calling-ai-engine (workspace:*)
  • zod 4.4.3