generateCli property
Whether to generate a command-line application (.cli.dart).
When true, a standalone CLI application is generated using
package:args's CommandRunner. Each annotated class becomes a
command group and each @Tool method becomes a subcommand. Tool
parameters become CLI options that respect the same validation
(pattern, maxLength, minimum, maximum, enumValues) used by
the MCP and REST artifacts.
Complex object parameters (custom classes, lists of custom classes,
maps) are accepted as JSON. Both inline JSON strings and curl-style
@path/to/file.json references are supported.
Results are emitted as JSON to stdout. Output is pretty-printed by
default; pass --compact for single-line JSON suitable for piping.
Example:
@Server(generateCli: true)
class UserStore {
@Tool(description: 'Create a new user')
static Future<User> createUser({
required String name,
required String email,
}) async { ... }
}
Then run with:
dart run bin/example.cli.dart user-store create-user \
--name='Ada' --email='ada@example.com'
Defaults to false.
Implementation
final bool generateCli;