AI Core: Add module dependencies to tools
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3512526. -->
Reported by: [marcus_johansson](https://www.drupal.org/user/385947)
Related to !509
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Currently there is a problem that we might add tools to for instance the agent module that has composer dependencies that does not exist if the dependent modules are not install.</p>
<p>This means that they will break already on createInstance, something that will make for instance the AI Agents form to fail.</p>
<p>To work around this we should add to the definition any required modules for an tool, and when the definitions are loaded, this filters out definitions where a module is missing.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ol>
<li>Add a new key to the attribute called required_modules that is an string array, that is allowed to be empty and null.</li>
<li>When the definitions are loaded, use module handler to check if the module exists, otherwise do not load that definition.</li>
<li>Clear the definition cache on module installs/uninstalls</li>
</ol>
issue