chat_tools always empty in AI log
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3575543. --> Reported by: [mediabounds](https://www.drupal.org/user/292228) Related to !1243 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Short Description: </strong>[One-line issue summary for stakeholders]<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>The `chat_tools` is always empty in the logs created by the AI Logging module even when there are tools available.</p> <p>This is because...<br> 1. <code>chat_tools</code> debug data is set to an instance of <code>\Drupal\ai\OperationType\Chat\Tools\ToolsInput</code><br> 2. <code>\Drupal\ai_logging\EventSubscriber\LogPostRequestEventSubscriber</code> uses <code>json_encode</code> when creating the log entry entity<br> 3. <code>ToolsInput</code> does not implement <code>JsonSerializable</code></p> <h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <p>Please provide information like AI modules enabled, which AI provider, browser, etc.<br> This can be reproduced by setting up a development environment with the ai, ai_search, ai_chatbot, and ai_logging modules (and their dependencies). The log entries should show that the RagTool is present, but <code>chat_tools</code> will always be <code>[]</code>.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Make <code>ToolsInput</code> does not implement <code>JsonSerializable</code>.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3> <h3 id="summary-ai-usage">AI usage (if applicable)</h3> <p>[ ] AI Assisted Issue<br> This issue was generated with AI assistance, but was reviewed and refined by the creator.</p> <p>[ ] AI Assisted Code<br> This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p> <p>[ ] AI Generated Code<br> This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p> <p>[ ] Vibe Coded<br> This code was generated by an AI and has only been functionally tested.</p>
issue