CLI Adapter

The CLI loads an Ohtools app from a local TypeScript module and exposes local inspection and execution commands. It runs on Bun in 0.1.

When to use this: use the CLI for local development, smoke tests, operator scripts, and validating the same registry that MCP stdio will expose.

ohtools --app ./src/app.ts list
ohtools --app ./src/app.ts explore hello
ohtools --app ./src/app.ts run hello --input '{"name":"Ada"}'
ohtools --app ./src/app.ts graph

The app module can export default or app.

Commands

list prints registered tools and groups. explore returns descriptors and graph context without running handlers. run validates input, executes a tool, and validates output. graph returns the built graph.

Add --human for readable output. JSON envelopes are the default and are the right shape for scripts.

Envelopes

Successful commands print:

{ "ok": true, "data": {} }

Failures print:

{ "ok": false, "error": { "code": "OHTOOLS_VALIDATION_ERROR" } }

Error codes use documented OhtoolsErrorCode values from the public API.

Exit Codes

Exit codes are documented for 0.1:

CodeMeaning
2Usage error
3Validation error
4Missing tool or non-runnable group
5Handler error
1All other adapter errors

Use Getting Started for the first CLI run and Production Patterns for smoke-check placement.