validation library
Opt-in validation of tool arguments against the tool's JSON Schema.
Appduct.instance.registerTool(
'add',
description: 'Adds two numbers.',
inputSchema: schema,
handler: validated(schema, (args, context) => (args['a'] as num) + (args['b'] as num)),
);
Functions
-
validated(
Map< String, Object?> inputSchema, AppductToolHandler handler) → AppductToolHandler -
Wraps
handlerso arguments that do not matchinputSchemaanswertool_input_validation_errorwithout reaching it.