execute method
Execute the tool with the given input.
Implementation
@override
Future<ToolResult> execute(Map<String, dynamic> input) async {
if (_state.isInPlanMode) {
return ToolResult.error(
'Already in plan mode. Use ExitPlanMode to leave.',
);
}
final reason = input['reason'] as String? ?? '';
_state.enterPlanMode(reason);
onPlanModeChanged?.call(true);
return ToolResult.success(
'Entered plan mode.\n'
'Reason: $reason\n\n'
'Only read-only tools are now available. '
'Use ExitPlanMode with a plan summary when ready to execute.',
);
}