addToolWithProgress method
void
addToolWithProgress()
Add a tool with progress support
Implementation
void addToolWithProgress(
String name,
String description,
Map<String, dynamic> inputSchema,
Future<CallToolResult> Function(
Map<String, dynamic> arguments, {
Function(double, String)? onProgress,
}) handler,
) {
addTool(
name: name,
description: description,
inputSchema: inputSchema,
handler: (arguments) async {
// Placeholder - will be replaced below
return CallToolResult(content: []);
},
);
// Wrap the handler to support progress
_toolHandlers[name] = (arguments) async {
// Create an operation ID for progress tracking
final operationId = const Uuid().v4();
return await handler(arguments, onProgress: (progress, message) {
notifyProgress(operationId, progress, message);
});
};
}